xref: /llvm-project/clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-multiply-64bit-only.c (revision f563bd74cb9a4f0d2d3eb49d35536b648361ec53)
1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu \
3 // RUN:   -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
4 // RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu \
5 // RUN:   -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
6 // RUN: %clang_cc1 -triple powerpc64-unknown-aix \
7 // RUN:   -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
8 // RUN: not %clang_cc1 -triple powerpc-unknown-aix \
9 // RUN:   -emit-llvm %s -o - -target-cpu pwr7 2>&1 | FileCheck %s --check-prefix=CHECK-32-ERROR
10 
11 extern long int sli;
12 extern unsigned long int uli;
13 
test_builtin_ppc_mulhd()14 long long test_builtin_ppc_mulhd() {
15   // CHECK-LABEL:    @test_builtin_ppc_mulhd(
16   // CHECK:          %2 = call i64 @llvm.ppc.mulhd(i64 %0, i64 %1)
17   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
18   return __builtin_ppc_mulhd(sli, sli);
19 }
20 
test_builtin_ppc_mulhdu()21 unsigned long long test_builtin_ppc_mulhdu() {
22   // CHECK-LABEL:    @test_builtin_ppc_mulhdu(
23   // CHECK:          %2 = call i64 @llvm.ppc.mulhdu(i64 %0, i64 %1)
24   // CHECK-32-ERROR: error: this builtin is only available on 64-bit targets
25   return __builtin_ppc_mulhdu(uli, uli);
26 }
27