xref: /llvm-project/clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap.c (revision f563bd74cb9a4f0d2d3eb49d35536b648361ec53)
1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -O2 -triple powerpc64-unknown-linux-gnu \
3 // RUN:   -emit-llvm %s -o - -target-cpu pwr7 | \
4 // RUN:  FileCheck %s
5 // RUN: %clang_cc1 -O2 -triple powerpc64le-unknown-linux-gnu \
6 // RUN:   -emit-llvm %s -o - -target-cpu pwr8 | \
7 // RUN:  FileCheck %s
8 // RUN: %clang_cc1 -O2 -triple powerpc-unknown-aix \
9 // RUN:   -emit-llvm %s -o - -target-cpu pwr7 | \
10 // RUN:  FileCheck %s
11 // RUN: %clang_cc1 -O2 -triple powerpc64-unknown-aix \
12 // RUN:   -emit-llvm %s -o - -target-cpu pwr7 | \
13 // RUN:  FileCheck %s
14 
15 extern int ia, ib;
16 
17 // td
test_tw(void)18 void test_tw(void) {
19 // CHECK: void @llvm.ppc.tw(i32 %0, i32 %1, i32 1)
20 
21   __builtin_ppc_tw(ia, ib, 1);
22 }
23 
test_xl_tw(void)24 void test_xl_tw(void) {
25 // CHECK: void @llvm.ppc.tw(i32 %0, i32 %1, i32 1)
26 
27   __tw(ia, ib, 1);
28 }
29 
30 // trap
test_trap(void)31 void test_trap(void) {
32 // CHECK: void @llvm.ppc.trap(i32 %0)
33   __builtin_ppc_trap(ia);
34 }
35 
test_xl_trap(void)36 void test_xl_trap(void) {
37 // CHECK: void @llvm.ppc.trap(i32 %0)
38   __trap(ia);
39 }
40