1 // REQUIRES: systemz-registered-target
2 // RUN: %clang_cc1 -target-cpu z14 -triple s390x-ibm-linux -flax-vector-conversions=none \
3 // RUN: -ffp-exception-behavior=strict -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
4
5 typedef __attribute__((vector_size(16))) double vec_double;
6 typedef __attribute__((vector_size(16))) float vec_float;
7
8 volatile vec_double vd;
9 volatile vec_float vf;
10
test_float(void)11 void test_float(void) {
12 vd = __builtin_s390_vfmaxdb(vd, vd, 4);
13 // CHECK: call <2 x double> @llvm.experimental.constrained.maxnum.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}})
14
15 vd = __builtin_s390_vfmindb(vd, vd, 4);
16 // CHECK: call <2 x double> @llvm.experimental.constrained.minnum.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}})
17 vd = __builtin_s390_vfmindb(vd, vd, 0);
18
19 vd = __builtin_s390_vfnmadb(vd, vd, vd);
20 // CHECK: [[RES:%[^ ]+]] = call <2 x double> @llvm.experimental.constrained.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> %{{.*}})
21 // CHECK: fneg <2 x double> [[RES]]
22
23 vd = __builtin_s390_vfnmsdb(vd, vd, vd);
24 // CHECK: [[NEG:%[^ ]+]] = fneg <2 x double> {{.*}}
25 // CHECK: [[RES:%[^ ]+]] = call <2 x double> @llvm.experimental.constrained.fma.v2f64(<2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x double> [[NEG]], metadata !{{.*}})
26 // CHECK: fneg <2 x double> [[RES]]
27
28 vf = __builtin_s390_vfmaxsb(vf, vf, 4);
29 // CHECK: call <4 x float> @llvm.experimental.constrained.maxnum.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, metadata !{{.*}})
30
31 vf = __builtin_s390_vfminsb(vf, vf, 4);
32 // CHECK: call <4 x float> @llvm.experimental.constrained.minnum.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, metadata !{{.*}})
33
34 vf = __builtin_s390_vfsqsb(vf);
35 // CHECK: call <4 x float> @llvm.experimental.constrained.sqrt.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
36
37 vf = __builtin_s390_vfmasb(vf, vf, vf);
38 // CHECK: call <4 x float> @llvm.experimental.constrained.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}, metadata !{{.*}})
39 vf = __builtin_s390_vfmssb(vf, vf, vf);
40 // CHECK: [[NEG:%[^ ]+]] = fneg <4 x float> %{{.*}}
41 // CHECK: call <4 x float> @llvm.experimental.constrained.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]], metadata !{{.*}})
42 vf = __builtin_s390_vfnmasb(vf, vf, vf);
43 // CHECK: [[RES:%[^ ]+]] = call <4 x float> @llvm.experimental.constrained.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}, metadata !{{.*}})
44 // CHECK: fneg <4 x float> [[RES]]
45 vf = __builtin_s390_vfnmssb(vf, vf, vf);
46 // CHECK: [[NEG:%[^ ]+]] = fneg <4 x float> %{{.*}}
47 // CHECK: [[RES:%[^ ]+]] = call <4 x float> @llvm.experimental.constrained.fma.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> [[NEG]], metadata !{{.*}})
48 // CHECK: fneg <4 x float> [[RES]]
49
50 vf = __builtin_s390_vflpsb(vf);
51 // CHECK: call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}})
52 vf = __builtin_s390_vflnsb(vf);
53 // CHECK: [[ABS:%[^ ]+]] = call <4 x float> @llvm.fabs.v4f32(<4 x float> %{{.*}})
54 // CHECK: fneg <4 x float> [[ABS]]
55
56 vf = __builtin_s390_vfisb(vf, 0, 0);
57 // CHECK: call <4 x float> @llvm.experimental.constrained.rint.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
58 vf = __builtin_s390_vfisb(vf, 4, 0);
59 // CHECK: call <4 x float> @llvm.experimental.constrained.nearbyint.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
60 vf = __builtin_s390_vfisb(vf, 4, 1);
61 // CHECK: call <4 x float> @llvm.experimental.constrained.round.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
62 vf = __builtin_s390_vfisb(vf, 4, 5);
63 // CHECK: call <4 x float> @llvm.experimental.constrained.trunc.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
64 vf = __builtin_s390_vfisb(vf, 4, 6);
65 // CHECK: call <4 x float> @llvm.experimental.constrained.ceil.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
66 vf = __builtin_s390_vfisb(vf, 4, 7);
67 // CHECK: call <4 x float> @llvm.experimental.constrained.floor.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
68 }
69
70