1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -target-cpu pwr7 \
3 // RUN: -emit-llvm %s -o - | FileCheck %s
4
5 // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -target-cpu pwr8 \
6 // RUN: -emit-llvm %s -o - | FileCheck %s
7
8 // CHECK-LABEL: define signext i32 @test_divwe
test_divwe(void)9 int test_divwe(void)
10 {
11 int a = 74;
12 int b = 32;
13 return __builtin_divwe(a, b);
14 // CHECK: @llvm.ppc.divwe
15 }
16
17 // CHECK-LABEL: define zeroext i32 @test_divweu
test_divweu(void)18 unsigned int test_divweu(void)
19 {
20 unsigned int a = 74;
21 unsigned int b = 32;
22 return __builtin_divweu(a, b);
23 // CHECK: @llvm.ppc.divweu
24 }
25
26 // CHECK-LABEL: define i64 @test_divde
test_divde(void)27 long long test_divde(void)
28 {
29 long long a = 74LL;
30 long long b = 32LL;
31 return __builtin_divde(a, b);
32 // CHECK: @llvm.ppc.divde
33 }
34
35 // CHECK-LABEL: define i64 @test_divdeu
test_divdeu(void)36 unsigned long long test_divdeu(void)
37 {
38 unsigned long long a = 74ULL;
39 unsigned long long b = 32ULL;
40 return __builtin_divdeu(a, b);
41 // CHECK: @llvm.ppc.divdeu
42 }
43
44 // CHECK-LABEL: define i64 @test_bpermd
test_bpermd(void)45 long long test_bpermd(void)
46 {
47 long long a = 74LL;
48 long long b = 32LL;
49 return __builtin_bpermd(a, b);
50 // CHECK: @llvm.ppc.bpermd
51 }
52
53