| 1 |
// RUN: %clang -E -target bpfel -mcpu=v1 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_NO %s |
| 2 |
// RUN: %clang -E -target bpfeb -mcpu=v1 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_NO %s |
| 3 |
// RUN: %clang -E -target bpfel -mcpu=v1 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_V1 %s |
| 4 |
// RUN: %clang -E -target bpfel -mcpu=v2 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_V2 %s |
| 5 |
// RUN: %clang -E -target bpfel -mcpu=v3 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_V3 %s |
| 6 |
// RUN: %clang -E -target bpfel -mcpu=v4 -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_V4 %s |
| 7 |
// RUN: %clang -E -target bpfel -mcpu=generic -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_GENERIC %s |
| 8 |
// RUN: %clang -E -target bpfel -mcpu=probe -x c -o - %s | FileCheck -check-prefix=CHECK -check-prefix=CPU_PROBE %s |
| 9 |
|
| 10 |
#ifdef __bpf__ |
| 11 |
int b; |
| 12 |
#endif |
| 13 |
#ifdef __BPF__ |
| 14 |
int c; |
| 15 |
#endif |
| 16 |
#ifdef bpf |
| 17 |
int d; |
| 18 |
#endif |
| 19 |
#ifdef __BPF_CPU_VERSION__ |
| 20 |
int e; |
| 21 |
#endif |
| 22 |
#if __BPF_CPU_VERSION__ == 0 |
| 23 |
int f; |
| 24 |
#endif |
| 25 |
#if __BPF_CPU_VERSION__ == 1 |
| 26 |
int g; |
| 27 |
#endif |
| 28 |
#if __BPF_CPU_VERSION__ == 2 |
| 29 |
int h; |
| 30 |
#endif |
| 31 |
#if __BPF_CPU_VERSION__ == 3 |
| 32 |
int i; |
| 33 |
#endif |
| 34 |
#if __BPF_CPU_VERSION__ == 4 |
| 35 |
int j; |
| 36 |
#endif |
| 37 |
#ifdef __BPF_FEATURE_JMP_EXT |
| 38 |
int k; |
| 39 |
#endif |
| 40 |
#ifdef __BPF_FEATURE_JMP32 |
| 41 |
int l; |
| 42 |
#endif |
| 43 |
#ifdef __BPF_FEATURE_ALU32 |
| 44 |
int m; |
| 45 |
#endif |
| 46 |
#ifdef __BPF_FEATURE_LDSX |
| 47 |
int n; |
| 48 |
#endif |
| 49 |
#ifdef __BPF_FEATURE_MOVSX |
| 50 |
int o; |
| 51 |
#endif |
| 52 |
#ifdef __BPF_FEATURE_BSWAP |
| 53 |
int p; |
| 54 |
#endif |
| 55 |
#ifdef __BPF_FEATURE_SDIV_SMOD |
| 56 |
int q; |
| 57 |
#endif |
| 58 |
#ifdef __BPF_FEATURE_GOTOL |
| 59 |
int r; |
| 60 |
#endif |
| 61 |
#ifdef __BPF_FEATURE_ST |
| 62 |
int s; |
| 63 |
#endif |
| 64 |
#ifdef __BPF_FEATURE_ADDR_SPACE_CAST |
| 65 |
int t; |
| 66 |
#endif |
| 67 |
#ifdef __BPF_FEATURE_MAY_GOTO |
| 68 |
int u; |
| 69 |
#endif |
| 70 |
#ifdef __BPF_FEATURE_LOAD_ACQ_STORE_REL |
| 71 |
int v; |
| 72 |
#endif |
| 73 |
#ifdef __BPF_FEATURE_GOTOX |
| 74 |
int w; |
| 75 |
#endif |
| 76 |
|
| 77 |
// CHECK: int b; |
| 78 |
// CHECK: int c; |
| 79 |
// CHECK-NOT: int d; |
| 80 |
// CHECK: int e; |
| 81 |
|
| 82 |
// CPU_NO: int g; |
| 83 |
|
| 84 |
// CPU_V1: int g; |
| 85 |
|
| 86 |
// CPU_V2: int h; |
| 87 |
// CPU_V2: int k; |
| 88 |
|
| 89 |
// CPU_V3: int i; |
| 90 |
// CPU_V3: int k; |
| 91 |
// CPU_V3: int l; |
| 92 |
// CPU_V3: int m; |
| 93 |
|
| 94 |
// CPU_V4: int j; |
| 95 |
// CPU_V4: int k; |
| 96 |
// CPU_V4: int l; |
| 97 |
// CPU_V4: int m; |
| 98 |
// CPU_V4: int n; |
| 99 |
// CPU_V4: int o; |
| 100 |
// CPU_V4: int p; |
| 101 |
// CPU_V4: int q; |
| 102 |
// CPU_V4: int r; |
| 103 |
// CPU_V4: int s; |
| 104 |
|
| 105 |
// CPU_V1: int t; |
| 106 |
// CPU_V2: int t; |
| 107 |
// CPU_V3: int t; |
| 108 |
// CPU_V4: int t; |
| 109 |
|
| 110 |
// CPU_V1: int u; |
| 111 |
// CPU_V2: int u; |
| 112 |
// CPU_V3: int u; |
| 113 |
// CPU_V4: int u; |
| 114 |
|
| 115 |
// CPU_V4: int v; |
| 116 |
// CPU_V4: int w; |
| 117 |
|
| 118 |
// CPU_GENERIC: int g; |
| 119 |
|
| 120 |
// CPU_PROBE: int f; |