[llvm] 6b8baf3 - [BPF] turn on -mattr=+alu32 for cpu version v3 and later
Yonghong Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 7 22:18:15 PST 2019
Author: Yonghong Song
Date: 2019-11-07T22:08:46-08:00
New Revision: 6b8baf3062cdc7bd88867e239f26b6966ee3142c
URL: https://github.com/llvm/llvm-project/commit/6b8baf3062cdc7bd88867e239f26b6966ee3142c
DIFF: https://github.com/llvm/llvm-project/commit/6b8baf3062cdc7bd88867e239f26b6966ee3142c.diff
LOG: [BPF] turn on -mattr=+alu32 for cpu version v3 and later
-mattr=+alu32 has shown good performance vs. without this attribute.
Based on discussion at
https://lore.kernel.org/bpf/1ec37838-966f-ec0b-5223-ca9b6eb0860d@fb.com/T/#t
cpu version v3 should support -mattr=+alu32.
This patch enabled alu32 if cpu version is v3, either specified by user
or probed by the llvm.
Differential Revision: https://reviews.llvm.org/D69957
Added:
Modified:
llvm/lib/Target/BPF/BPFSubtarget.cpp
llvm/test/CodeGen/BPF/32-bit-subreg-alu.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/BPF/BPFSubtarget.cpp b/llvm/lib/Target/BPF/BPFSubtarget.cpp
index ab3452501b95..f3cb03b1f1f5 100644
--- a/llvm/lib/Target/BPF/BPFSubtarget.cpp
+++ b/llvm/lib/Target/BPF/BPFSubtarget.cpp
@@ -52,6 +52,7 @@ void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
if (CPU == "v3") {
HasJmpExt = true;
HasJmp32 = true;
+ HasAlu32 = true;
return;
}
}
diff --git a/llvm/test/CodeGen/BPF/32-bit-subreg-alu.ll b/llvm/test/CodeGen/BPF/32-bit-subreg-alu.ll
index 2a498494589a..2e4e92e0126e 100644
--- a/llvm/test/CodeGen/BPF/32-bit-subreg-alu.ll
+++ b/llvm/test/CodeGen/BPF/32-bit-subreg-alu.ll
@@ -1,4 +1,5 @@
; RUN: llc -O2 -march=bpfel -mattr=+alu32 < %s | FileCheck %s
+; RUN: llc -O2 -march=bpfel -mcpu=v3 < %s | FileCheck %s
;
; int mov(int a)
; {
More information about the llvm-commits
mailing list