1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
4 declare float @llvm.sqrt.f32(float)
5 declare <2 x float> @llvm.sqrt.v2f32(<2 x float>)
6 declare float @llvm.experimental.constrained.sqrt.f32(float, metadata, metadata)
8 define float @ret_sqrt(float %arg0) #0 {
9 ; CHECK-LABEL: define nofpclass(ninf nsub nnorm) float @ret_sqrt
10 ; CHECK-SAME: (float nofpclass(ninf nsub nnorm) [[ARG0:%.*]]) #[[ATTR2:[0-9]+]] {
11 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10:[0-9]+]]
12 ; CHECK-NEXT: ret float [[CALL]]
14 %call = call float @llvm.sqrt.f32(float %arg0)
18 define float @ret_sqrt_noinf(float nofpclass(inf) %arg0) #0 {
19 ; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_noinf
20 ; CHECK-SAME: (float nofpclass(inf nsub nnorm) [[ARG0:%.*]]) #[[ATTR2]] {
21 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
22 ; CHECK-NEXT: ret float [[CALL]]
24 %call = call float @llvm.sqrt.f32(float %arg0)
28 define float @ret_sqrt_nopinf(float nofpclass(pinf) %arg0) #0 {
29 ; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_nopinf
30 ; CHECK-SAME: (float nofpclass(inf nsub nnorm) [[ARG0:%.*]]) #[[ATTR2]] {
31 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
32 ; CHECK-NEXT: ret float [[CALL]]
34 %call = call float @llvm.sqrt.f32(float %arg0)
38 define float @ret_sqrt_noninf(float nofpclass(ninf) %arg0) #0 {
39 ; CHECK-LABEL: define nofpclass(ninf nsub nnorm) float @ret_sqrt_noninf
40 ; CHECK-SAME: (float nofpclass(ninf nsub nnorm) [[ARG0:%.*]]) #[[ATTR2]] {
41 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
42 ; CHECK-NEXT: ret float [[CALL]]
44 %call = call float @llvm.sqrt.f32(float %arg0)
48 define float @ret_sqrt_nonan(float nofpclass(nan) %arg0) #0 {
49 ; CHECK-LABEL: define nofpclass(snan ninf nsub nnorm) float @ret_sqrt_nonan
50 ; CHECK-SAME: (float nofpclass(nan ninf nsub nnorm) [[ARG0:%.*]]) #[[ATTR2]] {
51 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan ninf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
52 ; CHECK-NEXT: ret float [[CALL]]
54 %call = call float @llvm.sqrt.f32(float %arg0)
58 define float @ret_sqrt_nonan_noinf(float nofpclass(nan inf) %arg0) #0 {
59 ; CHECK-LABEL: define nofpclass(snan inf nsub nnorm) float @ret_sqrt_nonan_noinf
60 ; CHECK-SAME: (float nofpclass(nan inf nsub nnorm) [[ARG0:%.*]]) #[[ATTR2]] {
61 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
62 ; CHECK-NEXT: ret float [[CALL]]
64 %call = call float @llvm.sqrt.f32(float %arg0)
68 define float @ret_sqrt_nonan_noinf_nozero(float nofpclass(nan inf zero) %arg0) #0 {
69 ; CHECK-LABEL: define nofpclass(snan inf nzero nsub nnorm) float @ret_sqrt_nonan_noinf_nozero
70 ; CHECK-SAME: (float nofpclass(nan inf zero nsub nnorm) [[ARG0:%.*]]) #[[ATTR2]] {
71 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
72 ; CHECK-NEXT: ret float [[CALL]]
74 %call = call float @llvm.sqrt.f32(float %arg0)
78 define float @ret_sqrt_noinf_nozero(float nofpclass(inf zero) %arg0) #0 {
79 ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_noinf_nozero
80 ; CHECK-SAME: (float nofpclass(inf zero nsub nnorm) [[ARG0:%.*]]) #[[ATTR2]] {
81 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
82 ; CHECK-NEXT: ret float [[CALL]]
84 %call = call float @llvm.sqrt.f32(float %arg0)
88 define float @ret_sqrt_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #0 {
89 ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_noinf_nonegzero
90 ; CHECK-SAME: (float nofpclass(inf nzero nsub nnorm) [[ARG0:%.*]]) #[[ATTR2]] {
91 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
92 ; CHECK-NEXT: ret float [[CALL]]
94 %call = call float @llvm.sqrt.f32(float %arg0)
98 define float @ret_sqrt_positive_source(i32 %arg) #0 {
99 ; CHECK-LABEL: define nofpclass(nan inf nzero nsub nnorm) float @ret_sqrt_positive_source
100 ; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
101 ; CHECK-NEXT: [[UITOFP:%.*]] = uitofp i32 [[ARG]] to float
102 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[UITOFP]]) #[[ATTR10]]
103 ; CHECK-NEXT: ret float [[CALL]]
105 %uitofp = uitofp i32 %arg to float
106 %call = call float @llvm.sqrt.f32(float %uitofp)
110 ; Could produce a nan because we don't know if the multiply is negative.
111 define float @ret_sqrt_unknown_sign(float nofpclass(nan) %arg0, float nofpclass(nan) %arg1) #0 {
112 ; CHECK-LABEL: define nofpclass(snan ninf nsub nnorm) float @ret_sqrt_unknown_sign
113 ; CHECK-SAME: (float nofpclass(nan ninf nsub nnorm) [[ARG0:%.*]], float nofpclass(nan ninf nsub nnorm) [[ARG1:%.*]]) #[[ATTR2]] {
114 ; CHECK-NEXT: [[UNKNOWN_SIGN_NOT_NAN:%.*]] = fmul nnan float [[ARG0]], [[ARG1]]
115 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan ninf nsub nnorm) float @llvm.sqrt.f32(float [[UNKNOWN_SIGN_NOT_NAN]]) #[[ATTR10]]
116 ; CHECK-NEXT: ret float [[CALL]]
118 %unknown.sign.not.nan = fmul nnan float %arg0, %arg1
119 %call = call float @llvm.sqrt.f32(float %unknown.sign.not.nan)
123 define float @ret_sqrt_daz_noinf_nozero(float nofpclass(inf zero) %arg0) #1 {
124 ; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_daz_noinf_nozero
125 ; CHECK-SAME: (float nofpclass(inf zero nsub nnorm) [[ARG0:%.*]]) #[[ATTR3:[0-9]+]] {
126 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
127 ; CHECK-NEXT: ret float [[CALL]]
129 %call = call float @llvm.sqrt.f32(float %arg0)
133 define <2 x float> @ret_sqrt_daz_noinf_nozero_v2f32(<2 x float> nofpclass(inf zero) %arg0) #1 {
134 ; CHECK-LABEL: define nofpclass(inf nsub nnorm) <2 x float> @ret_sqrt_daz_noinf_nozero_v2f32
135 ; CHECK-SAME: (<2 x float> nofpclass(inf zero nsub nnorm) [[ARG0:%.*]]) #[[ATTR3]] {
136 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) <2 x float> @llvm.sqrt.v2f32(<2 x float> [[ARG0]]) #[[ATTR10]]
137 ; CHECK-NEXT: ret <2 x float> [[CALL]]
139 %call = call <2 x float> @llvm.sqrt.v2f32(<2 x float> %arg0)
140 ret <2 x float> %call
143 define float @ret_sqrt_daz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #1 {
144 ; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_daz_noinf_nonegzero
145 ; CHECK-SAME: (float nofpclass(inf nzero nsub nnorm) [[ARG0:%.*]]) #[[ATTR3]] {
146 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
147 ; CHECK-NEXT: ret float [[CALL]]
149 %call = call float @llvm.sqrt.f32(float %arg0)
153 define float @ret_sqrt_dapz_noinf_nozero(float nofpclass(inf zero) %arg0) #2 {
154 ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_dapz_noinf_nozero
155 ; CHECK-SAME: (float nofpclass(inf zero nsub nnorm) [[ARG0:%.*]]) #[[ATTR4:[0-9]+]] {
156 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
157 ; CHECK-NEXT: ret float [[CALL]]
159 %call = call float @llvm.sqrt.f32(float %arg0)
163 define float @ret_sqrt_dapz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #2 {
164 ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_dapz_noinf_nonegzero
165 ; CHECK-SAME: (float nofpclass(inf nzero nsub nnorm) [[ARG0:%.*]]) #[[ATTR4]] {
166 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
167 ; CHECK-NEXT: ret float [[CALL]]
169 %call = call float @llvm.sqrt.f32(float %arg0)
173 define float @ret_sqrt_dynamic_noinf_nozero(float nofpclass(inf zero) %arg0) #3 {
174 ; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_dynamic_noinf_nozero
175 ; CHECK-SAME: (float nofpclass(inf zero nsub nnorm) [[ARG0:%.*]]) #[[ATTR5:[0-9]+]] {
176 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
177 ; CHECK-NEXT: ret float [[CALL]]
179 %call = call float @llvm.sqrt.f32(float %arg0)
183 define float @ret_sqrt_dynamic_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #3 {
184 ; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_dynamic_noinf_nonegzero
185 ; CHECK-SAME: (float nofpclass(inf nzero nsub nnorm) [[ARG0:%.*]]) #[[ATTR5]] {
186 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
187 ; CHECK-NEXT: ret float [[CALL]]
189 %call = call float @llvm.sqrt.f32(float %arg0)
193 define float @ret_sqrt_ftz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #4 {
194 ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_ftz_noinf_nonegzero
195 ; CHECK-SAME: (float nofpclass(inf nzero nsub nnorm) [[ARG0:%.*]]) #[[ATTR6:[0-9]+]] {
196 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
197 ; CHECK-NEXT: ret float [[CALL]]
199 %call = call float @llvm.sqrt.f32(float %arg0)
203 define float @ret_sqrt_ftpz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #5 {
204 ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_ftpz_noinf_nonegzero
205 ; CHECK-SAME: (float nofpclass(inf nzero nsub nnorm) [[ARG0:%.*]]) #[[ATTR7:[0-9]+]] {
206 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
207 ; CHECK-NEXT: ret float [[CALL]]
209 %call = call float @llvm.sqrt.f32(float %arg0)
213 define float @ret_sqrt_ftz_dynamic_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #6 {
214 ; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_ftz_dynamic_noinf_nonegzero
215 ; CHECK-SAME: (float nofpclass(inf nzero nsub nnorm) [[ARG0:%.*]]) #[[ATTR8:[0-9]+]] {
216 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
217 ; CHECK-NEXT: ret float [[CALL]]
219 %call = call float @llvm.sqrt.f32(float %arg0)
223 define float @constrained_sqrt(float %arg) strictfp {
224 ; CHECK-LABEL: define nofpclass(ninf nsub nnorm) float @constrained_sqrt
225 ; CHECK-SAME: (float nofpclass(ninf nsub nnorm) [[ARG:%.*]]) #[[ATTR9:[0-9]+]] {
226 ; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(ninf nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11:[0-9]+]]
227 ; CHECK-NEXT: ret float [[VAL]]
229 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")
233 define float @constrained_sqrt_nonan(float nofpclass(nan) %arg) strictfp {
234 ; CHECK-LABEL: define nofpclass(snan ninf nsub nnorm) float @constrained_sqrt_nonan
235 ; CHECK-SAME: (float nofpclass(nan ninf nsub nnorm) [[ARG:%.*]]) #[[ATTR9]] {
236 ; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(snan ninf nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11]]
237 ; CHECK-NEXT: ret float [[VAL]]
239 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")
243 define float @constrained_sqrt_nopinf(float nofpclass(pinf) %arg) strictfp {
244 ; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @constrained_sqrt_nopinf
245 ; CHECK-SAME: (float nofpclass(inf nsub nnorm) [[ARG:%.*]]) #[[ATTR9]] {
246 ; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11]]
247 ; CHECK-NEXT: ret float [[VAL]]
249 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")
253 define float @constrained_sqrt_nonegzero(float nofpclass(nzero) %arg) strictfp {
254 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @constrained_sqrt_nonegzero
255 ; CHECK-SAME: (float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR9]] {
256 ; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11]]
257 ; CHECK-NEXT: ret float [[VAL]]
259 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")
263 define float @constrained_sqrt_nozero(float nofpclass(zero) %arg) strictfp {
264 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @constrained_sqrt_nozero
265 ; CHECK-SAME: (float nofpclass(ninf zero nsub nnorm) [[ARG:%.*]]) #[[ATTR9]] {
266 ; CHECK-NEXT: [[VAL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.experimental.constrained.sqrt.f32(float [[ARG]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR11]]
267 ; CHECK-NEXT: ret float [[VAL]]
269 %val = call float @llvm.experimental.constrained.sqrt.f32(float %arg, metadata !"round.dynamic", metadata !"fpexcept.strict")
273 attributes #0 = { "denormal-fp-math"="ieee,ieee" }
274 attributes #1 = { "denormal-fp-math"="ieee,preserve-sign" }
275 attributes #2 = { "denormal-fp-math"="ieee,positive-zero" }
276 attributes #3 = { "denormal-fp-math"="ieee,dynamic" }
277 attributes #4 = { "denormal-fp-math"="preserve-sign,ieee" }
278 attributes #5 = { "denormal-fp-math"="positive-zero,ieee" }
279 attributes #6 = { "denormal-fp-math"="dynamic,ieee" }
281 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: