[flang] Fix crash in HLFIR generation (#118399)
[llvm-project.git] / clang / test / CodeGen / aix-builtin-cpu-is.c
blob83e8c99e0a78d06f85158916f591e6e7430caacf
1 // RUN: echo "int main() { return __builtin_cpu_is(\"ppc970\");}" > %t.c
2 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
4 // RUN: echo "int main() { return __builtin_cpu_is(\"ppc-cell-be\");}" > %t.c
5 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
7 // RUN: echo "int main() { return __builtin_cpu_is(\"ppca2\");}" > %t.c
8 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
10 // RUN: echo "int main() { return __builtin_cpu_is(\"ppc405\");}" > %t.c
11 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
13 // RUN: echo "int main() { return __builtin_cpu_is(\"ppc440\");}" > %t.c
14 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
16 // RUN: echo "int main() { return __builtin_cpu_is(\"ppc464\");}" > %t.c
17 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
19 // RUN: echo "int main() { return __builtin_cpu_is(\"ppc476\");}" > %t.c
20 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
22 // RUN: echo "int main() { return __builtin_cpu_is(\"power4\");}" > %t.c
23 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
25 // RUN: echo "int main() { return __builtin_cpu_is(\"power5\");}" > %t.c
26 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
28 // RUN: echo "int main() { return __builtin_cpu_is(\"power5+\");}" > %t.c
29 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
31 // RUN: echo "int main() { return __builtin_cpu_is(\"power6\");}" > %t.c
32 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
34 // RUN: echo "int main() { return __builtin_cpu_is(\"power6x\");}" > %t.c
35 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s
37 // RUN: echo "int main() { return __builtin_cpu_is(\"power7\");}" > %t.c
38 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=32768 \
39 // RUN: --check-prefix=CHECKOP
41 // RUN: echo "int main() { return __builtin_cpu_is(\"pwr7\");}" > %t.c
42 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=32768 \
43 // RUN: --check-prefix=CHECKOP
45 // RUN: echo "int main() { return __builtin_cpu_is(\"power8\");}" > %t.c
46 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=65536 \
47 // RUN: --check-prefix=CHECKOP
49 // RUN: echo "int main() { return __builtin_cpu_is(\"power9\");}" > %t.c
50 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=131072\
51 // RUN: --check-prefix=CHECKOP
53 // RUN: echo "int main() { return __builtin_cpu_is(\"power10\");}" > %t.c
54 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=262144 \
55 // RUN: --check-prefix=CHECKOP
57 // RUN: echo "int main() { return __builtin_cpu_is(\"pwr10\");}" > %t.c
58 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=262144 \
59 // RUN: --check-prefix=CHECKOP
61 // RUN: echo "int main() { return __builtin_cpu_is(\"power11\");}" > %t.c
62 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | FileCheck %s -DVALUE=524288 \
63 // RUN: --check-prefix=CHECKOP
65 // CHECK: define i32 @main() #0 {
66 // CHECK-NEXT: entry:
67 // CHECK-NEXT: %retval = alloca i32, align 4
68 // CHECK-NEXT: store i32 0, ptr %retval, align 4
69 // CHECK-NEXT: ret i32 0
70 // CHECK-NEXT: }
72 // CHECKOP: @_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 }
73 // CHECKOP: define i32 @main() #0 {
74 // CHECKOP-NEXT: entry:
75 // CHECKOP-NEXT: %retval = alloca i32, align 4
76 // CHECKOP-NEXT: store i32 0, ptr %retval, align 4
77 // CHECKOP-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 1), align 4
78 // CHECKOP-NEXT: %1 = icmp eq i32 %0, [[VALUE]]
79 // CHECKOP-NEXT: %conv = zext i1 %1 to i32
80 // CHECKOP-NEXT: ret i32 %conv
81 // CHECKOP-NEXT: }