Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / lower-mass-end-to-end.c
blob41a65900d4d2365903857df412b80079b7426fa9
1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass -O3 -fapprox-func --target=powerpc64le-unknown-linux-gnu -S %s -o -| FileCheck %s -check-prefix=CHECK-MASS-AFN
3 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass -Ofast --target=powerpc64le-unknown-linux-gnu -S %s -o -| FileCheck %s -check-prefix=CHECK-MASS-FAST
4 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass -O3 -fapprox-func --target=powerpc-ibm-aix-xcoff -S %s -o -| FileCheck %s -check-prefix=CHECK-MASS-AFN
5 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass -Ofast --target=powerpc-ibm-aix-xcoff -S %s -o -| FileCheck %s -check-prefix=CHECK-MASS-FAST
7 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass=false -O3 -fapprox-func --target=powerpc64le-unknown-linux-gnu -S %s -o -| FileCheck %s -check-prefix=CHECK-NO-MASS-AFN
8 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass=false -Ofast --target=powerpc64le-unknown-linux-gnu -S %s -o -| FileCheck %s -check-prefix=CHECK-NO-MASS-FAST
9 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass=false -O3 -fapprox-func --target=powerpc-ibm-aix-xcoff -S %s -o -| FileCheck %s -check-prefix=CHECK-NO-MASS-AFN
10 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass=false -Ofast --target=powerpc-ibm-aix-xcoff -S %s -o -| FileCheck %s -check-prefix=CHECK-NO-MASS-FAST
12 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass -O3 -fno-approx-func --target=powerpc64le-unknown-linux-gnu -S %s -o -| FileCheck %s -check-prefix=CHECK-NO-MASS-AFN
13 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass -fno-fast-math --target=powerpc64le-unknown-linux-gnu -S %s -o -| FileCheck %s -check-prefix=CHECK-NO-MASS-FAST
14 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass -O3 -fno-approx-func --target=powerpc-ibm-aix-xcoff -S %s -o -| FileCheck %s -check-prefix=CHECK-NO-MASS-AFN
15 // RUN: %clang -mllvm -enable-ppc-gen-scalar-mass -fno-fast-math --target=powerpc-ibm-aix-xcoff -S %s -o -| FileCheck %s -check-prefix=CHECK-NO-MASS-FAST
17 extern double sin(double a);
18 extern double cos(double a);
19 extern double pow(double a, double b);
20 extern double log(double a);
21 extern double log10(double a);
22 extern double exp(double a);
23 extern float sinf(float a);
24 extern float cosf(float a);
25 extern float powf(float a, float b);
26 extern float logf(float a);
27 extern float log10f(float a);
28 extern float expf(float a);
30 double sin_f64(double a) {
31 // CHECK-LABEL: sin_f64
32 // CHECK-MASS-FAST: __xl_sin_finite
33 // CHECK-MASS-AFN: __xl_sin
34 // CHECK-NO-MASS-FAST-NOT: {{__xl_sin|__xl_sin_finite}}
35 // CHECK-NO-MASS-AFN-NOT: {{__xl_sin|__xl_sin_finite}}
36 // CHECK: blr
37 return sin(a);
40 double cos_f64(double a) {
41 // CHECK-LABEL: cos_f64
42 // CHECK-MASS-FAST: __xl_cos_finite
43 // CHECK-MASS-AFN: __xl_cos
44 // CHECK-NO-MASS-FAST-NOT: {{__xl_cos|__xl_cos_finite}}
45 // CHECK-NO-MASS-AFN-NOT: {{__xl_cos|__xl_cos_finite}}
46 // CHECK: blr
47 return cos(a);
50 double pow_f64(double a, double b) {
51 // CHECK-LABEL: pow_f64
52 // CHECK-MASS-FAST: __xl_pow_finite
53 // CHECK-MASS-AFN: __xl_pow
54 // CHECK-NO-MASS-FAST-NOT: {{__xl_pow|__xl_pow_finite}}
55 // CHECK-NO-MASS-AFN-NOT: {{__xl_pow|__xl_pow_finite}}
56 // CHECK: blr
57 return pow(a, b);
60 double log_f64(double a) {
61 // CHECK-LABEL: log_f64
62 // CHECK-MASS-FAST: __xl_log_finite
63 // CHECK-MASS-AFN: __xl_log
64 // CHECK-NO-MASS-FAST-NOT: {{__xl_log|__xl_log_finite}}
65 // CHECK-NO-MASS-AFN-NOT: {{__xl_log|__xl_log_finite}}
66 // CHECK: blr
67 return log(a);
70 double log10_f64(double a) {
71 // CHECK-LABEL: log10_f64
72 // CHECK-MASS-FAST: __xl_log10_finite
73 // CHECK-MASS-AFN: __xl_log10
74 // CHECK-NO-MASS-FAST-NOT: {{__xl_log10|__xl_log10_finite}}
75 // CHECK-NO-MASS-AFN-NOT: {{__xl_log10|__xl_log10_finite}}
76 // CHECK: blr
77 return log10(a);
80 double exp_f64(double a) {
81 // CHECK-LABEL: exp_f64
82 // CHECK-MASS-FAST: __xl_exp_finite
83 // CHECK-MASS-AFN: __xl_exp
84 // CHECK-NO-MASS-FAST-NOT: {{__xl_exp|__xl_exp_finite}}
85 // CHECK-NO-MASS-AFN-NOT: {{__xl_exp|__xl_exp_finite}}
86 // CHECK: blr
87 return exp(a);
90 float sin_f32(float a) {
91 // CHECK-LABEL: sin_f32
92 // CHECK-MASS-FAST: __xl_sinf_finite
93 // CHECK-MASS-AFN: __xl_sinf
94 // CHECK-NO-MASS-FAST-NOT: {{__xl_sinf|__xl_sinf_finite}}
95 // CHECK-NO-MASS-AFN-NOT: {{__xl_sinf|__xl_sinf_finite}}
96 // CHECK: blr
97 return sinf(a);
100 float cos_f32(float a) {
101 // CHECK-LABEL: cos_f32
102 // CHECK-MASS-FAST: __xl_cosf_finite
103 // CHECK-MASS-AFN: __xl_cosf
104 // CHECK-NO-MASS-FAST-NOT: {{__xl_cosf|__xl_cosf_finite}}
105 // CHECK-NO-MASS-AFN-NOT: {{__xl_cosf|__xl_cosf_finite}}
106 // CHECK: blr
107 return cosf(a);
110 float pow_f32(float a, float b) {
111 // CHECK-LABEL: pow_f32
112 // CHECK-MASS-FAST: __xl_powf_finite
113 // CHECK-MASS-AFN: __xl_powf
114 // CHECK-NO-MASS-FAST-NOT: {{__xl_pow|__xl_powf_finite}}
115 // CHECK-NO-MASS-AFN-NOT: {{__xl_pow|__xl_powf_finite}}
116 // CHECK: blr
117 return powf(a, b);
120 float log_f32(float a) {
121 // CHECK-LABEL: log_f32
122 // CHECK-MASS-FAST: __xl_logf_finite
123 // CHECK-MASS-AFN: __xl_logf
124 // CHECK-NO-MASS-FAST-NOT: {{__xl_logf|__xl_logf_finite}}
125 // CHECK-NO-MASS-AFN-NOT: {{__xl_logf|__xl_logf_finite}}
126 // CHECK: blr
127 return logf(a);
130 float log10_f32(float a) {
131 // CHECK-LABEL: log10_f32
132 // CHECK-MASS-FAST: __xl_log10f_finite
133 // CHECK-MASS-AFN: __xl_log10f
134 // CHECK-NO-MASS-FAST-NOT: {{__xl_log10f|__xl_log10f_finite}}
135 // CHECK-NO-MASS-AFN-NOT: {{__xl_log10f|__xl_log10f_finite}}
136 // CHECK: blr
137 return log10f(a);
140 float exp_f32(float a) {
141 // CHECK-LABEL: exp_f32
142 // CHECK-MASS-FAST: __xl_expf_finite
143 // CHECK-MASS-AFN: __xl_expf
144 // CHECK-NO-MASS-FAST-NOT: {{__xl_expf|__xl_expf_finite}}
145 // CHECK-NO-MASS-AFN-NOT: {{__xl_expf|__xl_expf_finite}}
146 // CHECK: blr
147 return expf(a);