xref: /llvm-project/clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-trap-64bit-only.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 --check-prefixes=CHECK64
5 // RUN: %clang_cc1 -O2 -triple powerpc64le-unknown-linux-gnu \
6 // RUN:   -emit-llvm %s -o - -target-cpu pwr8 | \
7 // RUN:  FileCheck %s --check-prefixes=CHECK64
8 // RUN: not %clang_cc1 -O2 -triple powerpc-unknown-aix \
9 // RUN:   -emit-llvm %s -o - -target-cpu pwr7 2>&1 | \
10 // RUN:  FileCheck %s -check-prefixes=CHECK32-ERROR
11 // RUN: %clang_cc1 -O2 -triple powerpc64-unknown-aix \
12 // RUN:   -emit-llvm %s -o - -target-cpu pwr7 | \
13 // RUN:  FileCheck %s --check-prefixes=CHECK64
14 
15 extern long long lla, llb;
16 extern double da;
17 
18 // tdw
test_xl_tdw(void)19 void test_xl_tdw(void) {
20 // CHECK64: void @llvm.ppc.tdw(i64 %0, i64 %1, i32 1)
21 // CHECK32-ERROR: error: this builtin is only available on 64-bit targets
22   __tdw(lla, llb, 1);
23 }
24 
test_tdw(void)25 void test_tdw(void) {
26 // CHECK64: void @llvm.ppc.tdw(i64 %0, i64 %1, i32 13)
27 // CHECK32-ERROR: error: this builtin is only available on 64-bit targets
28   __builtin_ppc_tdw(lla, llb, 13);
29 }
30 
31 // trapd
test_trapd(void)32 void test_trapd(void) {
33 // CHECK64: void @llvm.ppc.trapd(i64 %conv)
34 // CHECK32-ERROR: error: this builtin is only available on 64-bit targets
35   __builtin_ppc_trapd(da);
36 }
37 
test_xl_trapd(void)38 void test_xl_trapd(void) {
39 // CHECK64: void @llvm.ppc.trapd(i64 %conv)
40 // CHECK32-ERROR: error: this builtin is only available on 64-bit targets
41   __trapd(da);
42 }
43