1; Test strict vector minimum on z14.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
4
5declare double @llvm.experimental.constrained.minnum.f64(double, double, metadata)
6declare <2 x double> @llvm.experimental.constrained.minnum.v2f64(<2 x double>, <2 x double>, metadata)
7declare double @llvm.experimental.constrained.minimum.f64(double, double, metadata)
8declare <2 x double> @llvm.experimental.constrained.minimum.v2f64(<2 x double>, <2 x double>, metadata)
9
10declare float @llvm.experimental.constrained.minnum.f32(float, float, metadata)
11declare <4 x float> @llvm.experimental.constrained.minnum.v4f32(<4 x float>, <4 x float>, metadata)
12declare float @llvm.experimental.constrained.minimum.f32(float, float, metadata)
13declare <4 x float> @llvm.experimental.constrained.minimum.v4f32(<4 x float>, <4 x float>, metadata)
14
15declare fp128 @llvm.experimental.constrained.minnum.f128(fp128, fp128, metadata)
16declare fp128 @llvm.experimental.constrained.minimum.f128(fp128, fp128, metadata)
17
18; Test the f64 minnum intrinsic.
19define double @f1(double %dummy, double %val1, double %val2) #0 {
20; CHECK-LABEL: f1:
21; CHECK: wfmindb %f0, %f2, %f4, 4
22; CHECK: br %r14
23  %ret = call double @llvm.experimental.constrained.minnum.f64(
24                        double %val1, double %val2,
25                        metadata !"fpexcept.strict") #0
26  ret double %ret
27}
28
29; Test the v2f64 minnum intrinsic.
30define <2 x double> @f2(<2 x double> %dummy, <2 x double> %val1,
31                        <2 x double> %val2) #0 {
32; CHECK-LABEL: f2:
33; CHECK: vfmindb %v24, %v26, %v28, 4
34; CHECK: br %r14
35  %ret = call <2 x double> @llvm.experimental.constrained.minnum.v2f64(
36                        <2 x double> %val1, <2 x double> %val2,
37                        metadata !"fpexcept.strict") #0
38  ret <2 x double> %ret
39}
40
41; Test the f32 minnum intrinsic.
42define float @f3(float %dummy, float %val1, float %val2) #0 {
43; CHECK-LABEL: f3:
44; CHECK: wfminsb %f0, %f2, %f4, 4
45; CHECK: br %r14
46  %ret = call float @llvm.experimental.constrained.minnum.f32(
47                        float %val1, float %val2,
48                        metadata !"fpexcept.strict") #0
49  ret float %ret
50}
51
52; Test the v4f32 minnum intrinsic.
53define <4 x float> @f4(<4 x float> %dummy, <4 x float> %val1,
54                       <4 x float> %val2) #0 {
55; CHECK-LABEL: f4:
56; CHECK: vfminsb %v24, %v26, %v28, 4
57; CHECK: br %r14
58  %ret = call <4 x float> @llvm.experimental.constrained.minnum.v4f32(
59                        <4 x float> %val1, <4 x float> %val2,
60                        metadata !"fpexcept.strict") #0
61  ret <4 x float> %ret
62}
63
64; Test the f128 minnum intrinsic.
65define void @f5(fp128 *%ptr1, fp128 *%ptr2, fp128 *%dst) #0 {
66; CHECK-LABEL: f5:
67; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
68; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
69; CHECK: wfminxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], 4
70; CHECK: vst [[RES]], 0(%r4)
71; CHECK: br %r14
72  %val1 = load fp128, fp128* %ptr1
73  %val2 = load fp128, fp128* %ptr2
74  %res = call fp128 @llvm.experimental.constrained.minnum.f128(
75                        fp128 %val1, fp128 %val2,
76                        metadata !"fpexcept.strict") #0
77  store fp128 %res, fp128* %dst
78  ret void
79}
80
81; Test the f64 minimum intrinsic.
82define double @f11(double %dummy, double %val1, double %val2) #0 {
83; CHECK-LABEL: f11:
84; CHECK: wfmindb %f0, %f2, %f4, 1
85; CHECK: br %r14
86  %ret = call double @llvm.experimental.constrained.minimum.f64(
87                        double %val1, double %val2,
88                        metadata !"fpexcept.strict") #0
89  ret double %ret
90}
91
92; Test the v2f64 minimum intrinsic.
93define <2 x double> @f12(<2 x double> %dummy, <2 x double> %val1,
94                         <2 x double> %val2) #0 {
95; CHECK-LABEL: f12:
96; CHECK: vfmindb %v24, %v26, %v28, 1
97; CHECK: br %r14
98  %ret = call <2 x double> @llvm.experimental.constrained.minimum.v2f64(
99                        <2 x double> %val1, <2 x double> %val2,
100                        metadata !"fpexcept.strict") #0
101  ret <2 x double> %ret
102}
103
104; Test the f32 minimum intrinsic.
105define float @f13(float %dummy, float %val1, float %val2) #0 {
106; CHECK-LABEL: f13:
107; CHECK: wfminsb %f0, %f2, %f4, 1
108; CHECK: br %r14
109  %ret = call float @llvm.experimental.constrained.minimum.f32(
110                        float %val1, float %val2,
111                        metadata !"fpexcept.strict") #0
112  ret float %ret
113}
114
115; Test the v4f32 minimum intrinsic.
116define <4 x float> @f14(<4 x float> %dummy, <4 x float> %val1,
117                        <4 x float> %val2) #0 {
118; CHECK-LABEL: f14:
119; CHECK: vfminsb %v24, %v26, %v28, 1
120; CHECK: br %r14
121  %ret = call <4 x float> @llvm.experimental.constrained.minimum.v4f32(
122                        <4 x float> %val1, <4 x float> %val2,
123                        metadata !"fpexcept.strict") #0
124  ret <4 x float> %ret
125}
126
127; Test the f128 minimum intrinsic.
128define void @f15(fp128 *%ptr1, fp128 *%ptr2, fp128 *%dst) #0 {
129; CHECK-LABEL: f15:
130; CHECK-DAG: vl [[REG1:%v[0-9]+]], 0(%r2)
131; CHECK-DAG: vl [[REG2:%v[0-9]+]], 0(%r3)
132; CHECK: wfminxb [[RES:%v[0-9]+]], [[REG1]], [[REG2]], 1
133; CHECK: vst [[RES]], 0(%r4)
134; CHECK: br %r14
135  %val1 = load fp128, fp128* %ptr1
136  %val2 = load fp128, fp128* %ptr2
137  %res = call fp128 @llvm.experimental.constrained.minimum.f128(
138                        fp128 %val1, fp128 %val2,
139                        metadata !"fpexcept.strict") #0
140  store fp128 %res, fp128* %dst
141  ret void
142}
143
144attributes #0 = { strictfp }
145