@@ -183,3 +183,192 @@ void test_builtin_elementwise_log10(float f, double d, vfloat4 vf4,
183
183
// LLVM: {{%.*}} = call <4 x double> @llvm.log10.v4f64(<4 x double> {{%.*}})
184
184
vd4 = __builtin_elementwise_log10 (vd4 );
185
185
}
186
+
187
+ void test_builtin_elementwise_cos (float f , double d , vfloat4 vf4 ,
188
+ vdouble4 vd4 ) {
189
+ // CIR-LABEL: test_builtin_elementwise_cos
190
+ // LLVM-LABEL: test_builtin_elementwise_cos
191
+ // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.float
192
+ // LLVM: {{%.*}} = call float @llvm.cos.f32(float {{%.*}})
193
+ f = __builtin_elementwise_cos (f );
194
+
195
+ // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.double
196
+ // LLVM: {{%.*}} = call double @llvm.cos.f64(double {{%.*}})
197
+ d = __builtin_elementwise_cos (d );
198
+
199
+ // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.vector<!cir.float x 4>
200
+ // LLVM: {{%.*}} = call <4 x float> @llvm.cos.v4f32(<4 x float> {{%.*}})
201
+ vf4 = __builtin_elementwise_cos (vf4 );
202
+
203
+ // CIR: {{%.*}} = cir.cos {{%.*}} : !cir.vector<!cir.double x 4>
204
+ // LLVM: {{%.*}} = call <4 x double> @llvm.cos.v4f64(<4 x double> {{%.*}})
205
+ vd4 = __builtin_elementwise_cos (vd4 );
206
+ }
207
+
208
+ void test_builtin_elementwise_floor (float f , double d , vfloat4 vf4 ,
209
+ vdouble4 vd4 ) {
210
+ // CIR-LABEL: test_builtin_elementwise_floor
211
+ // LLVM-LABEL: test_builtin_elementwise_floor
212
+ // CIR: {{%.*}} = cir.floor {{%.*}} : !cir.float
213
+ // LLVM: {{%.*}} = call float @llvm.floor.f32(float {{%.*}})
214
+ f = __builtin_elementwise_floor (f );
215
+
216
+ // CIR: {{%.*}} = cir.floor {{%.*}} : !cir.double
217
+ // LLVM: {{%.*}} = call double @llvm.floor.f64(double {{%.*}})
218
+ d = __builtin_elementwise_floor (d );
219
+
220
+ // CIR: {{%.*}} = cir.floor {{%.*}} : !cir.vector<!cir.float x 4>
221
+ // LLVM: {{%.*}} = call <4 x float> @llvm.floor.v4f32(<4 x float> {{%.*}})
222
+ vf4 = __builtin_elementwise_floor (vf4 );
223
+
224
+ // CIR: {{%.*}} = cir.floor {{%.*}} : !cir.vector<!cir.double x 4>
225
+ // LLVM: {{%.*}} = call <4 x double> @llvm.floor.v4f64(<4 x double> {{%.*}})
226
+ vd4 = __builtin_elementwise_floor (vd4 );
227
+ }
228
+
229
+ void test_builtin_elementwise_round (float f , double d , vfloat4 vf4 ,
230
+ vdouble4 vd4 ) {
231
+ // CIR-LABEL: test_builtin_elementwise_round
232
+ // LLVM-LABEL: test_builtin_elementwise_round
233
+ // CIR: {{%.*}} = cir.round {{%.*}} : !cir.float
234
+ // LLVM: {{%.*}} = call float @llvm.round.f32(float {{%.*}})
235
+ f = __builtin_elementwise_round (f );
236
+
237
+ // CIR: {{%.*}} = cir.round {{%.*}} : !cir.double
238
+ // LLVM: {{%.*}} = call double @llvm.round.f64(double {{%.*}})
239
+ d = __builtin_elementwise_round (d );
240
+
241
+ // CIR: {{%.*}} = cir.round {{%.*}} : !cir.vector<!cir.float x 4>
242
+ // LLVM: {{%.*}} = call <4 x float> @llvm.round.v4f32(<4 x float> {{%.*}})
243
+ vf4 = __builtin_elementwise_round (vf4 );
244
+
245
+ // CIR: {{%.*}} = cir.round {{%.*}} : !cir.vector<!cir.double x 4>
246
+ // LLVM: {{%.*}} = call <4 x double> @llvm.round.v4f64(<4 x double> {{%.*}})
247
+ vd4 = __builtin_elementwise_round (vd4 );
248
+ }
249
+
250
+ void test_builtin_elementwise_rint (float f , double d , vfloat4 vf4 ,
251
+ vdouble4 vd4 ) {
252
+ // CIR-LABEL: test_builtin_elementwise_rint
253
+ // LLVM-LABEL: test_builtin_elementwise_rint
254
+ // CIR: {{%.*}} = cir.rint {{%.*}} : !cir.float
255
+ // LLVM: {{%.*}} = call float @llvm.rint.f32(float {{%.*}})
256
+ f = __builtin_elementwise_rint (f );
257
+
258
+ // CIR: {{%.*}} = cir.rint {{%.*}} : !cir.double
259
+ // LLVM: {{%.*}} = call double @llvm.rint.f64(double {{%.*}})
260
+ d = __builtin_elementwise_rint (d );
261
+
262
+ // CIR: {{%.*}} = cir.rint {{%.*}} : !cir.vector<!cir.float x 4>
263
+ // LLVM: {{%.*}} = call <4 x float> @llvm.rint.v4f32(<4 x float> {{%.*}})
264
+ vf4 = __builtin_elementwise_rint (vf4 );
265
+
266
+ // CIR: {{%.*}} = cir.rint {{%.*}} : !cir.vector<!cir.double x 4>
267
+ // LLVM: {{%.*}} = call <4 x double> @llvm.rint.v4f64(<4 x double> {{%.*}})
268
+ vd4 = __builtin_elementwise_rint (vd4 );
269
+ }
270
+
271
+ void test_builtin_elementwise_nearbyint (float f , double d , vfloat4 vf4 ,
272
+ vdouble4 vd4 ) {
273
+ // CIR-LABEL: test_builtin_elementwise_nearbyint
274
+ // LLVM-LABEL: test_builtin_elementwise_nearbyint
275
+ // CIR: {{%.*}} = cir.nearbyint {{%.*}} : !cir.float
276
+ // LLVM: {{%.*}} = call float @llvm.nearbyint.f32(float {{%.*}})
277
+ f = __builtin_elementwise_nearbyint (f );
278
+
279
+ // CIR: {{%.*}} = cir.nearbyint {{%.*}} : !cir.double
280
+ // LLVM: {{%.*}} = call double @llvm.nearbyint.f64(double {{%.*}})
281
+ d = __builtin_elementwise_nearbyint (d );
282
+
283
+ // CIR: {{%.*}} = cir.nearbyint {{%.*}} : !cir.vector<!cir.float x 4>
284
+ // LLVM: {{%.*}} = call <4 x float> @llvm.nearbyint.v4f32(<4 x float> {{%.*}})
285
+ vf4 = __builtin_elementwise_nearbyint (vf4 );
286
+
287
+ // CIR: {{%.*}} = cir.nearbyint {{%.*}} : !cir.vector<!cir.double x 4>
288
+ // LLVM: {{%.*}} = call <4 x double> @llvm.nearbyint.v4f64(<4 x double> {{%.*}})
289
+ vd4 = __builtin_elementwise_nearbyint (vd4 );
290
+ }
291
+
292
+ void test_builtin_elementwise_sin (float f , double d , vfloat4 vf4 ,
293
+ vdouble4 vd4 ) {
294
+ // CIR-LABEL: test_builtin_elementwise_sin
295
+ // LLVM-LABEL: test_builtin_elementwise_sin
296
+ // CIR: {{%.*}} = cir.sin {{%.*}} : !cir.float
297
+ // LLVM: {{%.*}} = call float @llvm.sin.f32(float {{%.*}})
298
+ f = __builtin_elementwise_sin (f );
299
+
300
+ // CIR: {{%.*}} = cir.sin {{%.*}} : !cir.double
301
+ // LLVM: {{%.*}} = call double @llvm.sin.f64(double {{%.*}})
302
+ d = __builtin_elementwise_sin (d );
303
+
304
+ // CIR: {{%.*}} = cir.sin {{%.*}} : !cir.vector<!cir.float x 4>
305
+ // LLVM: {{%.*}} = call <4 x float> @llvm.sin.v4f32(<4 x float> {{%.*}})
306
+ vf4 = __builtin_elementwise_sin (vf4 );
307
+
308
+ // CIR: {{%.*}} = cir.sin {{%.*}} : !cir.vector<!cir.double x 4>
309
+ // LLVM: {{%.*}} = call <4 x double> @llvm.sin.v4f64(<4 x double> {{%.*}})
310
+ vd4 = __builtin_elementwise_sin (vd4 );
311
+ }
312
+
313
+ void test_builtin_elementwise_sqrt (float f , double d , vfloat4 vf4 ,
314
+ vdouble4 vd4 ) {
315
+ // CIR-LABEL: test_builtin_elementwise_sqrt
316
+ // LLVM-LABEL: test_builtin_elementwise_sqrt
317
+ // CIR: {{%.*}} = cir.sqrt {{%.*}} : !cir.float
318
+ // LLVM: {{%.*}} = call float @llvm.sqrt.f32(float {{%.*}})
319
+ f = __builtin_elementwise_sqrt (f );
320
+
321
+ // CIR: {{%.*}} = cir.sqrt {{%.*}} : !cir.double
322
+ // LLVM: {{%.*}} = call double @llvm.sqrt.f64(double {{%.*}})
323
+ d = __builtin_elementwise_sqrt (d );
324
+
325
+ // CIR: {{%.*}} = cir.sqrt {{%.*}} : !cir.vector<!cir.float x 4>
326
+ // LLVM: {{%.*}} = call <4 x float> @llvm.sqrt.v4f32(<4 x float> {{%.*}})
327
+ vf4 = __builtin_elementwise_sqrt (vf4 );
328
+
329
+ // CIR: {{%.*}} = cir.sqrt {{%.*}} : !cir.vector<!cir.double x 4>
330
+ // LLVM: {{%.*}} = call <4 x double> @llvm.sqrt.v4f64(<4 x double> {{%.*}})
331
+ vd4 = __builtin_elementwise_sqrt (vd4 );
332
+ }
333
+
334
+ void test_builtin_elementwise_tan (float f , double d , vfloat4 vf4 ,
335
+ vdouble4 vd4 ) {
336
+ // CIR-LABEL: test_builtin_elementwise_tan
337
+ // LLVM-LABEL: test_builtin_elementwise_tan
338
+ // CIR: {{%.*}} = cir.tan {{%.*}} : !cir.float
339
+ // LLVM: {{%.*}} = call float @llvm.tan.f32(float {{%.*}})
340
+ f = __builtin_elementwise_tan (f );
341
+
342
+ // CIR: {{%.*}} = cir.tan {{%.*}} : !cir.double
343
+ // LLVM: {{%.*}} = call double @llvm.tan.f64(double {{%.*}})
344
+ d = __builtin_elementwise_tan (d );
345
+
346
+ // CIR: {{%.*}} = cir.tan {{%.*}} : !cir.vector<!cir.float x 4>
347
+ // LLVM: {{%.*}} = call <4 x float> @llvm.tan.v4f32(<4 x float> {{%.*}})
348
+ vf4 = __builtin_elementwise_tan (vf4 );
349
+
350
+ // CIR: {{%.*}} = cir.tan {{%.*}} : !cir.vector<!cir.double x 4>
351
+ // LLVM: {{%.*}} = call <4 x double> @llvm.tan.v4f64(<4 x double> {{%.*}})
352
+ vd4 = __builtin_elementwise_tan (vd4 );
353
+ }
354
+
355
+ void test_builtin_elementwise_trunc (float f , double d , vfloat4 vf4 ,
356
+ vdouble4 vd4 ) {
357
+ // CIR-LABEL: test_builtin_elementwise_trunc
358
+ // LLVM-LABEL: test_builtin_elementwise_trunc
359
+ // CIR: {{%.*}} = cir.trunc {{%.*}} : !cir.float
360
+ // LLVM: {{%.*}} = call float @llvm.trunc.f32(float {{%.*}})
361
+ f = __builtin_elementwise_trunc (f );
362
+
363
+ // CIR: {{%.*}} = cir.trunc {{%.*}} : !cir.double
364
+ // LLVM: {{%.*}} = call double @llvm.trunc.f64(double {{%.*}})
365
+ d = __builtin_elementwise_trunc (d );
366
+
367
+ // CIR: {{%.*}} = cir.trunc {{%.*}} : !cir.vector<!cir.float x 4>
368
+ // LLVM: {{%.*}} = call <4 x float> @llvm.trunc.v4f32(<4 x float> {{%.*}})
369
+ vf4 = __builtin_elementwise_trunc (vf4 );
370
+
371
+ // CIR: {{%.*}} = cir.trunc {{%.*}} : !cir.vector<!cir.double x 4>
372
+ // LLVM: {{%.*}} = call <4 x double> @llvm.trunc.v4f64(<4 x double> {{%.*}})
373
+ vd4 = __builtin_elementwise_trunc (vd4 );
374
+ }
0 commit comments