1; Test strict v2f64 rounding.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5declare double @llvm.experimental.constrained.rint.f64(double, metadata, metadata)
6declare double @llvm.experimental.constrained.nearbyint.f64(double, metadata, metadata)
7declare double @llvm.experimental.constrained.floor.f64(double, metadata)
8declare double @llvm.experimental.constrained.ceil.f64(double, metadata)
9declare double @llvm.experimental.constrained.trunc.f64(double, metadata)
10declare double @llvm.experimental.constrained.round.f64(double, metadata)
11declare <2 x double> @llvm.experimental.constrained.rint.v2f64(<2 x double>, metadata, metadata)
12declare <2 x double> @llvm.experimental.constrained.nearbyint.v2f64(<2 x double>, metadata, metadata)
13declare <2 x double> @llvm.experimental.constrained.floor.v2f64(<2 x double>, metadata)
14declare <2 x double> @llvm.experimental.constrained.ceil.v2f64(<2 x double>, metadata)
15declare <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double>, metadata)
16declare <2 x double> @llvm.experimental.constrained.round.v2f64(<2 x double>, metadata)
17
18define <2 x double> @f1(<2 x double> %val) #0 {
19; CHECK-LABEL: f1:
20; CHECK: vfidb %v24, %v24, 0, 0
21; CHECK: br %r14
22  %res = call <2 x double> @llvm.experimental.constrained.rint.v2f64(
23                        <2 x double> %val,
24                        metadata !"round.dynamic",
25                        metadata !"fpexcept.strict") #0
26  ret <2 x double> %res
27}
28
29define <2 x double> @f2(<2 x double> %val) #0 {
30; CHECK-LABEL: f2:
31; CHECK: vfidb %v24, %v24, 4, 0
32; CHECK: br %r14
33  %res = call <2 x double> @llvm.experimental.constrained.nearbyint.v2f64(
34                        <2 x double> %val,
35                        metadata !"round.dynamic",
36                        metadata !"fpexcept.strict") #0
37  ret <2 x double> %res
38}
39
40define <2 x double> @f3(<2 x double> %val) #0 {
41; CHECK-LABEL: f3:
42; CHECK: vfidb %v24, %v24, 4, 7
43; CHECK: br %r14
44  %res = call <2 x double> @llvm.experimental.constrained.floor.v2f64(
45                        <2 x double> %val,
46                        metadata !"fpexcept.strict") #0
47  ret <2 x double> %res
48}
49
50define <2 x double> @f4(<2 x double> %val) #0 {
51; CHECK-LABEL: f4:
52; CHECK: vfidb %v24, %v24, 4, 6
53; CHECK: br %r14
54  %res = call <2 x double> @llvm.experimental.constrained.ceil.v2f64(
55                        <2 x double> %val,
56                        metadata !"fpexcept.strict") #0
57  ret <2 x double> %res
58}
59
60define <2 x double> @f5(<2 x double> %val) #0 {
61; CHECK-LABEL: f5:
62; CHECK: vfidb %v24, %v24, 4, 5
63; CHECK: br %r14
64  %res = call <2 x double> @llvm.experimental.constrained.trunc.v2f64(
65                        <2 x double> %val,
66                        metadata !"fpexcept.strict") #0
67  ret <2 x double> %res
68}
69
70define <2 x double> @f6(<2 x double> %val) #0 {
71; CHECK-LABEL: f6:
72; CHECK: vfidb %v24, %v24, 4, 1
73; CHECK: br %r14
74  %res = call <2 x double> @llvm.experimental.constrained.round.v2f64(
75                        <2 x double> %val,
76                        metadata !"fpexcept.strict") #0
77  ret <2 x double> %res
78}
79
80define double @f7(<2 x double> %val) #0 {
81; CHECK-LABEL: f7:
82; CHECK: wfidb %f0, %v24, 0, 0
83; CHECK: br %r14
84  %scalar = extractelement <2 x double> %val, i32 0
85  %res = call double @llvm.experimental.constrained.rint.f64(
86                        double %scalar,
87                        metadata !"round.dynamic",
88                        metadata !"fpexcept.strict") #0
89  ret double %res
90}
91
92define double @f8(<2 x double> %val) #0 {
93; CHECK-LABEL: f8:
94; CHECK: wfidb %f0, %v24, 4, 0
95; CHECK: br %r14
96  %scalar = extractelement <2 x double> %val, i32 0
97  %res = call double @llvm.experimental.constrained.nearbyint.f64(
98                        double %scalar,
99                        metadata !"round.dynamic",
100                        metadata !"fpexcept.strict") #0
101  ret double %res
102}
103
104define double @f9(<2 x double> %val) #0 {
105; CHECK-LABEL: f9:
106; CHECK: wfidb %f0, %v24, 4, 7
107; CHECK: br %r14
108  %scalar = extractelement <2 x double> %val, i32 0
109  %res = call double @llvm.experimental.constrained.floor.f64(
110                        double %scalar,
111                        metadata !"fpexcept.strict") #0
112  ret double %res
113}
114
115
116define double @f10(<2 x double> %val) #0 {
117; CHECK-LABEL: f10:
118; CHECK: wfidb %f0, %v24, 4, 6
119; CHECK: br %r14
120  %scalar = extractelement <2 x double> %val, i32 0
121  %res = call double @llvm.experimental.constrained.ceil.f64(
122                        double %scalar,
123                        metadata !"fpexcept.strict") #0
124  ret double %res
125}
126
127define double @f11(<2 x double> %val) #0 {
128; CHECK-LABEL: f11:
129; CHECK: wfidb %f0, %v24, 4, 5
130; CHECK: br %r14
131  %scalar = extractelement <2 x double> %val, i32 0
132  %res = call double @llvm.experimental.constrained.trunc.f64(
133                        double %scalar,
134                        metadata !"fpexcept.strict") #0
135  ret double %res
136}
137
138define double @f12(<2 x double> %val) #0 {
139; CHECK-LABEL: f12:
140; CHECK: wfidb %f0, %v24, 4, 1
141; CHECK: br %r14
142  %scalar = extractelement <2 x double> %val, i32 0
143  %res = call double @llvm.experimental.constrained.round.f64(
144                        double %scalar,
145                        metadata !"fpexcept.strict") #0
146  ret double %res
147}
148
149attributes #0 = { strictfp }
150