xref: /llvm-project/clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-pwr9-64bit.c (revision fa1f88cdeca245497843c507167b84f5522e88cc)
1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm %s \
3 // RUN:   -target-cpu pwr9 -o - | FileCheck %s
4 // RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu -emit-llvm %s \
5 // RUN:   -target-cpu pwr9 -o - | FileCheck %s
6 // RUN: %clang_cc1 -triple powerpc64-unknown-aix -emit-llvm %s \
7 // RUN:   -target-cpu pwr9 -o - | FileCheck %s
8 // RUN: not %clang_cc1 -triple powerpc-unknown-aix -emit-llvm-only %s \
9 // RUN:   -target-cpu pwr9 2>&1 | FileCheck %s --check-prefix=CHECK-32-ERROR
10 // RUN: not %clang_cc1 -triple powerpc64-unknown-aix -emit-llvm-only %s \
11 // RUN:   -target-cpu pwr8 2>&1 | FileCheck %s --check-prefix=CHECK-NONPWR9-ERR
12 
13 extern signed long long sll;
14 extern unsigned long long ull;
15 double d;
16 
test_compat_builtins()17 void test_compat_builtins() {
18   // CHECK-LABEL: @test_compat_builtins(
19   // CHECK: %2 = call i64 @llvm.ppc.cmpeqb(i64 %0, i64 %1)
20   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
21   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_cmpeqb' needs target feature isa-v30-instructions
22   sll = __builtin_ppc_cmpeqb(sll, sll);
23 
24   // CHECK: %5 = call i64 @llvm.ppc.setb(i64 %3, i64 %4)
25   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
26   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_setb' needs target feature isa-v30-instructions
27   sll = __builtin_ppc_setb(sll, sll);
28 
29   // CHECK: %9 = call i64 @llvm.ppc.maddhd(i64 %6, i64 %7, i64 %8)
30   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
31   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_maddhd' needs target feature isa-v30-instructions
32   sll = __builtin_ppc_maddhd(sll, sll, sll);
33 
34   // CHECK: %13 = call i64 @llvm.ppc.maddhdu(i64 %10, i64 %11, i64 %12)
35   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
36   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_maddhdu' needs target feature isa-v30-instructions
37   ull = __builtin_ppc_maddhdu(ull, ull, ull);
38 
39   // CHECK: %17 = call i64 @llvm.ppc.maddld(i64 %14, i64 %15, i64 %16)
40   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
41   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_maddld' needs target feature isa-v30-instructions
42   sll = __builtin_ppc_maddld(sll, sll, sll);
43 
44   // CHECK: %21 = call i64 @llvm.ppc.maddld(i64 %18, i64 %19, i64 %20)
45   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
46   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_maddld' needs target feature isa-v30-instructions
47   ull = __builtin_ppc_maddld(ull, ull, ull);
48 
49   // CHECK: %23 = call i64 @llvm.ppc.extract.sig(double %22)
50   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
51   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_extract_sig' needs target feature power9-vector
52   ull = __extract_sig (d);
53 
54   // CHECK: %26 = call double @llvm.ppc.insert.exp(double %24, i64 %25)
55   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
56   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_insert_exp' needs target feature power9-vector
57   d = __insert_exp (d, ull);
58 
59   // CHECK: %29 = call i64 @llvm.ppc.addex(i64 %27, i64 %28, i32 0)
60   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
61   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_addex' needs target feature isa-v30-instructions
62   sll = __builtin_ppc_addex(sll, sll, 0);
63 
64   // CHECK: %32 = call i64 @llvm.ppc.addex(i64 %30, i64 %31, i32 0)
65   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
66   // CHECK-NONPWR9-ERR: error: '__builtin_ppc_addex' needs target feature isa-v30-instructions
67   ull = __builtin_ppc_addex(ull, ull, 0);
68 }
69