From 6b8baf3062cdc7bd88867e239f26b6966ee3142c Mon Sep 17 00:00:00 2001 From: Yonghong Song Date: Thu, 7 Nov 2019 10:55:59 -0800 Subject: [PATCH] [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 --- llvm/lib/Target/BPF/BPFSubtarget.cpp | 1 + llvm/test/CodeGen/BPF/32-bit-subreg-alu.ll | 1 + 2 files changed, 2 insertions(+) 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) ; { -- GitLab