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: %clang_cc1 -triple powerpc-unknown-aix \
9 // RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
10 // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -ffast-math -ffp-contract=fast \
11 // RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s --check-prefix CHECK-OFAST
18 // CHECK-LABEL: @test_swdiv(
19 // CHECK: [[TMP0:%.*]] = load double, ptr @a
20 // CHECK-NEXT: [[TMP1:%.*]] = load double, ptr @b
21 // CHECK-NEXT: [[SWDIV:%.*]] = fdiv double [[TMP0]], [[TMP1]]
22 // CHECK-NEXT: ret double [[SWDIV]]
24 // CHECK-OFAST-LABEL: @test_swdiv(
25 // CHECK-OFAST: [[TMP0:%.*]] = load double, ptr @a
26 // CHECK-OFAST-NEXT: [[TMP1:%.*]] = load double, ptr @b
27 // CHECK-OFAST-NEXT: [[SWDIV:%.*]] = fdiv fast double [[TMP0]], [[TMP1]]
28 // CHECK-OFAST-NEXT: ret double [[SWDIV]]
34 // CHECK-LABEL: @test_swdivs(
35 // CHECK: [[TMP0:%.*]] = load float, ptr @c
36 // CHECK-NEXT: [[TMP1:%.*]] = load float, ptr @d
37 // CHECK-NEXT: [[SWDIVS:%.*]] = fdiv float [[TMP0]], [[TMP1]]
38 // CHECK-NEXT: ret float [[SWDIVS]]
40 // CHECK-OFAST-LABEL: @test_swdivs(
41 // CHECK-OFAST: [[TMP0:%.*]] = load float, ptr @c
42 // CHECK-OFAST-NEXT: [[TMP1:%.*]] = load float, ptr @d
43 // CHECK-OFAST-NEXT: [[SWDIVS:%.*]] = fdiv fast float [[TMP0]], [[TMP1]]
44 // CHECK-OFAST-NEXT: ret float [[SWDIVS]]
47 return __swdivs(c
, d
);
50 // CHECK-LABEL: @test_builtin_ppc_swdiv(
51 // CHECK: [[TMP0:%.*]] = load double, ptr @a
52 // CHECK-NEXT: [[TMP1:%.*]] = load double, ptr @b
53 // CHECK-NEXT: [[SWDIV:%.*]] = fdiv double [[TMP0]], [[TMP1]]
54 // CHECK-NEXT: ret double [[SWDIV]]
56 // CHECK-OFAST-LABEL: @test_builtin_ppc_swdiv(
57 // CHECK-OFAST: [[TMP0:%.*]] = load double, ptr @a
58 // CHECK-OFAST-NEXT: [[TMP1:%.*]] = load double, ptr @b
59 // CHECK-OFAST-NEXT: [[SWDIV:%.*]] = fdiv fast double [[TMP0]], [[TMP1]]
60 // CHECK-OFAST-NEXT: ret double [[SWDIV]]
62 double test_builtin_ppc_swdiv() {
63 return __builtin_ppc_swdiv(a
, b
);
66 // CHECK-LABEL: @test_builtin_ppc_swdivs(
67 // CHECK: [[TMP0:%.*]] = load float, ptr @c
68 // CHECK-NEXT: [[TMP1:%.*]] = load float, ptr @d
69 // CHECK-NEXT: [[SWDIVS:%.*]] = fdiv float [[TMP0]], [[TMP1]]
70 // CHECK-NEXT: ret float [[SWDIVS]]
72 // CHECK-OFAST-LABEL: @test_builtin_ppc_swdivs(
73 // CHECK-OFAST: [[TMP0:%.*]] = load float, ptr @c
74 // CHECK-OFAST-NEXT: [[TMP1:%.*]] = load float, ptr @d
75 // CHECK-OFAST-NEXT: [[SWDIVS:%.*]] = fdiv fast float [[TMP0]], [[TMP1]]
76 // CHECK-OFAST-NEXT: ret float [[SWDIVS]]
78 float test_builtin_ppc_swdivs() {
79 return __builtin_ppc_swdivs(c
, d
);