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 71 // CHECK: int b; 72 // CHECK: int c; 73 // CHECK-NOT: int d; 74 // CHECK: int e; 75 76 // CPU_NO: int g; 77 78 // CPU_V1: int g; 79 80 // CPU_V2: int h; 81 // CPU_V2: int k; 82 83 // CPU_V3: int i; 84 // CPU_V3: int k; 85 // CPU_V3: int l; 86 // CPU_V3: int m; 87 88 // CPU_V4: int j; 89 // CPU_V4: int k; 90 // CPU_V4: int l; 91 // CPU_V4: int m; 92 // CPU_V4: int n; 93 // CPU_V4: int o; 94 // CPU_V4: int p; 95 // CPU_V4: int q; 96 // CPU_V4: int r; 97 // CPU_V4: int s; 98 99 // CPU_V1: int t; 100 // CPU_V2: int t; 101 // CPU_V3: int t; 102 // CPU_V4: int t; 103 104 // CPU_V1: int u; 105 // CPU_V2: int u; 106 // CPU_V3: int u; 107 // CPU_V4: int u; 108 109 // CPU_GENERIC: int g; 110 111 // CPU_PROBE: int f; 112