1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc64-unknown-unknown \
3 // RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
4 // RUN: %clang_cc1 -triple powerpc64le-unknown-unknown \
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
11 extern vector
float a
;
12 extern vector
float b
;
13 extern vector
float c
;
14 extern vector
double d
;
15 extern vector
double e
;
16 extern vector
double f
;
18 // CHECK-LABEL: @test_flags_recipdivf(
19 // CHECK: [[TMP0:%.*]] = load <4 x float>, ptr @a, align 16
20 // CHECK-NEXT: [[TMP1:%.*]] = load <4 x float>, ptr @b, align 16
21 // CHECK-NEXT: [[RECIPDIV:%.*]] = fdiv fast <4 x float> [[TMP0]], [[TMP1]]
22 // CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr @c, align 16
23 // CHECK-NEXT: [[ADD:%.*]] = fadd <4 x float> [[RECIPDIV]], [[TMP2]]
24 // CHECK-NEXT: ret <4 x float> [[ADD]]
26 vector
float test_flags_recipdivf() {
27 return __builtin_ppc_recipdivf(a
, b
) + c
;
30 // CHECK-LABEL: @test_flags_recipdivd(
31 // CHECK: [[TMP0:%.*]] = load <2 x double>, ptr @d, align 16
32 // CHECK-NEXT: [[TMP1:%.*]] = load <2 x double>, ptr @e, align 16
33 // CHECK-NEXT: [[RECIPDIV:%.*]] = fdiv fast <2 x double> [[TMP0]], [[TMP1]]
34 // CHECK-NEXT: [[TMP2:%.*]] = load <2 x double>, ptr @f, align 16
35 // CHECK-NEXT: [[ADD:%.*]] = fadd <2 x double> [[RECIPDIV]], [[TMP2]]
36 // CHECK-NEXT: ret <2 x double> [[ADD]]
38 vector
double test_flags_recipdivd() {
39 return __builtin_ppc_recipdivd(d
, e
) + f
;
42 // CHECK-LABEL: @test_flags_rsqrtf(
43 // CHECK: [[TMP0:%.*]] = load <4 x float>, ptr @a, align 16
44 // CHECK-NEXT: [[TMP1:%.*]] = call fast <4 x float> @llvm.sqrt.v4f32(<4 x float> [[TMP0]])
45 // CHECK-NEXT: [[RSQRT:%.*]] = fdiv fast <4 x float> <float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 1.000000e+00>, [[TMP1]]
46 // CHECK-NEXT: [[TMP2:%.*]] = load <4 x float>, ptr @b, align 16
47 // CHECK-NEXT: [[ADD:%.*]] = fadd <4 x float> [[RSQRT]], [[TMP2]]
48 // CHECK-NEXT: ret <4 x float> [[ADD]]
50 vector
float test_flags_rsqrtf() {
51 return __builtin_ppc_rsqrtf(a
) + b
;
54 // CHECK-LABEL: @test_flags_rsqrtd(
55 // CHECK: [[TMP0:%.*]] = load <2 x double>, ptr @d, align 16
56 // CHECK-NEXT: [[TMP1:%.*]] = call fast <2 x double> @llvm.sqrt.v2f64(<2 x double> [[TMP0]])
57 // CHECK-NEXT: [[RSQRT:%.*]] = fdiv fast <2 x double> <double 1.000000e+00, double 1.000000e+00>, [[TMP1]]
58 // CHECK-NEXT: [[TMP2:%.*]] = load <2 x double>, ptr @e, align 16
59 // CHECK-NEXT: [[ADD:%.*]] = fadd <2 x double> [[RSQRT]], [[TMP2]]
60 // CHECK-NEXT: ret <2 x double> [[ADD]]
62 vector
double test_flags_rsqrtd() {
63 return __builtin_ppc_rsqrtd(d
) + e
;