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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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]]
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 }
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
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]])
159 // OPRT-NEXT: %1 = icmp [[OP]] [[BIT]] %0, [[VALUE]]
160 // OPRT-NEXT: %conv = zext i1 %1 to i32
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
166 // CHECKOP-NEXT: ret i32 %conv
169 // SYSCALL: declare i64 @getsystemcfg(i32)