[PATCH] D69957: [BPF] turn on -mattr=+alu32 for cpu version v3 and later

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 11:07:25 PST 2019


yonghong-song created this revision.
yonghong-song added a reviewer: ast.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
yonghong-song added a subscriber: anakryiko.

-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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69957

Files:
  llvm/lib/Target/BPF/BPFSubtarget.cpp
  llvm/test/CodeGen/BPF/32-bit-subreg-alu.ll


Index: llvm/test/CodeGen/BPF/32-bit-subreg-alu.ll
===================================================================
--- llvm/test/CodeGen/BPF/32-bit-subreg-alu.ll
+++ 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)
 ; {
Index: llvm/lib/Target/BPF/BPFSubtarget.cpp
===================================================================
--- llvm/lib/Target/BPF/BPFSubtarget.cpp
+++ llvm/lib/Target/BPF/BPFSubtarget.cpp
@@ -52,6 +52,7 @@
   if (CPU == "v3") {
     HasJmpExt = true;
     HasJmp32 = true;
+    HasAlu32 = true;
     return;
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69957.228280.patch
Type: text/x-patch
Size: 697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191107/b08b57b1/attachment.bin>


More information about the llvm-commits mailing list