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.exp.f32(float)
5 declare float @llvm.exp2.f32(float)
6 declare float @llvm.exp10.f32(float)
8 define float @ret_exp(float %arg0) {
9 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp
10 ; CHECK-SAME: (float [[ARG0:%.*]]) #[[ATTR1:[0-9]+]] {
11 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp.f32(float [[ARG0]]) #[[ATTR2:[0-9]+]]
12 ; CHECK-NEXT: ret float [[CALL]]
14 %call = call float @llvm.exp.f32(float %arg0)
18 define float @ret_exp_noinf(float nofpclass(inf) %arg0) {
19 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp_noinf
20 ; CHECK-SAME: (float nofpclass(inf) [[ARG0:%.*]]) #[[ATTR1]] {
21 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp.f32(float nofpclass(inf) [[ARG0]]) #[[ATTR2]]
22 ; CHECK-NEXT: ret float [[CALL]]
24 %call = call float @llvm.exp.f32(float %arg0)
28 define float @ret_exp_nopinf(float nofpclass(pinf) %arg0) {
29 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp_nopinf
30 ; CHECK-SAME: (float nofpclass(pinf) [[ARG0:%.*]]) #[[ATTR1]] {
31 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp.f32(float nofpclass(pinf) [[ARG0]]) #[[ATTR2]]
32 ; CHECK-NEXT: ret float [[CALL]]
34 %call = call float @llvm.exp.f32(float %arg0)
38 define float @ret_exp_noninf(float nofpclass(ninf) %arg0) {
39 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp_noninf
40 ; CHECK-SAME: (float nofpclass(ninf) [[ARG0:%.*]]) #[[ATTR1]] {
41 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp.f32(float nofpclass(ninf) [[ARG0]]) #[[ATTR2]]
42 ; CHECK-NEXT: ret float [[CALL]]
44 %call = call float @llvm.exp.f32(float %arg0)
48 define float @ret_exp_nonan(float nofpclass(nan) %arg0) {
49 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp_nonan
50 ; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]]) #[[ATTR1]] {
51 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp.f32(float nofpclass(nan) [[ARG0]]) #[[ATTR2]]
52 ; CHECK-NEXT: ret float [[CALL]]
54 %call = call float @llvm.exp.f32(float %arg0)
58 define float @ret_exp_nonan_noinf(float nofpclass(nan inf) %arg0) {
59 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp_nonan_noinf
60 ; CHECK-SAME: (float nofpclass(nan inf) [[ARG0:%.*]]) #[[ATTR1]] {
61 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp.f32(float nofpclass(nan inf) [[ARG0]]) #[[ATTR2]]
62 ; CHECK-NEXT: ret float [[CALL]]
64 %call = call float @llvm.exp.f32(float %arg0)
68 define float @ret_exp_nonan_noinf_nozero(float nofpclass(nan inf zero) %arg0) {
69 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp_nonan_noinf_nozero
70 ; CHECK-SAME: (float nofpclass(nan inf zero) [[ARG0:%.*]]) #[[ATTR1]] {
71 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp.f32(float nofpclass(nan inf zero) [[ARG0]]) #[[ATTR2]]
72 ; CHECK-NEXT: ret float [[CALL]]
74 %call = call float @llvm.exp.f32(float %arg0)
78 define float @ret_exp_noinf_nozero(float nofpclass(inf zero) %arg0) {
79 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp_noinf_nozero
80 ; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR1]] {
81 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp.f32(float nofpclass(inf zero) [[ARG0]]) #[[ATTR2]]
82 ; CHECK-NEXT: ret float [[CALL]]
84 %call = call float @llvm.exp.f32(float %arg0)
88 define float @ret_exp_noinf_nonegzero(float nofpclass(inf nzero) %arg0) {
89 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp_noinf_nonegzero
90 ; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR1]] {
91 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR2]]
92 ; CHECK-NEXT: ret float [[CALL]]
94 %call = call float @llvm.exp.f32(float %arg0)
98 define float @ret_exp_positive_source(i32 %arg) {
99 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp_positive_source
100 ; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
101 ; CHECK-NEXT: [[UITOFP:%.*]] = uitofp i32 [[ARG]] to float
102 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp.f32(float [[UITOFP]]) #[[ATTR2]]
103 ; CHECK-NEXT: ret float [[CALL]]
105 %uitofp = uitofp i32 %arg to float
106 %call = call float @llvm.exp.f32(float %uitofp)
110 ; Could produce a nan because we don't know if the multiply is negative.
111 define float @ret_exp_unknown_sign(float nofpclass(nan) %arg0, float nofpclass(nan) %arg1) {
112 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp_unknown_sign
113 ; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]], float nofpclass(nan) [[ARG1:%.*]]) #[[ATTR1]] {
114 ; CHECK-NEXT: [[UNKNOWN_SIGN_NOT_NAN:%.*]] = fmul nnan float [[ARG0]], [[ARG1]]
115 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp.f32(float [[UNKNOWN_SIGN_NOT_NAN]]) #[[ATTR2]]
116 ; CHECK-NEXT: ret float [[CALL]]
118 %unknown.sign.not.nan = fmul nnan float %arg0, %arg1
119 %call = call float @llvm.exp.f32(float %unknown.sign.not.nan)
123 define float @ret_exp2(float %arg0) {
124 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp2
125 ; CHECK-SAME: (float [[ARG0:%.*]]) #[[ATTR1]] {
126 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float [[ARG0]]) #[[ATTR2]]
127 ; CHECK-NEXT: ret float [[CALL]]
129 %call = call float @llvm.exp2.f32(float %arg0)
133 define float @ret_exp2_noinf(float nofpclass(inf) %arg0) {
134 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp2_noinf
135 ; CHECK-SAME: (float nofpclass(inf) [[ARG0:%.*]]) #[[ATTR1]] {
136 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float nofpclass(inf) [[ARG0]]) #[[ATTR2]]
137 ; CHECK-NEXT: ret float [[CALL]]
139 %call = call float @llvm.exp2.f32(float %arg0)
143 define float @ret_exp2_nopinf(float nofpclass(pinf) %arg0) {
144 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp2_nopinf
145 ; CHECK-SAME: (float nofpclass(pinf) [[ARG0:%.*]]) #[[ATTR1]] {
146 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float nofpclass(pinf) [[ARG0]]) #[[ATTR2]]
147 ; CHECK-NEXT: ret float [[CALL]]
149 %call = call float @llvm.exp2.f32(float %arg0)
153 define float @ret_exp2_noninf(float nofpclass(ninf) %arg0) {
154 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp2_noninf
155 ; CHECK-SAME: (float nofpclass(ninf) [[ARG0:%.*]]) #[[ATTR1]] {
156 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float nofpclass(ninf) [[ARG0]]) #[[ATTR2]]
157 ; CHECK-NEXT: ret float [[CALL]]
159 %call = call float @llvm.exp2.f32(float %arg0)
163 define float @ret_exp2_nonan(float nofpclass(nan) %arg0) {
164 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp2_nonan
165 ; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]]) #[[ATTR1]] {
166 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp2.f32(float nofpclass(nan) [[ARG0]]) #[[ATTR2]]
167 ; CHECK-NEXT: ret float [[CALL]]
169 %call = call float @llvm.exp2.f32(float %arg0)
173 define float @ret_exp2_nonan_noinf(float nofpclass(nan inf) %arg0) {
174 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp2_nonan_noinf
175 ; CHECK-SAME: (float nofpclass(nan inf) [[ARG0:%.*]]) #[[ATTR1]] {
176 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp2.f32(float nofpclass(nan inf) [[ARG0]]) #[[ATTR2]]
177 ; CHECK-NEXT: ret float [[CALL]]
179 %call = call float @llvm.exp2.f32(float %arg0)
183 define float @ret_exp2_nonan_noinf_nozero(float nofpclass(nan inf zero) %arg0) {
184 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp2_nonan_noinf_nozero
185 ; CHECK-SAME: (float nofpclass(nan inf zero) [[ARG0:%.*]]) #[[ATTR1]] {
186 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp2.f32(float nofpclass(nan inf zero) [[ARG0]]) #[[ATTR2]]
187 ; CHECK-NEXT: ret float [[CALL]]
189 %call = call float @llvm.exp2.f32(float %arg0)
193 define float @ret_exp2_noinf_nozero(float nofpclass(inf zero) %arg0) {
194 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp2_noinf_nozero
195 ; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR1]] {
196 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float nofpclass(inf zero) [[ARG0]]) #[[ATTR2]]
197 ; CHECK-NEXT: ret float [[CALL]]
199 %call = call float @llvm.exp2.f32(float %arg0)
203 define float @ret_exp2_noinf_nonegzero(float nofpclass(inf nzero) %arg0) {
204 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp2_noinf_nonegzero
205 ; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR1]] {
206 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp2.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR2]]
207 ; CHECK-NEXT: ret float [[CALL]]
209 %call = call float @llvm.exp2.f32(float %arg0)
213 define float @ret_exp2_positive_source(i32 %arg) {
214 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp2_positive_source
215 ; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
216 ; CHECK-NEXT: [[UITOFP:%.*]] = uitofp i32 [[ARG]] to float
217 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp2.f32(float [[UITOFP]]) #[[ATTR2]]
218 ; CHECK-NEXT: ret float [[CALL]]
220 %uitofp = uitofp i32 %arg to float
221 %call = call float @llvm.exp2.f32(float %uitofp)
225 ; Could produce a nan because we don't know if the multiply is negative.
226 define float @ret_exp2_unknown_sign(float nofpclass(nan) %arg0, float nofpclass(nan) %arg1) {
227 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp2_unknown_sign
228 ; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]], float nofpclass(nan) [[ARG1:%.*]]) #[[ATTR1]] {
229 ; CHECK-NEXT: [[UNKNOWN_SIGN_NOT_NAN:%.*]] = fmul nnan float [[ARG0]], [[ARG1]]
230 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp2.f32(float [[UNKNOWN_SIGN_NOT_NAN]]) #[[ATTR2]]
231 ; CHECK-NEXT: ret float [[CALL]]
233 %unknown.sign.not.nan = fmul nnan float %arg0, %arg1
234 %call = call float @llvm.exp2.f32(float %unknown.sign.not.nan)
238 define float @ret_exp10(float %arg0) {
239 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp10
240 ; CHECK-SAME: (float [[ARG0:%.*]]) #[[ATTR1]] {
241 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp10.f32(float [[ARG0]]) #[[ATTR2]]
242 ; CHECK-NEXT: ret float [[CALL]]
244 %call = call float @llvm.exp10.f32(float %arg0)
248 define float @ret_exp10_noinf(float nofpclass(inf) %arg0) {
249 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp10_noinf
250 ; CHECK-SAME: (float nofpclass(inf) [[ARG0:%.*]]) #[[ATTR1]] {
251 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp10.f32(float nofpclass(inf) [[ARG0]]) #[[ATTR2]]
252 ; CHECK-NEXT: ret float [[CALL]]
254 %call = call float @llvm.exp10.f32(float %arg0)
258 define float @ret_exp10_nopinf(float nofpclass(pinf) %arg0) {
259 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp10_nopinf
260 ; CHECK-SAME: (float nofpclass(pinf) [[ARG0:%.*]]) #[[ATTR1]] {
261 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp10.f32(float nofpclass(pinf) [[ARG0]]) #[[ATTR2]]
262 ; CHECK-NEXT: ret float [[CALL]]
264 %call = call float @llvm.exp10.f32(float %arg0)
268 define float @ret_exp10_noninf(float nofpclass(ninf) %arg0) {
269 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp10_noninf
270 ; CHECK-SAME: (float nofpclass(ninf) [[ARG0:%.*]]) #[[ATTR1]] {
271 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp10.f32(float nofpclass(ninf) [[ARG0]]) #[[ATTR2]]
272 ; CHECK-NEXT: ret float [[CALL]]
274 %call = call float @llvm.exp10.f32(float %arg0)
278 define float @ret_exp10_nonan(float nofpclass(nan) %arg0) {
279 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp10_nonan
280 ; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]]) #[[ATTR1]] {
281 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp10.f32(float nofpclass(nan) [[ARG0]]) #[[ATTR2]]
282 ; CHECK-NEXT: ret float [[CALL]]
284 %call = call float @llvm.exp10.f32(float %arg0)
288 define float @ret_exp10_nonan_noinf(float nofpclass(nan inf) %arg0) {
289 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp10_nonan_noinf
290 ; CHECK-SAME: (float nofpclass(nan inf) [[ARG0:%.*]]) #[[ATTR1]] {
291 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp10.f32(float nofpclass(nan inf) [[ARG0]]) #[[ATTR2]]
292 ; CHECK-NEXT: ret float [[CALL]]
294 %call = call float @llvm.exp10.f32(float %arg0)
298 define float @ret_exp10_nonan_noinf_nozero(float nofpclass(nan inf zero) %arg0) {
299 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp10_nonan_noinf_nozero
300 ; CHECK-SAME: (float nofpclass(nan inf zero) [[ARG0:%.*]]) #[[ATTR1]] {
301 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp10.f32(float nofpclass(nan inf zero) [[ARG0]]) #[[ATTR2]]
302 ; CHECK-NEXT: ret float [[CALL]]
304 %call = call float @llvm.exp10.f32(float %arg0)
308 define float @ret_exp10_noinf_nozero(float nofpclass(inf zero) %arg0) {
309 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp10_noinf_nozero
310 ; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR1]] {
311 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp10.f32(float nofpclass(inf zero) [[ARG0]]) #[[ATTR2]]
312 ; CHECK-NEXT: ret float [[CALL]]
314 %call = call float @llvm.exp10.f32(float %arg0)
318 define float @ret_exp10_noinf_nonegzero(float nofpclass(inf nzero) %arg0) {
319 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_exp10_noinf_nonegzero
320 ; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR1]] {
321 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nzero nsub nnorm) float @llvm.exp10.f32(float nofpclass(inf nzero) [[ARG0]]) #[[ATTR2]]
322 ; CHECK-NEXT: ret float [[CALL]]
324 %call = call float @llvm.exp10.f32(float %arg0)
328 define float @ret_exp10_positive_source(i32 %arg) {
329 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp10_positive_source
330 ; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
331 ; CHECK-NEXT: [[UITOFP:%.*]] = uitofp i32 [[ARG]] to float
332 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp10.f32(float [[UITOFP]]) #[[ATTR2]]
333 ; CHECK-NEXT: ret float [[CALL]]
335 %uitofp = uitofp i32 %arg to float
336 %call = call float @llvm.exp10.f32(float %uitofp)
340 ; Could produce a nan because we don't know if the multiply is negative.
341 define float @ret_exp10_unknown_sign(float nofpclass(nan) %arg0, float nofpclass(nan) %arg1) {
342 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @ret_exp10_unknown_sign
343 ; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]], float nofpclass(nan) [[ARG1:%.*]]) #[[ATTR1]] {
344 ; CHECK-NEXT: [[UNKNOWN_SIGN_NOT_NAN:%.*]] = fmul nnan float [[ARG0]], [[ARG1]]
345 ; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan ninf nzero nsub nnorm) float @llvm.exp10.f32(float [[UNKNOWN_SIGN_NOT_NAN]]) #[[ATTR2]]
346 ; CHECK-NEXT: ret float [[CALL]]
348 %unknown.sign.not.nan = fmul nnan float %arg0, %arg1
349 %call = call float @llvm.exp10.f32(float %unknown.sign.not.nan)
352 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: