Skip to content

Commit

Permalink
[BPF] Make -mcpu=v3 as the default
Browse files Browse the repository at this point in the history
Before llvm20, (void)__sync_fetch_and_add(...) always generates locked xadd
insns. In linux kernel upstream discussion [1], it is found that
for arm64 architecture, the original semantics of (void)__sync_fetch_and_add(...),
i.e., __atomic_fetch_add(...), is preferred in order for jit to emit
proper native barrier insns.

In llvm commits [2] and [3], (void)__sync_fetch_and_add(...) will
generate the following insns:
  - for cpu v1/v2: locked xadd insns to keep backward compatibility
  - for cpu v3/v4: __atomic_fetch_add() insns

To ensure proper barrier semantics for (void)__sync_fetch_and_add(...),
cpu v3/v4 is recommended.

This patch enables cpu=v3 as the default cpu version. For users wanting
to use cpu v1, -mcpu=v1 needs to be explicitly added to clang/llc command line.

  [1] https://lore.kernel.org/bpf/[email protected]/T/#mb68d67bc8f39e35a0c3db52468b9de59b79f021f
  [2] llvm#101428
  [3] llvm#106494
  • Loading branch information
Yonghong Song committed Sep 3, 2024
1 parent 4a505e1 commit 670fa2f
Show file tree
Hide file tree
Showing 81 changed files with 132 additions and 127 deletions.
5 changes: 4 additions & 1 deletion clang/lib/Basic/Targets/BPF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts,

Builder.defineMacro("__BPF_FEATURE_ADDR_SPACE_CAST");

if (CPU.empty() || CPU == "generic" || CPU == "v1") {
if (CPU.empty())
CPU = "v3";

if (CPU == "generic" || CPU == "v1") {
Builder.defineMacro("__BPF_CPU_VERSION__", "1");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Preprocessor/bpf-predefined-macros.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clang -E -target bpfel -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_NO %s
// RUN: %clang -E -target bpfeb -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_NO %s
// RUN: %clang -E -target bpfel -mcpu=v1 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_NO %s
// RUN: %clang -E -target bpfeb -mcpu=v1 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_NO %s
// RUN: %clang -E -target bpfel -mcpu=v1 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_V1 %s
// RUN: %clang -E -target bpfel -mcpu=v2 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_V2 %s
// RUN: %clang -E -target bpfel -mcpu=v3 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_V3 %s
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/BPF/BPFSubtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ void BPFSubtarget::initializeEnvironment() {
}

void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
if (CPU.empty())
CPU = "v3";
if (CPU == "probe")
CPU = sys::detail::getHostCPUNameForBPF();
if (CPU == "generic" || CPU == "v1")
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/32-bit-subreg-cond-select.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc -O2 -march=bpfel -mattr=+alu32 < %s | FileCheck %s
; RUN: llc -O2 -march=bpfel -mcpu=v1 -mattr=+alu32 < %s | FileCheck %s
;
; unsigned int select_cc_32 (unsigned a, unsigned b, int c, int d)
; {
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1-bpfeb.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
; RUN: opt -O2 -S < %s | llc -filetype=asm | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: opt -O2 -S < %s | llc -mattr=+alu32 -filetype=asm | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: opt -O2 -S < %s | llc -mcpu=v1 -filetype=asm | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: opt -O2 -S < %s | llc -mcpu=v1 -mattr=+alu32 -filetype=asm | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; struct s {
; unsigned long long f1;
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-1.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
; RUN: opt -O2 -S < %s | llc -filetype=asm | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: opt -O2 -S < %s | llc -mattr=+alu32 -filetype=asm | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: opt -O2 -S < %s | llc -mcpu=v1 -filetype=asm | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: opt -O2 -S < %s | llc -mcpu=v1 -mattr=+alu32 -filetype=asm | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; struct s {
; unsigned long long f1;
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-2-bpfeb.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK-ALU32 %s
; Source code:
; struct s {
; char f1;
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/field-reloc-bitfield-2.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK-ALU32 %s
; Source code:
; struct s {
; char f1;
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-byte-size-1.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { int a1:7; int a2:4; int a3:5; int a4:16;} __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-byte-size-2.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { int a1; char a2; } __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-byte-size-3.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { int a1[10][10]; } __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-existence-1.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef unsigned __uint;
; struct s1 { int a1; __uint a2:9; __uint a3:4; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-existence-2.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef unsigned __uint;
; struct s1 { int a1; __uint a2:9; __uint a3:4; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-existence-3.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { int a1[10][10]; } __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { int a1:7; int a2:4; int a3:5; int a4:16;} __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-lshift-1.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { int a1:7; int a2:4; int a3:5; int a4:16;} __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-lshift-2.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { int a1; short a2; } __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-rshift-1.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { int a1:7; int a2:4; int a3:5; int a4:16;} __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-rshift-2.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { int a1; char a2; } __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/intrinsic-fieldinfo-rshift-3.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef struct s1 { char a1 [5][5]; } __s1;
; union u1 { int b1; __s1 b2; };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; typedef unsigned __uint;
; struct s1 { int a1; __uint a2:9; __uint a3:4; };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; enum A { AA = -1, AB = 0, }; /* signed */
; enum B { BA = 0, BB = 1, }; /* unsigned */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; Source code:
; enum A { AA = -1, AB = 0, };
; enum B { BA = 0, BB = 1, };
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/CORE/no-narrow-load.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK %s
; Source code:
; struct data_t {
; int d1;
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/offset-reloc-end-load.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-ALU32 %s
;
; Source Code:
; #define _(x) (__builtin_preserve_access_index(x))
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/offset-reloc-fieldinfo-1.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK32 %s
; Source code:
; struct s {
; int a;
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/offset-reloc-fieldinfo-2-bpfeb.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EB,CHECK32 %s
; Source code:
; struct s {
; int a;
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/CORE/offset-reloc-fieldinfo-2.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -O2 %s | llvm-dis > %t1
; RUN: llc -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK64 %s
; RUN: llc -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK32 %s
; RUN: llc -mcpu=v1 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK64 %s
; RUN: llc -mcpu=v1 -mattr=+alu32 -filetype=asm -o - %t1 | FileCheck -check-prefixes=CHECK,CHECK-EL,CHECK32 %s
; Source code:
; struct s {
; int a;
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/CodeGen/BPF/adjust-opt-icmp1.ll
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
; RUN: opt -O2 -mtriple=bpf-pc-linux %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK %s
; RUN: opt -passes='default<O2>' -mtriple=bpf-pc-linux %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK %s
; RUN: opt -O2 -mtriple=bpf-pc-linux -bpf-disable-serialize-icmp %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK-DISABLE %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK-DISABLE %s
; RUN: opt -passes='default<O2>' -mtriple=bpf-pc-linux -bpf-disable-serialize-icmp %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK-DISABLE %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK-DISABLE %s
;
; Source:
; int foo();
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/adjust-opt-icmp2.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: opt -O2 -mtriple=bpf-pc-linux %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK %s
; RUN: opt -O2 -mtriple=bpf-pc-linux -bpf-disable-serialize-icmp %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK-DISABLE %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK-DISABLE %s
;
; Source:
; int foo();
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/adjust-opt-icmp3.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
; RUN: llc %t1 -mcpu=v3 -o - | FileCheck -check-prefixes=CHECK,CHECK-V3 %s
;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/adjust-opt-icmp4.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
; RUN: llc %t1 -mcpu=v3 -o - | FileCheck -check-prefixes=CHECK,CHECK-V3 %s
;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/adjust-opt-icmp5.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
; RUN: llc %t1 -mcpu=v3 -o - | FileCheck -check-prefixes=CHECK,CHECK-V3 %s
;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/adjust-opt-icmp6.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
; RUN: llc %t1 -mcpu=v1 -o - | FileCheck -check-prefixes=CHECK,CHECK-V1 %s
; RUN: opt -O2 -S -mtriple=bpf-pc-linux %s -o %t1
; RUN: llc %t1 -mcpu=v3 -o - | FileCheck -check-prefixes=CHECK,CHECK-V3 %s
;
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/adjust-opt-speculative1.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: opt -O2 -mtriple=bpf-pc-linux %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK %s
; RUN: llc -mcpu=v1 %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK %s
; RUN: opt -O2 -mtriple=bpf-pc-linux -bpf-disable-avoid-speculation %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK-DISABLE %s
; RUN: llc -mcpu=v1 %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK-DISABLE %s
;
; Source:
; unsigned long foo();
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/CodeGen/BPF/adjust-opt-speculative2.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: opt -O2 -mtriple=bpf-pc-linux %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK %s
; RUN: llc -mcpu=v1 %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK %s
; RUN: opt -O2 -mtriple=bpf-pc-linux -bpf-disable-avoid-speculation %s | llvm-dis > %t1
; RUN: llc %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK-DISABLE %s
; RUN: llc -mcpu=v1 %t1 -o - | FileCheck -check-prefixes=CHECK-COMMON,CHECK-DISABLE %s
;
; Source:
; unsigned foo();
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/alu8.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc -march=bpfel -show-mc-encoding < %s | FileCheck %s
; RUN: llc -march=bpfel -mcpu=v1 -show-mc-encoding < %s | FileCheck %s

define i8 @mov(i8 %a, i8 %b) nounwind {
; CHECK-LABEL: mov:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/atomics.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -march=bpfel -verify-machineinstrs -show-mc-encoding | FileCheck %s
; RUN: llc < %s -march=bpfel -verify-machineinstrs -show-mc-encoding -mcpu=v1 | FileCheck %s
; RUN: llc < %s -march=bpfel -verify-machineinstrs -show-mc-encoding -mcpu=v3 | FileCheck --check-prefix=CHECK-V3 %s

; CHECK-LABEL: test_load_add_32
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/basictest.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -march=bpfel | FileCheck %s
; RUN: llc < %s -march=bpfel -mcpu=v1 | FileCheck %s

define i32 @test0(i32 %X) {
%tmp.1 = add i32 %X, 1
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/bpf-fastcall-2.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc -O2 --march=bpfel %s -o - | FileCheck %s
; RUN: llc -O2 --march=bpfel -mcpu=v1 %s -o - | FileCheck %s

; Generated from the following C code:
;
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/cc_args.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -march=bpfel -show-mc-encoding | FileCheck %s
; RUN: llc < %s -march=bpfel -mcpu=v1 -show-mc-encoding | FileCheck %s

define void @test() #0 {
entry:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/cc_args_be.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -march=bpfeb -show-mc-encoding | FileCheck %s
; RUN: llc < %s -march=bpfeb -mcpu=v1 -show-mc-encoding | FileCheck %s
; test big endian

define void @test() #0 {
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/cc_ret.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -march=bpfel | FileCheck %s
; RUN: llc < %s -march=bpfel -mcpu=v1 | FileCheck %s

define void @test() #0 {
entry:
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/cmp.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -march=bpf | FileCheck %s
; RUN: llc < %s -march=bpf -mcpu=v1 | FileCheck %s

; Function Attrs: nounwind readnone uwtable
define signext i8 @foo_cmp1(i8 signext %a, i8 signext %b) #0 {
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/cttz-ctlz.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc < %s -march=bpf | FileCheck %s
; RUN: llc < %s -march=bpf -mcpu=v1 | FileCheck %s

; test that we can expand CTTZ & CTLZ

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/ex1.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -march=bpfel | FileCheck %s
; RUN: llc < %s -march=bpfel -mcpu=v1 | FileCheck %s

%struct.bpf_context = type { i64, i64, i64, i64, i64, i64, i64 }
%struct.sk_buff = type { i64, i64, i64, i64, i64, i64, i64 }
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/CodeGen/BPF/fi_ri.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc < %s -march=bpf | FileCheck %s
; RUN: llc < %s -march=bpf -mcpu=v1 | FileCheck %s

%struct.key_t = type { i32, [16 x i8] }

Expand Down
Loading

0 comments on commit 670fa2f

Please sign in to comment.