1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu \
3 // RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
4 // RUN: %clang_cc1 -triple powerpc64-unknown-aix \
5 // RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
6 // RUN: %clang_cc1 -triple powerpc-unknown-aix \
7 // RUN: -emit-llvm %s -o - -target-cpu pwr7 | FileCheck %s
16 // CHECK-LABEL: @test_fric(
17 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
18 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.rint.f64(double [[TMP0]])
19 // CHECK-NEXT: ret double [[TMP1]]
25 // CHECK-LABEL: @test_frim(
26 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
27 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.floor.f64(double [[TMP0]])
28 // CHECK-NEXT: ret double [[TMP1]]
34 // CHECK-LABEL: @test_frims(
35 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
36 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[TMP0]])
37 // CHECK-NEXT: ret float [[TMP1]]
43 // CHECK-LABEL: @test_frin(
44 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
45 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.round.f64(double [[TMP0]])
46 // CHECK-NEXT: ret double [[TMP1]]
52 // CHECK-LABEL: @test_frins(
53 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
54 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[TMP0]])
55 // CHECK-NEXT: ret float [[TMP1]]
61 // CHECK-LABEL: @test_frip(
62 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
63 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.ceil.f64(double [[TMP0]])
64 // CHECK-NEXT: ret double [[TMP1]]
70 // CHECK-LABEL: @test_frips(
71 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
72 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[TMP0]])
73 // CHECK-NEXT: ret float [[TMP1]]
79 // CHECK-LABEL: @test_friz(
80 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
81 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.trunc.f64(double [[TMP0]])
82 // CHECK-NEXT: ret double [[TMP1]]
88 // CHECK-LABEL: @test_frizs(
89 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
90 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[TMP0]])
91 // CHECK-NEXT: ret float [[TMP1]]
97 // CHECK-LABEL: @test_fsel(
98 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
99 // CHECK-NEXT: [[TMP1:%.*]] = load double, ptr @b, align 8
100 // CHECK-NEXT: [[TMP2:%.*]] = load double, ptr @c, align 8
101 // CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.ppc.fsel(double [[TMP0]], double [[TMP1]], double [[TMP2]])
102 // CHECK-NEXT: ret double [[TMP3]]
105 return __fsel(a
, b
, c
);
108 // CHECK-LABEL: @test_fsels(
109 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
110 // CHECK-NEXT: [[TMP1:%.*]] = load float, ptr @e, align 4
111 // CHECK-NEXT: [[TMP2:%.*]] = load float, ptr @f, align 4
112 // CHECK-NEXT: [[TMP3:%.*]] = call float @llvm.ppc.fsels(float [[TMP0]], float [[TMP1]], float [[TMP2]])
113 // CHECK-NEXT: ret float [[TMP3]]
116 return __fsels(d
, e
, f
);
119 // CHECK-LABEL: @test_frsqrte(
120 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
121 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.ppc.frsqrte(double [[TMP0]])
122 // CHECK-NEXT: ret double [[TMP1]]
124 double test_frsqrte() {
128 // CHECK-LABEL: @test_frsqrtes(
129 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
130 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ppc.frsqrtes(float [[TMP0]])
131 // CHECK-NEXT: ret float [[TMP1]]
133 float test_frsqrtes() {
134 return __frsqrtes(d
);
137 // CHECK-LABEL: @test_fsqrt(
138 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
139 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.sqrt.f64(double [[TMP0]])
140 // CHECK-NEXT: ret double [[TMP1]]
142 double test_fsqrt() {
146 // CHECK-LABEL: @test_fsqrts(
147 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
148 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.sqrt.f32(float [[TMP0]])
149 // CHECK-NEXT: ret float [[TMP1]]
151 float test_fsqrts() {
155 // CHECK-LABEL: @test_builtin_ppc_fric(
156 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
157 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.rint.f64(double [[TMP0]])
158 // CHECK-NEXT: ret double [[TMP1]]
160 double test_builtin_ppc_fric() {
161 return __builtin_ppc_fric(a
);
164 // CHECK-LABEL: @test_builtin_ppc_frim(
165 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
166 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.floor.f64(double [[TMP0]])
167 // CHECK-NEXT: ret double [[TMP1]]
169 double test_builtin_ppc_frim() {
170 return __builtin_ppc_frim(a
);
173 // CHECK-LABEL: @test_builtin_ppc_frims(
174 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
175 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[TMP0]])
176 // CHECK-NEXT: ret float [[TMP1]]
178 float test_builtin_ppc_frims() {
179 return __builtin_ppc_frims(d
);
182 // CHECK-LABEL: @test_builtin_ppc_frin(
183 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
184 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.round.f64(double [[TMP0]])
185 // CHECK-NEXT: ret double [[TMP1]]
187 double test_builtin_ppc_frin() {
188 return __builtin_ppc_frin(a
);
191 // CHECK-LABEL: @test_builtin_ppc_frins(
192 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
193 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[TMP0]])
194 // CHECK-NEXT: ret float [[TMP1]]
196 float test_builtin_ppc_frins() {
197 return __builtin_ppc_frins(d
);
200 // CHECK-LABEL: @test_builtin_ppc_frip(
201 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
202 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.ceil.f64(double [[TMP0]])
203 // CHECK-NEXT: ret double [[TMP1]]
205 double test_builtin_ppc_frip() {
206 return __builtin_ppc_frip(a
);
209 // CHECK-LABEL: @test_builtin_ppc_frips(
210 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
211 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[TMP0]])
212 // CHECK-NEXT: ret float [[TMP1]]
214 float test_builtin_ppc_frips() {
215 return __builtin_ppc_frips(d
);
218 // CHECK-LABEL: @test_builtin_ppc_friz(
219 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
220 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.trunc.f64(double [[TMP0]])
221 // CHECK-NEXT: ret double [[TMP1]]
223 double test_builtin_ppc_friz() {
224 return __builtin_ppc_friz(a
);
227 // CHECK-LABEL: @test_builtin_ppc_frizs(
228 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
229 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[TMP0]])
230 // CHECK-NEXT: ret float [[TMP1]]
232 float test_builtin_ppc_frizs() {
233 return __builtin_ppc_frizs(d
);
236 // CHECK-LABEL: @test_builtin_ppc_fsel(
237 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
238 // CHECK-NEXT: [[TMP1:%.*]] = load double, ptr @b, align 8
239 // CHECK-NEXT: [[TMP2:%.*]] = load double, ptr @c, align 8
240 // CHECK-NEXT: [[TMP3:%.*]] = call double @llvm.ppc.fsel(double [[TMP0]], double [[TMP1]], double [[TMP2]])
241 // CHECK-NEXT: ret double [[TMP3]]
243 double test_builtin_ppc_fsel() {
244 return __builtin_ppc_fsel(a
, b
, c
);
247 // CHECK-LABEL: @test_builtin_ppc_fsels(
248 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
249 // CHECK-NEXT: [[TMP1:%.*]] = load float, ptr @e, align 4
250 // CHECK-NEXT: [[TMP2:%.*]] = load float, ptr @f, align 4
251 // CHECK-NEXT: [[TMP3:%.*]] = call float @llvm.ppc.fsels(float [[TMP0]], float [[TMP1]], float [[TMP2]])
252 // CHECK-NEXT: ret float [[TMP3]]
254 float test_builtin_ppc_fsels() {
255 return __builtin_ppc_fsels(d
, e
, f
);
258 // CHECK-LABEL: @test_builtin_ppc_frsqrte(
259 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
260 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.ppc.frsqrte(double [[TMP0]])
261 // CHECK-NEXT: ret double [[TMP1]]
263 double test_builtin_ppc_frsqrte() {
264 return __builtin_ppc_frsqrte(a
);
267 // CHECK-LABEL: @test_builtin_ppc_frsqrtes(
268 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
269 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ppc.frsqrtes(float [[TMP0]])
270 // CHECK-NEXT: ret float [[TMP1]]
272 float test_builtin_ppc_frsqrtes() {
273 return __builtin_ppc_frsqrtes(d
);
276 // CHECK-LABEL: @test_builtin_ppc_fsqrt(
277 // CHECK: [[TMP0:%.*]] = load double, ptr @a, align 8
278 // CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.sqrt.f64(double [[TMP0]])
279 // CHECK-NEXT: ret double [[TMP1]]
281 double test_builtin_ppc_fsqrt() {
282 return __builtin_ppc_fsqrt(a
);
285 // CHECK-LABEL: @test_builtin_ppc_fsqrts(
286 // CHECK: [[TMP0:%.*]] = load float, ptr @d, align 4
287 // CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.sqrt.f32(float [[TMP0]])
288 // CHECK-NEXT: ret float [[TMP1]]
290 float test_builtin_ppc_fsqrts() {
291 return __builtin_ppc_fsqrts(d
);