1 // RUN: echo "int main() { return __builtin_cpu_supports(\"4xxmac\");}" > %t.c 2 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 3 4 // RUN: echo "int main() { return __builtin_cpu_supports(\"altivec\");}" > %t.c 5 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=46 -DOP=ugt -DBIT=i32 -DVALUE=0 \ 6 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 7 8 // RUN: echo "int main() { return __builtin_cpu_supports(\"archpmu\");}" > %t.c 9 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 10 11 // RUN: echo "int main() { return __builtin_cpu_supports(\"booke\");}" > %t.c 12 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 13 14 // RUN: echo "int main() { return __builtin_cpu_supports(\"cellbe\");}" > %t.c 15 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 16 17 // RUN: echo "int main() { return __builtin_cpu_supports(\"darn\");}" > %t.c 18 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=uge -DBIT=i32 -DVALUE=131072 \ 19 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 20 21 // RUN: echo "int main() { return __builtin_cpu_supports(\"dscr\");}" > %t.c 22 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=uge -DBIT=i32 -DVALUE=65536 \ 23 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 24 25 // RUN: echo "int main() { return __builtin_cpu_supports(\"ebb\");}" > %t.c 26 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=uge -DBIT=i32 -DVALUE=65536 \ 27 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 28 29 // RUN: echo "int main() { return __builtin_cpu_supports(\"efpdouble\");}" > %t.c 30 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 31 32 // RUN: echo "int main() { return __builtin_cpu_supports(\"efpsingle\");}" > %t.c 33 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 34 35 // RUN: echo "int main() { return __builtin_cpu_supports(\"pa6t\");}" > %t.c 36 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 37 38 // RUN: echo "int main() { return __builtin_cpu_supports(\"fpu\");}" > %t.c 39 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 40 41 // RUN: echo "int main() { return __builtin_cpu_supports(\"htm\");}" > %t.c 42 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=ugt -DLABLE=59 -DBIT=i64 -DVALUE=0 \ 43 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCALL 44 45 // RUN: echo "int main() { return __builtin_cpu_supports(\"htm-nosc\");}" > %t.c 46 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 47 48 // RUN: echo "int main() { return __builtin_cpu_supports(\"htm-no-suspend\");}" > %t.c 49 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 50 51 // RUN: echo "int main() { return __builtin_cpu_supports(\"ic_snoop\");}" > %t.c 52 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 53 54 // RUN: echo "int main() { return __builtin_cpu_supports(\"isel\");}" > %t.c 55 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 56 57 // RUN: echo "int main() { return __builtin_cpu_supports(\"mma\");}" > %t.c 58 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=ugt -DLABLE=62 -DBIT=i64 -DVALUE=0 \ 59 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCALL 60 61 // RUN: echo "int main() { return __builtin_cpu_supports(\"mmu\");}" > %t.c 62 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 63 64 // RUN: echo "int main() { return __builtin_cpu_supports(\"notb\");}" > %t.c 65 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 66 67 // RUN: echo "int main() { return __builtin_cpu_supports(\"arch_2_05\");}" > %t.c 68 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 69 70 // RUN: echo "int main() { return __builtin_cpu_supports(\"arch_2_06\");}" > %t.c 71 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=uge -DBIT=i32 -DVALUE=32768 \ 72 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 73 74 // RUN: echo "int main() { return __builtin_cpu_supports(\"arch_2_07\");}" > %t.c 75 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=uge -DBIT=i32 -DVALUE=65536 \ 76 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 77 78 // RUN: echo "int main() { return __builtin_cpu_supports(\"arch_3_00\");}" > %t.c 79 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=uge -DBIT=i32 -DVALUE=131072 \ 80 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 81 82 // RUN: echo "int main() { return __builtin_cpu_supports(\"arch_3_1\");}" > %t.c 83 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=uge -DBIT=i32 -DVALUE=262144 \ 84 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 85 86 // RUN: echo "int main() { return __builtin_cpu_supports(\"dfp\");}" > %t.c 87 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=53 -DOP=ne -DBIT=i32 -DVALUE=0 \ 88 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 89 90 // RUN: echo "int main() { return __builtin_cpu_supports(\"power4\");}" > %t.c 91 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 92 93 // RUN: echo "int main() { return __builtin_cpu_supports(\"power5\");}" > %t.c 94 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 95 96 // RUN: echo "int main() { return __builtin_cpu_supports(\"power5+\");}" > %t.c 97 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 98 99 // RUN: echo "int main() { return __builtin_cpu_supports(\"power6x\");}" > %t.c 100 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 101 102 // RUN: echo "int main() { return __builtin_cpu_supports(\"ppc32\");}" > %t.c 103 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 104 105 // RUN: echo "int main() { return __builtin_cpu_supports(\"ppc601\");}" > %t.c 106 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 107 108 // RUN: echo "int main() { return __builtin_cpu_supports(\"ppc64\");}" > %t.c 109 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 110 111 // RUN: echo "int main() { return __builtin_cpu_supports(\"ppcle\");}" > %t.c 112 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 113 114 // RUN: echo "int main() { return __builtin_cpu_supports(\"smt\");}" > %t.c 115 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=44 -DMASK=3 -DOP=eq -DBIT=i32 -DVALUE=3 \ 116 // RUN: --check-prefixes=CHECKOP,OPMASK,SYSCONF 117 118 // RUN: echo "int main() { return __builtin_cpu_supports(\"spe\");}" > %t.c 119 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 120 121 // RUN: echo "int main() { return __builtin_cpu_supports(\"scv\");}" > %t.c 122 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 123 124 // RUN: echo "int main() { return __builtin_cpu_supports(\"tar\");}" > %t.c 125 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=1 -DOP=uge -DBIT=i32 -DVALUE=65536 \ 126 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 127 128 // RUN: echo "int main() { return __builtin_cpu_supports(\"true_le\");}" > %t.c 129 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=1 %s 130 131 // RUN: echo "int main() { return __builtin_cpu_supports(\"ucache\");}" > %t.c 132 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=5 -DMASK=2 -DOP=eq -DBIT=i32 -DVALUE=2 \ 133 // RUN: --check-prefixes=CHECKOP,OPMASK,SYSCONF 134 135 // RUN: echo "int main() { return __builtin_cpu_supports(\"vcrypto\");}" > %t.c 136 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck -DBOOL=0 %s 137 138 // RUN: echo "int main() { return __builtin_cpu_supports(\"vsx\");}" > %t.c 139 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DPOS=46 -DOP=ugt -DBIT=i32 -DVALUE=1 \ 140 // RUN: --check-prefixes=CHECKOP,OPRT,SYSCONF 141 142 // CHECK: define i32 @main() #0 { 143 // CHECK-NEXT: entry: 144 // CHECK-NEXT: %retval = alloca i32, align 4 145 // CHECK-NEXT: store i32 0, ptr %retval, align 4 146 // CHECK-NEXT: ret i32 [[BOOL]] 147 // CHECK-NEXT: } 148 149 // SYSCONF: @_system_configuration = external global { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, i32, i64, i64, i64, i64, i32, i32, i32, i32, i32, i32, i64, i32, i8, i8, i8, i8, i32, i32, i16, i16, [3 x i32], i32 } 150 151 // CHECKOP: define i32 @main() #0 { 152 // CHECKOP-NEXT: entry: 153 // CHECKOP-NEXT: %retval = alloca i32, align 4 154 // CHECKOP-NEXT: store i32 0, ptr %retval, align 4 155 156 // SYSCONF-NEXT: %0 = load i32, ptr getelementptr inbounds ({ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, i32, i64, i64, i64, i64, i32, i32, i32, i32, i32, i32, i64, i32, i8, i8, i8, i8, i32, i32, i16, i16, [3 x i32], i32 }, ptr @_system_configuration, i32 0, i32 [[POS]]), align 4 157 // SYSCALL-NEXT: %0 = call i64 @getsystemcfg(i32 [[LABLE]]) 158 159 // OPRT-NEXT: %1 = icmp [[OP]] [[BIT]] %0, [[VALUE]] 160 // OPRT-NEXT: %conv = zext i1 %1 to i32 161 162 // OPMASK-NEXT: %1 = and i32 %0, [[MASK]] 163 // OPMASK-NEXT: %2 = icmp [[OP]] i32 %1, [[VALUE]] 164 // OPMASK-NEXT: %conv = zext i1 %2 to i32 165 166 // CHECKOP-NEXT: ret i32 %conv 167 // CHECKOP-NEXT: } 168 169 // SYSCALL: declare i64 @getsystemcfg(i32) 170 171 172