1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -S -passes=attributor -attributor-manifest-internal < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
4 declare float @llvm.fabs.f32(float)
5 declare float @llvm.copysign.f32(float, float)
6 declare void @llvm.assume(i1 noundef)
8 ;---------------------------------------------------------------------
9 ; compare > < to normal constant
10 ;---------------------------------------------------------------------
13 define float @clamp_is_ogt_1_to_1(float %arg) {
14 ; CHECK-LABEL: define nofpclass(pinf) float @clamp_is_ogt_1_to_1(
15 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2:[0-9]+]] {
16 ; CHECK-NEXT: [[IS_OGT_1:%.*]] = fcmp ogt float [[ARG]], 1.000000e+00
17 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_1]], float 1.000000e+00, float [[ARG]]
18 ; CHECK-NEXT: ret float [[SELECT]]
20 %is.ogt.1 = fcmp ogt float %arg, 1.0
21 %select = select i1 %is.ogt.1, float 1.0, float %arg
25 define float @clamp_is_ogt_1_to_1_commute(float %arg) {
26 ; CHECK-LABEL: define nofpclass(pinf) float @clamp_is_ogt_1_to_1_commute(
27 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
28 ; CHECK-NEXT: [[IS_ULE_1:%.*]] = fcmp ule float [[ARG]], 1.000000e+00
29 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULE_1]], float [[ARG]], float 1.000000e+00
30 ; CHECK-NEXT: ret float [[SELECT]]
32 %is.ule.1 = fcmp ule float %arg, 1.0
33 %select = select i1 %is.ule.1, float %arg, float 1.0
37 ; can't be +inf or nan
38 define float @clamp_is_ugt_1_to_1(float %arg) {
39 ; CHECK-LABEL: define nofpclass(nan pinf) float @clamp_is_ugt_1_to_1(
40 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
41 ; CHECK-NEXT: [[IS_UGT_1:%.*]] = fcmp ugt float [[ARG]], 1.000000e+00
42 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_1]], float 1.000000e+00, float [[ARG]]
43 ; CHECK-NEXT: ret float [[SELECT]]
45 %is.ugt.1 = fcmp ugt float %arg, 1.0
46 %select = select i1 %is.ugt.1, float 1.0, float %arg
50 ; can't be +inf or nan
51 define float @clamp_is_ugt_1_to_1_commute(float %arg) {
52 ; CHECK-LABEL: define nofpclass(nan pinf) float @clamp_is_ugt_1_to_1_commute(
53 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
54 ; CHECK-NEXT: [[IS_OLE_1:%.*]] = fcmp ole float [[ARG]], 1.000000e+00
55 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_1]], float [[ARG]], float 1.000000e+00
56 ; CHECK-NEXT: ret float [[SELECT]]
58 %is.ole.1 = fcmp ole float %arg, 1.0
59 %select = select i1 %is.ole.1, float %arg, float 1.0
64 define float @clamp_is_oge_1_to_1(float %arg) {
65 ; CHECK-LABEL: define nofpclass(pinf) float @clamp_is_oge_1_to_1(
66 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
67 ; CHECK-NEXT: [[IS_OGE_1:%.*]] = fcmp oge float [[ARG]], 1.000000e+00
68 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_1]], float 1.000000e+00, float [[ARG]]
69 ; CHECK-NEXT: ret float [[SELECT]]
71 %is.oge.1 = fcmp oge float %arg, 1.0
72 %select = select i1 %is.oge.1, float 1.0, float %arg
76 define float @clamp_is_oge_1_to_1_commute(float %arg) {
77 ; CHECK-LABEL: define nofpclass(pinf) float @clamp_is_oge_1_to_1_commute(
78 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
79 ; CHECK-NEXT: [[IS_ULT_1:%.*]] = fcmp ult float [[ARG]], 1.000000e+00
80 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULT_1]], float [[ARG]], float 1.000000e+00
81 ; CHECK-NEXT: ret float [[SELECT]]
83 %is.ult.1 = fcmp ult float %arg, 1.0
84 %select = select i1 %is.ult.1, float %arg, float 1.0
88 ; can't be +inf or nan
89 define float @clamp_is_uge_1_to_1(float %arg) {
90 ; CHECK-LABEL: define nofpclass(nan pinf) float @clamp_is_uge_1_to_1(
91 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
92 ; CHECK-NEXT: [[IS_UGT_1:%.*]] = fcmp uge float [[ARG]], 1.000000e+00
93 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_1]], float 1.000000e+00, float [[ARG]]
94 ; CHECK-NEXT: ret float [[SELECT]]
96 %is.ugt.1 = fcmp uge float %arg, 1.0
97 %select = select i1 %is.ugt.1, float 1.0, float %arg
101 ; can't be negative, zero, or denormal
102 define float @clamp_is_olt_1_to_1(float %arg) {
103 ; CHECK-LABEL: define nofpclass(ninf zero sub nnorm) float @clamp_is_olt_1_to_1(
104 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
105 ; CHECK-NEXT: [[IS_OLT_1:%.*]] = fcmp olt float [[ARG]], 1.000000e+00
106 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_1]], float 1.000000e+00, float [[ARG]]
107 ; CHECK-NEXT: ret float [[SELECT]]
109 %is.olt.1 = fcmp olt float %arg, 1.0
110 %select = select i1 %is.olt.1, float 1.0, float %arg
114 ; can't be negative, zero, or denormal
115 define float @clamp_is_olt_1_to_1_commute(float %arg) {
116 ; CHECK-LABEL: define nofpclass(ninf zero sub nnorm) float @clamp_is_olt_1_to_1_commute(
117 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
118 ; CHECK-NEXT: [[IS_UGE_1:%.*]] = fcmp uge float [[ARG]], 1.000000e+00
119 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGE_1]], float [[ARG]], float 1.000000e+00
120 ; CHECK-NEXT: ret float [[SELECT]]
122 %is.uge.1 = fcmp uge float %arg, 1.0
123 %select = select i1 %is.uge.1, float %arg, float 1.0
127 ; can't be negative or zero, nan or denormal
128 define float @clamp_is_ult_1_to_1(float %arg) {
129 ; CHECK-LABEL: define nofpclass(nan ninf zero sub nnorm) float @clamp_is_ult_1_to_1(
130 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
131 ; CHECK-NEXT: [[IS_ULT_1:%.*]] = fcmp ult float [[ARG]], 1.000000e+00
132 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULT_1]], float 1.000000e+00, float [[ARG]]
133 ; CHECK-NEXT: ret float [[SELECT]]
135 %is.ult.1 = fcmp ult float %arg, 1.0
136 %select = select i1 %is.ult.1, float 1.0, float %arg
140 ; can't be negative or zero, nan or denormal
141 define float @clamp_is_ult_1_to_1_commute(float %arg) {
142 ; CHECK-LABEL: define nofpclass(nan ninf zero sub nnorm) float @clamp_is_ult_1_to_1_commute(
143 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
144 ; CHECK-NEXT: [[IS_OGE_1:%.*]] = fcmp oge float [[ARG]], 1.000000e+00
145 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_1]], float [[ARG]], float 1.000000e+00
146 ; CHECK-NEXT: ret float [[SELECT]]
148 %is.oge.1 = fcmp oge float %arg, 1.0
149 %select = select i1 %is.oge.1, float %arg, float 1.0
153 ; can't be negative, zero or denormal
154 define float @clamp_is_ole_1_to_1(float %arg) {
155 ; CHECK-LABEL: define nofpclass(ninf zero sub nnorm) float @clamp_is_ole_1_to_1(
156 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
157 ; CHECK-NEXT: [[IS_OLE_1:%.*]] = fcmp ole float [[ARG]], 1.000000e+00
158 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_1]], float 1.000000e+00, float [[ARG]]
159 ; CHECK-NEXT: ret float [[SELECT]]
161 %is.ole.1 = fcmp ole float %arg, 1.0
162 %select = select i1 %is.ole.1, float 1.0, float %arg
166 ; can't be negative or zero, nan or denormal
167 define float @clamp_is_ule_1_to_1(float %arg) {
168 ; CHECK-LABEL: define nofpclass(nan ninf zero sub nnorm) float @clamp_is_ule_1_to_1(
169 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
170 ; CHECK-NEXT: [[IS_ULE_1:%.*]] = fcmp ule float [[ARG]], 1.000000e+00
171 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULE_1]], float 1.000000e+00, float [[ARG]]
172 ; CHECK-NEXT: ret float [[SELECT]]
174 %is.ule.1 = fcmp ule float %arg, 1.0
175 %select = select i1 %is.ule.1, float 1.0, float %arg
179 ; can't be negative or denormal
180 define float @clamp_is_olt_1_to_0(float %arg) {
181 ; CHECK-LABEL: define nofpclass(ninf nzero sub nnorm) float @clamp_is_olt_1_to_0(
182 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
183 ; CHECK-NEXT: [[IS_OLT_1:%.*]] = fcmp olt float [[ARG]], 1.000000e+00
184 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_1]], float 0.000000e+00, float [[ARG]]
185 ; CHECK-NEXT: ret float [[SELECT]]
187 %is.olt.1 = fcmp olt float %arg, 1.0
188 %select = select i1 %is.olt.1, float 0.0, float %arg
192 ; can't be negative, nan or denormal
193 define float @clamp_is_ult_1_to_0(float %arg) {
194 ; CHECK-LABEL: define nofpclass(ninf nzero sub nnorm) float @clamp_is_ult_1_to_0(
195 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
196 ; CHECK-NEXT: [[IS_ULT_1:%.*]] = fcmp olt float [[ARG]], 1.000000e+00
197 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULT_1]], float 0.000000e+00, float [[ARG]]
198 ; CHECK-NEXT: ret float [[SELECT]]
200 %is.ult.1 = fcmp olt float %arg, 1.0
201 %select = select i1 %is.ult.1, float 0.0, float %arg
205 ; can't be negative or denormal
206 define float @clamp_is_ole_1_to_0(float %arg) {
207 ; CHECK-LABEL: define nofpclass(ninf nzero sub nnorm) float @clamp_is_ole_1_to_0(
208 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
209 ; CHECK-NEXT: [[IS_OLE_1:%.*]] = fcmp ole float [[ARG]], 1.000000e+00
210 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_1]], float 0.000000e+00, float [[ARG]]
211 ; CHECK-NEXT: ret float [[SELECT]]
213 %is.ole.1 = fcmp ole float %arg, 1.0
214 %select = select i1 %is.ole.1, float 0.0, float %arg
218 ; can't be negative or denormal
219 define float @clamp_is_ole_1_to_0_commute(float %arg) {
220 ; CHECK-LABEL: define nofpclass(ninf nzero sub nnorm) float @clamp_is_ole_1_to_0_commute(
221 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
222 ; CHECK-NEXT: [[IS_UGT_1:%.*]] = fcmp ugt float [[ARG]], 1.000000e+00
223 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_1]], float [[ARG]], float 0.000000e+00
224 ; CHECK-NEXT: ret float [[SELECT]]
226 %is.ugt.1 = fcmp ugt float %arg, 1.0
227 %select = select i1 %is.ugt.1, float %arg, float 0.0
231 ; can't be negative or denormal
232 define float @clamp_is_ule_1_to_0(float %arg) {
233 ; CHECK-LABEL: define nofpclass(ninf nzero sub nnorm) float @clamp_is_ule_1_to_0(
234 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
235 ; CHECK-NEXT: [[IS_ULE_1:%.*]] = fcmp ole float [[ARG]], 1.000000e+00
236 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULE_1]], float 0.000000e+00, float [[ARG]]
237 ; CHECK-NEXT: ret float [[SELECT]]
239 %is.ule.1 = fcmp ole float %arg, 1.0
240 %select = select i1 %is.ule.1, float 0.0, float %arg
244 ; can't be positive, zero or denormal
245 define float @clamp_is_ogt_neg1_to_neg1(float %arg) {
246 ; CHECK-LABEL: define nofpclass(pinf zero sub pnorm) float @clamp_is_ogt_neg1_to_neg1(
247 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
248 ; CHECK-NEXT: [[IS_OGT_NEG1:%.*]] = fcmp ogt float [[ARG]], -1.000000e+00
249 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_NEG1]], float -1.000000e+00, float [[ARG]]
250 ; CHECK-NEXT: ret float [[SELECT]]
252 %is.ogt.neg1 = fcmp ogt float %arg, -1.0
253 %select = select i1 %is.ogt.neg1, float -1.0, float %arg
257 ; can't be positive, zero, nan or denormal
258 define float @clamp_is_ugt_neg1_to_neg1(float %arg) {
259 ; CHECK-LABEL: define nofpclass(nan pinf zero sub pnorm) float @clamp_is_ugt_neg1_to_neg1(
260 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
261 ; CHECK-NEXT: [[IS_UGT_NEG1:%.*]] = fcmp ugt float [[ARG]], -1.000000e+00
262 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_NEG1]], float -1.000000e+00, float [[ARG]]
263 ; CHECK-NEXT: ret float [[SELECT]]
265 %is.ugt.neg1 = fcmp ugt float %arg, -1.0
266 %select = select i1 %is.ugt.neg1, float -1.0, float %arg
270 ; can't be positive or denormal
271 define float @clamp_is_ogt_neg1_to_0(float %arg) {
272 ; CHECK-LABEL: define nofpclass(pinf nzero sub pnorm) float @clamp_is_ogt_neg1_to_0(
273 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
274 ; CHECK-NEXT: [[IS_OGT_NEG1:%.*]] = fcmp ogt float [[ARG]], -1.000000e+00
275 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_NEG1]], float 0.000000e+00, float [[ARG]]
276 ; CHECK-NEXT: ret float [[SELECT]]
278 %is.ogt.neg1 = fcmp ogt float %arg, -1.0
279 %select = select i1 %is.ogt.neg1, float 0.0, float %arg
283 ; can't be positive, nan or denormal
284 define float @clamp_is_ugt_neg1_to_0(float %arg) {
285 ; CHECK-LABEL: define nofpclass(nan pinf nzero sub pnorm) float @clamp_is_ugt_neg1_to_0(
286 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
287 ; CHECK-NEXT: [[IS_UGT_NEG1:%.*]] = fcmp ugt float [[ARG]], -1.000000e+00
288 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_NEG1]], float 0.000000e+00, float [[ARG]]
289 ; CHECK-NEXT: ret float [[SELECT]]
291 %is.ugt.neg1 = fcmp ugt float %arg, -1.0
292 %select = select i1 %is.ugt.neg1, float 0.0, float %arg
297 define float @clamp_is_olt_neg1_to_neg1_commute(float %arg) {
298 ; CHECK-LABEL: define nofpclass(ninf) float @clamp_is_olt_neg1_to_neg1_commute(
299 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
300 ; CHECK-NEXT: [[IS_UGE_NEG1:%.*]] = fcmp uge float [[ARG]], -1.000000e+00
301 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGE_NEG1]], float [[ARG]], float -1.000000e+00
302 ; CHECK-NEXT: ret float [[SELECT]]
304 %is.uge.neg1 = fcmp uge float %arg, -1.0
305 %select = select i1 %is.uge.neg1, float %arg, float -1.0
310 define float @clamp_is_olt_neg1_to_neg1(float %arg) {
311 ; CHECK-LABEL: define nofpclass(ninf) float @clamp_is_olt_neg1_to_neg1(
312 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
313 ; CHECK-NEXT: [[IS_OLT_NEG1:%.*]] = fcmp olt float [[ARG]], -1.000000e+00
314 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_NEG1]], float -1.000000e+00, float [[ARG]]
315 ; CHECK-NEXT: ret float [[SELECT]]
317 %is.olt.neg1 = fcmp olt float %arg, -1.0
318 %select = select i1 %is.olt.neg1, float -1.0, float %arg
322 ; can't be -inf or nan
323 define float @clamp_is_ult_neg1_to_neg1(float %arg) {
324 ; CHECK-LABEL: define nofpclass(nan ninf) float @clamp_is_ult_neg1_to_neg1(
325 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
326 ; CHECK-NEXT: [[IS_ULT_NEG1:%.*]] = fcmp ult float [[ARG]], -1.000000e+00
327 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULT_NEG1]], float -1.000000e+00, float [[ARG]]
328 ; CHECK-NEXT: ret float [[SELECT]]
330 %is.ult.neg1 = fcmp ult float %arg, -1.0
331 %select = select i1 %is.ult.neg1, float -1.0, float %arg
335 ; can't be -inf or nan
336 define float @clamp_is_ult_neg1_to_neg1_commute(float %arg) {
337 ; CHECK-LABEL: define nofpclass(nan ninf) float @clamp_is_ult_neg1_to_neg1_commute(
338 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
339 ; CHECK-NEXT: [[IS_OGE_NEG1:%.*]] = fcmp oge float [[ARG]], -1.000000e+00
340 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_NEG1]], float [[ARG]], float -1.000000e+00
341 ; CHECK-NEXT: ret float [[SELECT]]
343 %is.oge.neg1 = fcmp oge float %arg, -1.0
344 %select = select i1 %is.oge.neg1, float %arg, float -1.
348 ;---------------------------------------------------------------------
349 ; compare ==, != to normal
350 ;---------------------------------------------------------------------
352 ; Must be 1, only posnormal
353 define float @fcmp_oeq_1_else_1(float %arg) {
354 ; CHECK-LABEL: define nofpclass(nan inf zero sub nnorm) float @fcmp_oeq_1_else_1(
355 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
356 ; CHECK-NEXT: [[IS_OEQ_1:%.*]] = fcmp oeq float [[ARG]], 1.000000e+00
357 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OEQ_1]], float [[ARG]], float 1.000000e+00
358 ; CHECK-NEXT: ret float [[SELECT]]
360 %is.oeq.1 = fcmp oeq float %arg, 1.0
361 %select = select i1 %is.oeq.1, float %arg, float 1.0
365 ; Don't know anything
366 define float @fcmp_one_1_else_1(float %arg) {
367 ; CHECK-LABEL: define nofpclass(nan) float @fcmp_one_1_else_1(
368 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
369 ; CHECK-NEXT: [[IS_ONE_1:%.*]] = fcmp one float [[ARG]], 1.000000e+00
370 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ONE_1]], float [[ARG]], float 1.000000e+00
371 ; CHECK-NEXT: ret float [[SELECT]]
373 %is.one.1 = fcmp one float %arg, 1.0
374 %select = select i1 %is.one.1, float %arg, float 1.0
379 define float @fcmp_one_1_1_else_arg(float %arg) {
380 ; CHECK-LABEL: define nofpclass(inf zero sub nnorm) float @fcmp_one_1_1_else_arg(
381 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
382 ; CHECK-NEXT: [[IS_ONE_1:%.*]] = fcmp one float [[ARG]], 1.000000e+00
383 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ONE_1]], float 1.000000e+00, float [[ARG]]
384 ; CHECK-NEXT: ret float [[SELECT]]
386 %is.one.1 = fcmp one float %arg, 1.0
387 %select = select i1 %is.one.1, float 1.0, float %arg
392 define float @fcmp_une_1_1_else_arg(float %arg) {
393 ; CHECK-LABEL: define nofpclass(nan inf zero sub nnorm) float @fcmp_une_1_1_else_arg(
394 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
395 ; CHECK-NEXT: [[IS_UNE_1:%.*]] = fcmp une float [[ARG]], 1.000000e+00
396 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UNE_1]], float 1.000000e+00, float [[ARG]]
397 ; CHECK-NEXT: ret float [[SELECT]]
399 %is.une.1 = fcmp une float %arg, 1.0
400 %select = select i1 %is.une.1, float 1.0, float %arg
404 ; Must be -1, only negnormal
405 define float @fcmp_oeq_neg1_else_neg1(float %arg) {
406 ; CHECK-LABEL: define nofpclass(nan inf zero sub pnorm) float @fcmp_oeq_neg1_else_neg1(
407 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
408 ; CHECK-NEXT: [[IS_OEQ_NEG1:%.*]] = fcmp oeq float [[ARG]], -1.000000e+00
409 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OEQ_NEG1]], float [[ARG]], float -1.000000e+00
410 ; CHECK-NEXT: ret float [[SELECT]]
412 %is.oeq.neg1 = fcmp oeq float %arg, -1.0
413 %select = select i1 %is.oeq.neg1, float %arg, float -1.0
417 ; Don't know anything
418 define float @fcmp_one_neg1_else_neg1(float %arg) {
419 ; CHECK-LABEL: define nofpclass(nan) float @fcmp_one_neg1_else_neg1(
420 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
421 ; CHECK-NEXT: [[IS_ONE_NEG1:%.*]] = fcmp one float [[ARG]], -1.000000e+00
422 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ONE_NEG1]], float [[ARG]], float -1.000000e+00
423 ; CHECK-NEXT: ret float [[SELECT]]
425 %is.one.neg1 = fcmp one float %arg, -1.0
426 %select = select i1 %is.one.neg1, float %arg, float -1.0
430 define float @fcmp_oeq_1_else_0(float %arg) {
431 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub nnorm) float @fcmp_oeq_1_else_0(
432 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
433 ; CHECK-NEXT: [[IS_OEQ_1:%.*]] = fcmp oeq float [[ARG]], 1.000000e+00
434 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OEQ_1]], float 1.000000e+00, float 0.000000e+00
435 ; CHECK-NEXT: ret float [[SELECT]]
437 %is.oeq.1 = fcmp oeq float %arg, 1.0
438 %select = select i1 %is.oeq.1, float 1.0, float 0.0
442 define float @fcmp_ueq_1_else_0(float %arg) {
443 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub nnorm) float @fcmp_ueq_1_else_0(
444 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
445 ; CHECK-NEXT: [[IS_UEQ_1:%.*]] = fcmp ueq float [[ARG]], 1.000000e+00
446 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UEQ_1]], float 1.000000e+00, float 0.000000e+00
447 ; CHECK-NEXT: ret float [[SELECT]]
449 %is.ueq.1 = fcmp ueq float %arg, 1.0
450 %select = select i1 %is.ueq.1, float 1.0, float 0.0
454 define float @if_fcmp_oeq_1_0_else_arg(float %arg) {
455 ; CHECK-LABEL: define float @if_fcmp_oeq_1_0_else_arg(
456 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
457 ; CHECK-NEXT: [[IS_OEQ_1:%.*]] = fcmp oeq float [[ARG]], 1.000000e+00
458 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OEQ_1]], float 0.000000e+00, float [[ARG]]
459 ; CHECK-NEXT: ret float [[SELECT]]
461 %is.oeq.1 = fcmp oeq float %arg, 1.0
462 %select = select i1 %is.oeq.1, float 0.0, float %arg
466 define float @if_fcmp_oeq_0_1_else_arg(float %arg) {
467 ; CHECK-LABEL: define nofpclass(zero) float @if_fcmp_oeq_0_1_else_arg(
468 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
469 ; CHECK-NEXT: [[IS_OEQ_0:%.*]] = fcmp oeq float [[ARG]], 0.000000e+00
470 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OEQ_0]], float 1.000000e+00, float [[ARG]]
471 ; CHECK-NEXT: ret float [[SELECT]]
473 %is.oeq.0 = fcmp oeq float %arg, 0.0
474 %select = select i1 %is.oeq.0, float 1.0, float %arg
478 define float @if_fcmp_one_0_arg_else_1(float %arg) {
479 ; CHECK-LABEL: define nofpclass(nan zero) float @if_fcmp_one_0_arg_else_1(
480 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
481 ; CHECK-NEXT: [[IS_ONE_0:%.*]] = fcmp one float [[ARG]], 0.000000e+00
482 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ONE_0]], float [[ARG]], float 1.000000e+00
483 ; CHECK-NEXT: ret float [[SELECT]]
485 %is.one.0 = fcmp one float %arg, 0.0
486 %select = select i1 %is.one.0, float %arg, float 1.0
490 define float @if_fcmp_une_0_arg_else_1(float %arg) {
491 ; CHECK-LABEL: define nofpclass(zero) float @if_fcmp_une_0_arg_else_1(
492 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
493 ; CHECK-NEXT: [[IS_UNE_0:%.*]] = fcmp une float [[ARG]], 0.000000e+00
494 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UNE_0]], float [[ARG]], float 1.000000e+00
495 ; CHECK-NEXT: ret float [[SELECT]]
497 %is.une.0 = fcmp une float %arg, 0.0
498 %select = select i1 %is.une.0, float %arg, float 1.0
502 define float @if_fcmp_one_0_1_else_arg(float %arg) {
503 ; CHECK-LABEL: define nofpclass(inf sub nnorm) float @if_fcmp_one_0_1_else_arg(
504 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
505 ; CHECK-NEXT: [[IS_ONE_0:%.*]] = fcmp one float [[ARG]], 0.000000e+00
506 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ONE_0]], float 1.000000e+00, float [[ARG]]
507 ; CHECK-NEXT: ret float [[SELECT]]
509 %is.one.0 = fcmp one float %arg, 0.0
510 %select = select i1 %is.one.0, float 1.0, float %arg
514 define float @if_fcmp_one_1_arg_else_0(float %arg) {
515 ; CHECK-LABEL: define nofpclass(nan) float @if_fcmp_one_1_arg_else_0(
516 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
517 ; CHECK-NEXT: [[IS_ONE_1:%.*]] = fcmp one float [[ARG]], 1.000000e+00
518 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ONE_1]], float [[ARG]], float 0.000000e+00
519 ; CHECK-NEXT: ret float [[SELECT]]
521 %is.one.1 = fcmp one float %arg, 1.0
522 %select = select i1 %is.one.1, float %arg, float 0.0
526 define float @fcmp_fabs_oeq_1_else_1(float %arg) {
527 ; CHECK-LABEL: define nofpclass(nan inf zero sub) float @fcmp_fabs_oeq_1_else_1(
528 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
529 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4:[0-9]+]]
530 ; CHECK-NEXT: [[FABS_IS_OEQ_1:%.*]] = fcmp oeq float [[FABS_ARG]], 1.000000e+00
531 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OEQ_1]], float [[ARG]], float 1.000000e+00
532 ; CHECK-NEXT: ret float [[SELECT]]
534 %fabs.arg = call float @llvm.fabs.f32(float %arg)
535 %fabs.is.oeq.1 = fcmp oeq float %fabs.arg, 1.0
536 %select = select i1 %fabs.is.oeq.1, float %arg, float 1.0
540 define float @fcmp_fabs_oeq_1_0_else_arg(float %arg) {
541 ; CHECK-LABEL: define float @fcmp_fabs_oeq_1_0_else_arg(
542 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
543 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
544 ; CHECK-NEXT: [[FABS_IS_OEQ_1:%.*]] = fcmp oeq float [[FABS_ARG]], 1.000000e+00
545 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OEQ_1]], float 0.000000e+00, float [[ARG]]
546 ; CHECK-NEXT: ret float [[SELECT]]
548 %fabs.arg = call float @llvm.fabs.f32(float %arg)
549 %fabs.is.oeq.1 = fcmp oeq float %fabs.arg, 1.0
550 %select = select i1 %fabs.is.oeq.1, float 0.0, float %arg
554 define float @fcmp_fabs_ueq_1_0_else_arg(float %arg) {
555 ; CHECK-LABEL: define nofpclass(nan) float @fcmp_fabs_ueq_1_0_else_arg(
556 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
557 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
558 ; CHECK-NEXT: [[FABS_IS_UEQ_1:%.*]] = fcmp ueq float [[FABS_ARG]], 1.000000e+00
559 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_UEQ_1]], float 0.000000e+00, float [[ARG]]
560 ; CHECK-NEXT: ret float [[SELECT]]
562 %fabs.arg = call float @llvm.fabs.f32(float %arg)
563 %fabs.is.ueq.1 = fcmp ueq float %fabs.arg, 1.0
564 %select = select i1 %fabs.is.ueq.1, float 0.0, float %arg
568 define float @fcmp_fabs_one_1_arg_else_0(float %arg) {
569 ; CHECK-LABEL: define nofpclass(nan) float @fcmp_fabs_one_1_arg_else_0(
570 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
571 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
572 ; CHECK-NEXT: [[FABS_IS_ONE_1:%.*]] = fcmp one float [[FABS_ARG]], 1.000000e+00
573 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ONE_1]], float [[ARG]], float 0.000000e+00
574 ; CHECK-NEXT: ret float [[SELECT]]
576 %fabs.arg = call float @llvm.fabs.f32(float %arg)
577 %fabs.is.one.1 = fcmp one float %fabs.arg, 1.0
578 %select = select i1 %fabs.is.one.1, float %arg, float 0.0
582 define float @fcmp_fabs_une_1_arg_else_0(float %arg) {
583 ; CHECK-LABEL: define float @fcmp_fabs_une_1_arg_else_0(
584 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
585 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
586 ; CHECK-NEXT: [[FABS_IS_UNE_1:%.*]] = fcmp une float [[FABS_ARG]], 1.000000e+00
587 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_UNE_1]], float [[ARG]], float 0.000000e+00
588 ; CHECK-NEXT: ret float [[SELECT]]
590 %fabs.arg = call float @llvm.fabs.f32(float %arg)
591 %fabs.is.une.1 = fcmp une float %fabs.arg, 1.0
592 %select = select i1 %fabs.is.une.1, float %arg, float 0.0
596 define float @fcmp_fabs_one_1_0_else_arg(float %arg) {
597 ; CHECK-LABEL: define nofpclass(inf nzero sub) float @fcmp_fabs_one_1_0_else_arg(
598 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
599 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
600 ; CHECK-NEXT: [[FABS_IS_ONE_1:%.*]] = fcmp one float [[FABS_ARG]], 1.000000e+00
601 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ONE_1]], float 0.000000e+00, float [[ARG]]
602 ; CHECK-NEXT: ret float [[SELECT]]
604 %fabs.arg = call float @llvm.fabs.f32(float %arg)
605 %fabs.is.one.1 = fcmp one float %fabs.arg, 1.0
606 %select = select i1 %fabs.is.one.1, float 0.0, float %arg
610 define float @fcmp_fabs_une_1_0_else_arg(float %arg) {
611 ; CHECK-LABEL: define nofpclass(nan inf nzero sub) float @fcmp_fabs_une_1_0_else_arg(
612 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
613 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
614 ; CHECK-NEXT: [[FABS_IS_UNE_1:%.*]] = fcmp une float [[FABS_ARG]], 1.000000e+00
615 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_UNE_1]], float 0.000000e+00, float [[ARG]]
616 ; CHECK-NEXT: ret float [[SELECT]]
618 %fabs.arg = call float @llvm.fabs.f32(float %arg)
619 %fabs.is.une.1 = fcmp une float %fabs.arg, 1.0
620 %select = select i1 %fabs.is.une.1, float 0.0, float %arg
624 define float @fcmp_fabs_one_1_neg2_else_arg(float %arg) {
625 ; CHECK-LABEL: define nofpclass(inf zero sub) float @fcmp_fabs_one_1_neg2_else_arg(
626 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
627 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
628 ; CHECK-NEXT: [[FABS_IS_ONE_1:%.*]] = fcmp one float [[FABS_ARG]], 1.000000e+00
629 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ONE_1]], float -2.000000e+00, float [[ARG]]
630 ; CHECK-NEXT: ret float [[SELECT]]
632 %fabs.arg = call float @llvm.fabs.f32(float %arg)
633 %fabs.is.one.1 = fcmp one float %fabs.arg, 1.0
634 %select = select i1 %fabs.is.one.1, float -2.0, float %arg
638 ;---------------------------------------------------------------------
639 ; compare to denormal
640 ;---------------------------------------------------------------------
642 define float @clamp_olt_largest_denormal_0.0(float %arg) {
643 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_olt_largest_denormal_0.0(
644 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
645 ; CHECK-NEXT: [[IS_OLT_LARGEST_DENORMAL:%.*]] = fcmp olt float [[ARG]], 0x380FFFFFC0000000
646 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_LARGEST_DENORMAL]], float 0.000000e+00, float [[ARG]]
647 ; CHECK-NEXT: ret float [[SELECT]]
649 %is.olt.largest.denormal = fcmp olt float %arg, 0x380FFFFFC0000000
650 %select = select i1 %is.olt.largest.denormal, float 0.0, float %arg
654 define float @clamp_ole_largest_denormal_0.0(float %arg) {
655 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_ole_largest_denormal_0.0(
656 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
657 ; CHECK-NEXT: [[IS_OLE_LARGEST_DENORMAL:%.*]] = fcmp ole float [[ARG]], 0x380FFFFFC0000000
658 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_LARGEST_DENORMAL]], float 0.000000e+00, float [[ARG]]
659 ; CHECK-NEXT: ret float [[SELECT]]
661 %is.ole.largest.denormal = fcmp ole float %arg, 0x380FFFFFC0000000
662 %select = select i1 %is.ole.largest.denormal, float 0.0, float %arg
666 define float @clamp_ult_largest_denormal_0.0(float %arg) {
667 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @clamp_ult_largest_denormal_0.0(
668 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
669 ; CHECK-NEXT: [[IS_ULT_LARGEST_DENORMAL:%.*]] = fcmp ult float [[ARG]], 0x380FFFFFC0000000
670 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULT_LARGEST_DENORMAL]], float 0.000000e+00, float [[ARG]]
671 ; CHECK-NEXT: ret float [[SELECT]]
673 %is.ult.largest.denormal = fcmp ult float %arg, 0x380FFFFFC0000000
674 %select = select i1 %is.ult.largest.denormal, float 0.0, float %arg
678 define float @clamp_ule_largest_denormal_0.0(float %arg) {
679 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @clamp_ule_largest_denormal_0.0(
680 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
681 ; CHECK-NEXT: [[IS_ULE_LARGEST_DENORMAL:%.*]] = fcmp ule float [[ARG]], 0x380FFFFFC0000000
682 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULE_LARGEST_DENORMAL]], float 0.000000e+00, float [[ARG]]
683 ; CHECK-NEXT: ret float [[SELECT]]
685 %is.ule.largest.denormal = fcmp ule float %arg, 0x380FFFFFC0000000
686 %select = select i1 %is.ule.largest.denormal, float 0.0, float %arg
690 define float @clamp_ogt_largest_denormal_0.0(float %arg) {
691 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @clamp_ogt_largest_denormal_0.0(
692 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
693 ; CHECK-NEXT: [[IS_OGT_LARGEST_DENORMAL:%.*]] = fcmp ogt float [[ARG]], 0x380FFFFFC0000000
694 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_LARGEST_DENORMAL]], float [[ARG]], float 0.000000e+00
695 ; CHECK-NEXT: ret float [[SELECT]]
697 %is.ogt.largest.denormal = fcmp ogt float %arg, 0x380FFFFFC0000000
698 %select = select i1 %is.ogt.largest.denormal, float %arg, float 0.0
702 define float @clamp_oge_largest_denormal_0.0(float %arg) {
703 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @clamp_oge_largest_denormal_0.0(
704 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
705 ; CHECK-NEXT: [[IS_OGE_LARGEST_DENORMAL:%.*]] = fcmp oge float [[ARG]], 0x380FFFFFC0000000
706 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_LARGEST_DENORMAL]], float [[ARG]], float 0.000000e+00
707 ; CHECK-NEXT: ret float [[SELECT]]
709 %is.oge.largest.denormal = fcmp oge float %arg, 0x380FFFFFC0000000
710 %select = select i1 %is.oge.largest.denormal, float %arg, float 0.0
714 define float @clamp_ugt_largest_denormal_0.0(float %arg) {
715 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_ugt_largest_denormal_0.0(
716 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
717 ; CHECK-NEXT: [[IS_UGT_LARGEST_DENORMAL:%.*]] = fcmp ugt float [[ARG]], 0x380FFFFFC0000000
718 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_LARGEST_DENORMAL]], float [[ARG]], float 0.000000e+00
719 ; CHECK-NEXT: ret float [[SELECT]]
721 %is.ugt.largest.denormal = fcmp ugt float %arg, 0x380FFFFFC0000000
722 %select = select i1 %is.ugt.largest.denormal, float %arg, float 0.0
726 define float @clamp_uge_largest_denormal_0.0(float %arg) {
727 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_uge_largest_denormal_0.0(
728 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
729 ; CHECK-NEXT: [[IS_UGE_LARGEST_DENORMAL:%.*]] = fcmp uge float [[ARG]], 0x380FFFFFC0000000
730 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGE_LARGEST_DENORMAL]], float [[ARG]], float 0.000000e+00
731 ; CHECK-NEXT: ret float [[SELECT]]
733 %is.uge.largest.denormal = fcmp uge float %arg, 0x380FFFFFC0000000
734 %select = select i1 %is.uge.largest.denormal, float %arg, float 0.0
738 define float @fcmp_oeq_largest_denormal_arg_else_0.0(float %arg) {
739 ; CHECK-LABEL: define nofpclass(nan inf nzero nsub norm) float @fcmp_oeq_largest_denormal_arg_else_0.0(
740 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
741 ; CHECK-NEXT: [[IS_OEQ_LARGEST_DENORMAL:%.*]] = fcmp oeq float [[ARG]], 0x380FFFFFC0000000
742 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OEQ_LARGEST_DENORMAL]], float [[ARG]], float 0.000000e+00
743 ; CHECK-NEXT: ret float [[SELECT]]
745 %is.oeq.largest.denormal = fcmp oeq float %arg, 0x380FFFFFC0000000
746 %select = select i1 %is.oeq.largest.denormal, float %arg, float 0.0
750 define float @clamp_fabs_olt_largest_denormal_0.0(float %arg) {
751 ; CHECK-LABEL: define nofpclass(nzero) float @clamp_fabs_olt_largest_denormal_0.0(
752 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
753 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
754 ; CHECK-NEXT: [[IS_FABS_OLT_LARGEST_DENORMAL:%.*]] = fcmp olt float [[FABS_ARG]], 0x380FFFFFC0000000
755 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_FABS_OLT_LARGEST_DENORMAL]], float 0.000000e+00, float [[ARG]]
756 ; CHECK-NEXT: ret float [[SELECT]]
758 %fabs.arg = call float @llvm.fabs.f32(float %arg)
759 %is.fabs.olt.largest.denormal = fcmp olt float %fabs.arg, 0x380FFFFFC0000000
760 %select = select i1 %is.fabs.olt.largest.denormal, float 0.0, float %arg
764 define float @clamp_fabs_ole_largest_denormal_0.0(float %arg) {
765 ; CHECK-LABEL: define nofpclass(nzero) float @clamp_fabs_ole_largest_denormal_0.0(
766 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
767 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
768 ; CHECK-NEXT: [[IS_FABS_OLE_LARGEST_DENORMAL:%.*]] = fcmp ole float [[FABS_ARG]], 0x380FFFFFC0000000
769 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_FABS_OLE_LARGEST_DENORMAL]], float 0.000000e+00, float [[ARG]]
770 ; CHECK-NEXT: ret float [[SELECT]]
772 %fabs.arg = call float @llvm.fabs.f32(float %arg)
773 %is.fabs.ole.largest.denormal = fcmp ole float %fabs.arg, 0x380FFFFFC0000000
774 %select = select i1 %is.fabs.ole.largest.denormal, float 0.0, float %arg
778 ;---------------------------------------------------------------------
779 ; clamp fabs to 1 copysign
780 ;---------------------------------------------------------------------
783 define float @clamp_fabs_value_ogt_1_to_1_copysign(float %arg) {
784 ; CHECK-LABEL: define nofpclass(inf) float @clamp_fabs_value_ogt_1_to_1_copysign(
785 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
786 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
787 ; CHECK-NEXT: [[FABS_IS_OGT_1:%.*]] = fcmp ogt float [[FABS_ARG]], 1.000000e+00
788 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
789 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OGT_1]], float [[COPYSIGN]], float [[ARG]]
790 ; CHECK-NEXT: ret float [[SELECT]]
792 %fabs.arg = call float @llvm.fabs.f32(float %arg)
793 %fabs.is.ogt.1 = fcmp ogt float %fabs.arg, 1.0
794 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
795 %select = select i1 %fabs.is.ogt.1, float %copysign, float %arg
800 define float @clamp_fabs_value_oge_1_to_1_copysign(float %arg) {
801 ; CHECK-LABEL: define nofpclass(inf) float @clamp_fabs_value_oge_1_to_1_copysign(
802 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
803 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
804 ; CHECK-NEXT: [[FABS_IS_OGE_1:%.*]] = fcmp oge float [[FABS_ARG]], 1.000000e+00
805 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
806 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OGE_1]], float [[COPYSIGN]], float [[ARG]]
807 ; CHECK-NEXT: ret float [[SELECT]]
809 %fabs.arg = call float @llvm.fabs.f32(float %arg)
810 %fabs.is.oge.1 = fcmp oge float %fabs.arg, 1.0
811 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
812 %select = select i1 %fabs.is.oge.1, float %copysign, float %arg
816 ; can't be inf or nan
817 define float @clamp_fabs_value_olt_1_to_1_copysign(float %arg) {
818 ; CHECK-LABEL: define nofpclass(nan inf) float @clamp_fabs_value_olt_1_to_1_copysign(
819 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
820 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
821 ; CHECK-NEXT: [[FABS_IS_OLT_1:%.*]] = fcmp olt float [[FABS_ARG]], 1.000000e+00
822 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
823 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OLT_1]], float [[ARG]], float [[COPYSIGN]]
824 ; CHECK-NEXT: ret float [[SELECT]]
826 %fabs.arg = call float @llvm.fabs.f32(float %arg)
827 %fabs.is.olt.1 = fcmp olt float %fabs.arg, 1.0
828 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
829 %select = select i1 %fabs.is.olt.1, float %arg, float %copysign
833 ; can't be inf or nan
834 define float @clamp_fabs_value_ole_1_to_1_copysign(float %arg) {
835 ; CHECK-LABEL: define nofpclass(nan inf) float @clamp_fabs_value_ole_1_to_1_copysign(
836 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
837 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
838 ; CHECK-NEXT: [[FABS_IS_OLE_1:%.*]] = fcmp ole float [[FABS_ARG]], 1.000000e+00
839 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
840 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OLE_1]], float [[ARG]], float [[COPYSIGN]]
841 ; CHECK-NEXT: ret float [[SELECT]]
843 %fabs.arg = call float @llvm.fabs.f32(float %arg)
844 %fabs.is.ole.1 = fcmp ole float %fabs.arg, 1.0
845 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
846 %select = select i1 %fabs.is.ole.1, float %arg, float %copysign
850 ; can't be inf or nan
851 define float @clamp_fabs_value_ugt_1_to_1_copysign(float %arg) {
852 ; CHECK-LABEL: define nofpclass(nan inf) float @clamp_fabs_value_ugt_1_to_1_copysign(
853 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
854 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
855 ; CHECK-NEXT: [[FABS_IS_UGT_1:%.*]] = fcmp ugt float [[FABS_ARG]], 1.000000e+00
856 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
857 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_UGT_1]], float [[COPYSIGN]], float [[ARG]]
858 ; CHECK-NEXT: ret float [[SELECT]]
860 %fabs.arg = call float @llvm.fabs.f32(float %arg)
861 %fabs.is.ugt.1 = fcmp ugt float %fabs.arg, 1.0
862 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
863 %select = select i1 %fabs.is.ugt.1, float %copysign, float %arg
867 ; can't be inf or nan
868 define float @clamp_fabs_value_uge_1_to_1_copysign(float %arg) {
869 ; CHECK-LABEL: define nofpclass(nan inf) float @clamp_fabs_value_uge_1_to_1_copysign(
870 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
871 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
872 ; CHECK-NEXT: [[FABS_IS_UGE_1:%.*]] = fcmp ugt float [[FABS_ARG]], 1.000000e+00
873 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
874 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_UGE_1]], float [[COPYSIGN]], float [[ARG]]
875 ; CHECK-NEXT: ret float [[SELECT]]
877 %fabs.arg = call float @llvm.fabs.f32(float %arg)
878 %fabs.is.uge.1 = fcmp ugt float %fabs.arg, 1.0
879 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
880 %select = select i1 %fabs.is.uge.1, float %copysign, float %arg
885 define float @clamp_fabs_value_ult_1_to_1_copysign(float %arg) {
886 ; CHECK-LABEL: define nofpclass(inf) float @clamp_fabs_value_ult_1_to_1_copysign(
887 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
888 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
889 ; CHECK-NEXT: [[FABS_IS_ULT_1:%.*]] = fcmp ult float [[FABS_ARG]], 1.000000e+00
890 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
891 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ULT_1]], float [[ARG]], float [[COPYSIGN]]
892 ; CHECK-NEXT: ret float [[SELECT]]
894 %fabs.arg = call float @llvm.fabs.f32(float %arg)
895 %fabs.is.ult.1 = fcmp ult float %fabs.arg, 1.0
896 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
897 %select = select i1 %fabs.is.ult.1, float %arg, float %copysign
902 define float @clamp_fabs_value_ule_1_to_1_copysign(float %arg) {
903 ; CHECK-LABEL: define nofpclass(inf) float @clamp_fabs_value_ule_1_to_1_copysign(
904 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
905 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
906 ; CHECK-NEXT: [[FABS_IS_ULE_1:%.*]] = fcmp ule float [[FABS_ARG]], 1.000000e+00
907 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
908 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ULE_1]], float [[ARG]], float [[COPYSIGN]]
909 ; CHECK-NEXT: ret float [[SELECT]]
911 %fabs.arg = call float @llvm.fabs.f32(float %arg)
912 %fabs.is.ule.1 = fcmp ule float %fabs.arg, 1.0
913 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
914 %select = select i1 %fabs.is.ule.1, float %arg, float %copysign
918 ;---------------------------------------------------------------------
919 ; compare to largest normal
920 ;---------------------------------------------------------------------
923 define float @clamp_is_ogt_largest_normal_to_largest_normal(float %arg) {
924 ; CHECK-LABEL: define nofpclass(pinf) float @clamp_is_ogt_largest_normal_to_largest_normal(
925 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
926 ; CHECK-NEXT: [[IS_OGT_LARGEST_NORMAL:%.*]] = fcmp ogt float [[ARG]], 0x47EFFFFFE0000000
927 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
928 ; CHECK-NEXT: ret float [[SELECT]]
930 %is.ogt.largest.normal = fcmp ogt float %arg, 0x47EFFFFFE0000000
931 %select = select i1 %is.ogt.largest.normal, float 0x47EFFFFFE0000000, float %arg
936 define float @clamp_is_oge_largest_normal_to_largest_normal(float %arg) {
937 ; CHECK-LABEL: define nofpclass(pinf) float @clamp_is_oge_largest_normal_to_largest_normal(
938 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
939 ; CHECK-NEXT: [[IS_OGE_LARGEST_NORMAL:%.*]] = fcmp oge float [[ARG]], 0x47EFFFFFE0000000
940 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
941 ; CHECK-NEXT: ret float [[SELECT]]
943 %is.oge.largest.normal = fcmp oge float %arg, 0x47EFFFFFE0000000
944 %select = select i1 %is.oge.largest.normal, float 0x47EFFFFFE0000000, float %arg
948 ; Can't be +inf or nan
949 define float @clamp_is_ugt_largest_normal_to_largest_normal(float %arg) {
950 ; CHECK-LABEL: define nofpclass(nan pinf) float @clamp_is_ugt_largest_normal_to_largest_normal(
951 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
952 ; CHECK-NEXT: [[IS_UGT_LARGEST_NORMAL:%.*]] = fcmp ugt float [[ARG]], 0x47EFFFFFE0000000
953 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
954 ; CHECK-NEXT: ret float [[SELECT]]
956 %is.ugt.largest.normal = fcmp ugt float %arg, 0x47EFFFFFE0000000
957 %select = select i1 %is.ugt.largest.normal, float 0x47EFFFFFE0000000, float %arg
961 ; Can't be +inf or nan
962 define float @clamp_is_uge_largest_normal_to_largest_normal(float %arg) {
963 ; CHECK-LABEL: define nofpclass(nan pinf) float @clamp_is_uge_largest_normal_to_largest_normal(
964 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
965 ; CHECK-NEXT: [[IS_UGE_LARGEST_NORMAL:%.*]] = fcmp uge float [[ARG]], 0x47EFFFFFE0000000
966 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGE_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
967 ; CHECK-NEXT: ret float [[SELECT]]
969 %is.uge.largest.normal = fcmp uge float %arg, 0x47EFFFFFE0000000
970 %select = select i1 %is.uge.largest.normal, float 0x47EFFFFFE0000000, float %arg
974 ; Can't be +inf or -inf
975 define float @clamp_fabs_is_ogt_largest_normal_to_largest_normal(float %arg) {
976 ; CHECK-LABEL: define nofpclass(inf) float @clamp_fabs_is_ogt_largest_normal_to_largest_normal(
977 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
978 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
979 ; CHECK-NEXT: [[IS_OGT_LARGEST_NORMAL:%.*]] = fcmp ogt float [[FABS_ARG]], 0x47EFFFFFE0000000
980 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
981 ; CHECK-NEXT: ret float [[SELECT]]
983 %fabs.arg = call float @llvm.fabs.f32(float %arg)
984 %is.ogt.largest.normal = fcmp ogt float %fabs.arg, 0x47EFFFFFE0000000
985 %select = select i1 %is.ogt.largest.normal, float 0x47EFFFFFE0000000, float %arg
989 ; Can't be +inf or -inf
990 define float @clamp_fabs_is_oge_largest_normal_to_largest_normal(float %arg) {
991 ; CHECK-LABEL: define nofpclass(inf) float @clamp_fabs_is_oge_largest_normal_to_largest_normal(
992 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
993 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
994 ; CHECK-NEXT: [[IS_OGE_LARGEST_NORMAL:%.*]] = fcmp oge float [[FABS_ARG]], 0x47EFFFFFE0000000
995 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
996 ; CHECK-NEXT: ret float [[SELECT]]
998 %fabs.arg = call float @llvm.fabs.f32(float %arg)
999 %is.oge.largest.normal = fcmp oge float %fabs.arg, 0x47EFFFFFE0000000
1000 %select = select i1 %is.oge.largest.normal, float 0x47EFFFFFE0000000, float %arg
1004 ; Can't be +inf or -inf or nan
1005 define float @clamp_fabs_is_ugt_largest_normal_to_largest_normal(float %arg) {
1006 ; CHECK-LABEL: define nofpclass(nan inf) float @clamp_fabs_is_ugt_largest_normal_to_largest_normal(
1007 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1008 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1009 ; CHECK-NEXT: [[IS_UGT_LARGEST_NORMAL:%.*]] = fcmp ugt float [[FABS_ARG]], 0x47EFFFFFE0000000
1010 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
1011 ; CHECK-NEXT: ret float [[SELECT]]
1013 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1014 %is.ugt.largest.normal = fcmp ugt float %fabs.arg, 0x47EFFFFFE0000000
1015 %select = select i1 %is.ugt.largest.normal, float 0x47EFFFFFE0000000, float %arg
1019 ; Can't be +inf or -inf or nan
1020 define float @clamp_fabs_is_uge_largest_normal_to_largest_normal(float %arg) {
1021 ; CHECK-LABEL: define nofpclass(nan inf) float @clamp_fabs_is_uge_largest_normal_to_largest_normal(
1022 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1023 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1024 ; CHECK-NEXT: [[IS_UGT_LARGEST_NORMAL:%.*]] = fcmp uge float [[FABS_ARG]], 0x47EFFFFFE0000000
1025 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
1026 ; CHECK-NEXT: ret float [[SELECT]]
1028 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1029 %is.ugt.largest.normal = fcmp uge float %fabs.arg, 0x47EFFFFFE0000000
1030 %select = select i1 %is.ugt.largest.normal, float 0x47EFFFFFE0000000, float %arg
1034 ;---------------------------------------------------------------------
1035 ; compare to smallest normal
1036 ;---------------------------------------------------------------------
1038 ; can't be negative or positive subnormal
1039 define float @clamp_fabs_ogt_smallest_normal_to_zero(float %arg) {
1040 ; CHECK-LABEL: define nofpclass(inf) float @clamp_fabs_ogt_smallest_normal_to_zero(
1041 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1042 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1043 ; CHECK-NEXT: [[IS_OGT_SMALLEST_NORMAL:%.*]] = fcmp ogt float [[FABS_ARG]], 0x3810000000000000
1044 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1045 ; CHECK-NEXT: ret float [[SELECT]]
1048 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1049 %is.ogt.smallest.normal = fcmp ogt float %fabs.arg, 0x3810000000000000
1050 %select = select i1 %is.ogt.smallest.normal, float 0.0, float %arg
1054 ; can't be negative or positive subnormal
1055 define float @clamp_fabs_oge_smallest_normal_to_zero(float %arg) {
1056 ; CHECK-LABEL: define nofpclass(inf norm) float @clamp_fabs_oge_smallest_normal_to_zero(
1057 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1058 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1059 ; CHECK-NEXT: [[IS_OGE_SMALLEST_NORMAL:%.*]] = fcmp oge float [[FABS_ARG]], 0x3810000000000000
1060 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1061 ; CHECK-NEXT: ret float [[SELECT]]
1063 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1064 %is.oge.smallest.normal = fcmp oge float %fabs.arg, 0x3810000000000000
1065 %select = select i1 %is.oge.smallest.normal, float 0.0, float %arg
1069 ; can't be negative or subnormal
1070 define float @clamp_fabs_olt_smallest_normal_to_zero(float %arg) {
1071 ; CHECK-LABEL: define nofpclass(nzero sub) float @clamp_fabs_olt_smallest_normal_to_zero(
1072 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1073 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1074 ; CHECK-NEXT: [[IS_OLT_SMALLEST_NORMAL:%.*]] = fcmp olt float [[FABS_ARG]], 0x3810000000000000
1075 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1076 ; CHECK-NEXT: ret float [[SELECT]]
1078 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1079 %is.olt.smallest.normal = fcmp olt float %fabs.arg, 0x3810000000000000
1080 %select = select i1 %is.olt.smallest.normal, float 0.0, float %arg
1084 ; can't be negative or subnormal
1085 define float @clamp_fabs_ole_smallest_normal_to_zero(float %arg) {
1086 ; CHECK-LABEL: define nofpclass(nzero sub) float @clamp_fabs_ole_smallest_normal_to_zero(
1087 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1088 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1089 ; CHECK-NEXT: [[IS_OLE_SMALLEST_NORMAL:%.*]] = fcmp ole float [[FABS_ARG]], 0x3810000000000000
1090 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1091 ; CHECK-NEXT: ret float [[SELECT]]
1093 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1094 %is.ole.smallest.normal = fcmp ole float %fabs.arg, 0x3810000000000000
1095 %select = select i1 %is.ole.smallest.normal, float 0.0, float %arg
1099 define float @clamp_fabs_is_is_olt_smallest_normal_to_0(float %arg) {
1100 ; CHECK-LABEL: define nofpclass(nzero sub) float @clamp_fabs_is_is_olt_smallest_normal_to_0(
1101 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1102 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1103 ; CHECK-NEXT: [[IS_OLT_SMALLEST_NORMAL:%.*]] = fcmp olt float [[FABS_ARG]], 0x3810000000000000
1104 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1105 ; CHECK-NEXT: ret float [[SELECT]]
1107 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1108 %is.olt.smallest.normal = fcmp olt float %fabs.arg, 0x3810000000000000
1109 %select = select i1 %is.olt.smallest.normal, float 0.0, float %arg
1113 define float @clamp_fabs_is_is_ole_smallest_normal_to_0(float %arg) {
1114 ; CHECK-LABEL: define nofpclass(nzero sub) float @clamp_fabs_is_is_ole_smallest_normal_to_0(
1115 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1116 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1117 ; CHECK-NEXT: [[IS_OLE_SMALLEST_NORMAL:%.*]] = fcmp ole float [[FABS_ARG]], 0x3810000000000000
1118 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1119 ; CHECK-NEXT: ret float [[SELECT]]
1121 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1122 %is.ole.smallest.normal = fcmp ole float %fabs.arg, 0x3810000000000000
1123 %select = select i1 %is.ole.smallest.normal, float 0.0, float %arg
1127 define float @clamp_fabs_oeq_smallest_normal_to_zero(float %arg) {
1128 ; CHECK-LABEL: define float @clamp_fabs_oeq_smallest_normal_to_zero(
1129 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1130 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1131 ; CHECK-NEXT: [[IS_OEQ_SMALLEST_NORMAL:%.*]] = fcmp oeq float [[FABS_ARG]], 0x3810000000000000
1132 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OEQ_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1133 ; CHECK-NEXT: ret float [[SELECT]]
1135 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1136 %is.oeq.smallest.normal = fcmp oeq float %fabs.arg, 0x3810000000000000
1137 %select = select i1 %is.oeq.smallest.normal, float 0.0, float %arg
1141 define float @clamp_fabs_one_smallest_normal_to_zero(float %arg) {
1142 ; CHECK-LABEL: define nofpclass(inf nzero sub) float @clamp_fabs_one_smallest_normal_to_zero(
1143 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1144 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1145 ; CHECK-NEXT: [[IS_ONE_SMALLEST_NORMAL:%.*]] = fcmp one float [[FABS_ARG]], 0x3810000000000000
1146 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ONE_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1147 ; CHECK-NEXT: ret float [[SELECT]]
1149 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1150 %is.one.smallest.normal = fcmp one float %fabs.arg, 0x3810000000000000
1151 %select = select i1 %is.one.smallest.normal, float 0.0, float %arg
1155 define float @clamp_fabs_ueq_smallest_normal_to_zero(float %arg) {
1156 ; CHECK-LABEL: define nofpclass(nan) float @clamp_fabs_ueq_smallest_normal_to_zero(
1157 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1158 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1159 ; CHECK-NEXT: [[IS_UEQ_SMALLEST_NORMAL:%.*]] = fcmp ueq float [[FABS_ARG]], 0x3810000000000000
1160 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UEQ_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1161 ; CHECK-NEXT: ret float [[SELECT]]
1163 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1164 %is.ueq.smallest.normal = fcmp ueq float %fabs.arg, 0x3810000000000000
1165 %select = select i1 %is.ueq.smallest.normal, float 0.0, float %arg
1169 define float @clamp_fabs_une_smallest_normal_to_zero(float %arg) {
1170 ; CHECK-LABEL: define nofpclass(nan inf nzero sub) float @clamp_fabs_une_smallest_normal_to_zero(
1171 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1172 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1173 ; CHECK-NEXT: [[IS_UNE_SMALLEST_NORMAL:%.*]] = fcmp une float [[FABS_ARG]], 0x3810000000000000
1174 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UNE_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1175 ; CHECK-NEXT: ret float [[SELECT]]
1177 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1178 %is.une.smallest.normal = fcmp une float %fabs.arg, 0x3810000000000000
1179 %select = select i1 %is.une.smallest.normal, float 0.0, float %arg
1183 ;---------------------------------------------------------------------
1184 ; compare fabs to negative normal
1185 ;---------------------------------------------------------------------
1187 define float @clamp_fabs_olt_neg1_to_neg1(float %arg) {
1188 ; CHECK-LABEL: define float @clamp_fabs_olt_neg1_to_neg1(
1189 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
1190 ; CHECK-NEXT: ret float [[ARG]]
1192 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1193 %fabs.is.olt.neg1 = fcmp olt float %fabs.arg, -1.0
1194 %select = select i1 %fabs.is.olt.neg1, float -1.0, float %arg
1198 define float @clamp_fabs_ole_neg1_to_neg1(float %arg) {
1199 ; CHECK-LABEL: define float @clamp_fabs_ole_neg1_to_neg1(
1200 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
1201 ; CHECK-NEXT: ret float [[ARG]]
1203 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1204 %fabs.is.ole.neg1 = fcmp ole float %fabs.arg, -1.0
1205 %select = select i1 %fabs.is.ole.neg1, float -1.0, float %arg
1209 define float @clamp_fabs_ult_neg1_to_neg1(float %arg) {
1210 ; CHECK-LABEL: define nofpclass(nan) float @clamp_fabs_ult_neg1_to_neg1(
1211 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1212 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1213 ; CHECK-NEXT: [[FABS_IS_ULT_NEG1:%.*]] = fcmp ult float [[FABS_ARG]], -1.000000e+00
1214 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ULT_NEG1]], float -1.000000e+00, float [[ARG]]
1215 ; CHECK-NEXT: ret float [[SELECT]]
1217 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1218 %fabs.is.ult.neg1 = fcmp ult float %fabs.arg, -1.0
1219 %select = select i1 %fabs.is.ult.neg1, float -1.0, float %arg
1223 define float @clamp_fabs_ule_neg1_to_neg1(float %arg) {
1224 ; CHECK-LABEL: define nofpclass(nan) float @clamp_fabs_ule_neg1_to_neg1(
1225 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1226 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1227 ; CHECK-NEXT: [[FABS_IS_ULE_NEG1:%.*]] = fcmp ule float [[FABS_ARG]], -1.000000e+00
1228 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ULE_NEG1]], float -1.000000e+00, float [[ARG]]
1229 ; CHECK-NEXT: ret float [[SELECT]]
1231 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1232 %fabs.is.ule.neg1 = fcmp ule float %fabs.arg, -1.0
1233 %select = select i1 %fabs.is.ule.neg1, float -1.0, float %arg
1237 define float @clamp_fabs_ogt_neg1_to_neg1(float %arg) {
1238 ; CHECK-LABEL: define nofpclass(inf zero sub pnorm) float @clamp_fabs_ogt_neg1_to_neg1(
1239 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1240 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1241 ; CHECK-NEXT: [[FABS_IS_OGT_NEG1:%.*]] = fcmp ogt float [[FABS_ARG]], -1.000000e+00
1242 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OGT_NEG1]], float -1.000000e+00, float [[ARG]]
1243 ; CHECK-NEXT: ret float [[SELECT]]
1245 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1246 %fabs.is.ogt.neg1 = fcmp ogt float %fabs.arg, -1.0
1247 %select = select i1 %fabs.is.ogt.neg1, float -1.0, float %arg
1251 define float @clamp_fabs_oge_neg1_to_neg1(float %arg) {
1252 ; CHECK-LABEL: define nofpclass(inf zero sub pnorm) float @clamp_fabs_oge_neg1_to_neg1(
1253 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1254 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1255 ; CHECK-NEXT: [[FABS_IS_OGE_NEG1:%.*]] = fcmp oge float [[FABS_ARG]], -1.000000e+00
1256 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OGE_NEG1]], float -1.000000e+00, float [[ARG]]
1257 ; CHECK-NEXT: ret float [[SELECT]]
1259 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1260 %fabs.is.oge.neg1 = fcmp oge float %fabs.arg, -1.0
1261 %select = select i1 %fabs.is.oge.neg1, float -1.0, float %arg
1265 define float @clamp_fabs_ugt_neg1_to_neg1(float %arg) {
1266 ; CHECK-LABEL: define noundef nofpclass(nan inf zero sub pnorm) float @clamp_fabs_ugt_neg1_to_neg1(
1267 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1268 ; CHECK-NEXT: ret float -1.000000e+00
1270 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1271 %fabs.is.ugt.neg1 = fcmp ugt float %fabs.arg, -1.0
1272 %select = select i1 %fabs.is.ugt.neg1, float -1.0, float %arg
1276 define float @clamp_fabs_uge_neg1_to_neg1(float %arg) {
1277 ; CHECK-LABEL: define noundef nofpclass(nan inf zero sub pnorm) float @clamp_fabs_uge_neg1_to_neg1(
1278 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1279 ; CHECK-NEXT: ret float -1.000000e+00
1281 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1282 %fabs.is.uge.neg1 = fcmp uge float %fabs.arg, -1.0
1283 %select = select i1 %fabs.is.uge.neg1, float -1.0, float %arg
1287 define float @clamp_fabs_oeq_neg1_to_neg1(float %arg) {
1288 ; CHECK-LABEL: define float @clamp_fabs_oeq_neg1_to_neg1(
1289 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
1290 ; CHECK-NEXT: ret float [[ARG]]
1292 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1293 %fabs.is.oeq.neg1 = fcmp oeq float %fabs.arg, -1.0
1294 %select = select i1 %fabs.is.oeq.neg1, float -1.0, float %arg
1298 define float @clamp_fabs_ueq_neg1_to_neg1(float %arg) {
1299 ; CHECK-LABEL: define nofpclass(nan) float @clamp_fabs_ueq_neg1_to_neg1(
1300 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1301 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1302 ; CHECK-NEXT: [[FABS_IS_UEQ_NEG1:%.*]] = fcmp ueq float [[FABS_ARG]], -1.000000e+00
1303 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_UEQ_NEG1]], float -1.000000e+00, float [[ARG]]
1304 ; CHECK-NEXT: ret float [[SELECT]]
1306 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1307 %fabs.is.ueq.neg1 = fcmp ueq float %fabs.arg, -1.0
1308 %select = select i1 %fabs.is.ueq.neg1, float -1.0, float %arg
1312 define float @clamp_fabs_one_neg1_to_neg1(float %arg) {
1313 ; CHECK-LABEL: define nofpclass(inf zero sub pnorm) float @clamp_fabs_one_neg1_to_neg1(
1314 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1315 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1316 ; CHECK-NEXT: [[FABS_IS_ONE_NEG1:%.*]] = fcmp one float [[FABS_ARG]], -1.000000e+00
1317 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ONE_NEG1]], float -1.000000e+00, float [[ARG]]
1318 ; CHECK-NEXT: ret float [[SELECT]]
1320 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1321 %fabs.is.one.neg1 = fcmp one float %fabs.arg, -1.0
1322 %select = select i1 %fabs.is.one.neg1, float -1.0, float %arg
1326 define float @clamp_fabs_une_neg1_to_neg1(float %arg) {
1327 ; CHECK-LABEL: define noundef nofpclass(nan inf zero sub pnorm) float @clamp_fabs_une_neg1_to_neg1(
1328 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
1329 ; CHECK-NEXT: ret float -1.000000e+00
1331 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1332 %fabs.is.une.neg1 = fcmp une float %fabs.arg, -1.0
1333 %select = select i1 %fabs.is.une.neg1, float -1.0, float %arg
1337 ;---------------------------------------------------------------------
1338 ; assume > < to normal
1339 ;---------------------------------------------------------------------
1341 define float @ret_assumed_ogt_1(float %arg) {
1342 ; CHECK-LABEL: define float @ret_assumed_ogt_1(
1343 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3:[0-9]+]] {
1344 ; CHECK-NEXT: [[OGT_1:%.*]] = fcmp ogt float [[ARG]], 1.000000e+00
1345 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_1]]) #[[ATTR5:[0-9]+]]
1346 ; CHECK-NEXT: ret float [[ARG]]
1348 %ogt.1 = fcmp ogt float %arg, 1.0
1349 call void @llvm.assume(i1 %ogt.1)
1353 define float @ret_assumed_oge_1(float %arg) {
1354 ; CHECK-LABEL: define float @ret_assumed_oge_1(
1355 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1356 ; CHECK-NEXT: [[OGE_1:%.*]] = fcmp ogt float [[ARG]], 1.000000e+00
1357 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_1]]) #[[ATTR5]]
1358 ; CHECK-NEXT: ret float [[ARG]]
1360 %oge.1 = fcmp ogt float %arg, 1.0
1361 call void @llvm.assume(i1 %oge.1)
1365 define float @ret_assumed_olt_1(float %arg) {
1366 ; CHECK-LABEL: define float @ret_assumed_olt_1(
1367 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1368 ; CHECK-NEXT: [[OLT_1:%.*]] = fcmp olt float [[ARG]], 1.000000e+00
1369 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLT_1]]) #[[ATTR5]]
1370 ; CHECK-NEXT: ret float [[ARG]]
1372 %olt.1 = fcmp olt float %arg, 1.0
1373 call void @llvm.assume(i1 %olt.1)
1377 define float @ret_assumed_ole_1(float %arg) {
1378 ; CHECK-LABEL: define float @ret_assumed_ole_1(
1379 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1380 ; CHECK-NEXT: [[OLE_1:%.*]] = fcmp ole float [[ARG]], 1.000000e+00
1381 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLE_1]]) #[[ATTR5]]
1382 ; CHECK-NEXT: ret float [[ARG]]
1384 %ole.1 = fcmp ole float %arg, 1.0
1385 call void @llvm.assume(i1 %ole.1)
1389 define float @ret_assumed_ugt_1(float %arg) {
1390 ; CHECK-LABEL: define float @ret_assumed_ugt_1(
1391 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1392 ; CHECK-NEXT: [[UGT_1:%.*]] = fcmp ugt float [[ARG]], 1.000000e+00
1393 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_1]]) #[[ATTR5]]
1394 ; CHECK-NEXT: ret float [[ARG]]
1396 %ugt.1 = fcmp ugt float %arg, 1.0
1397 call void @llvm.assume(i1 %ugt.1)
1401 define float @ret_assumed_uge_1(float %arg) {
1402 ; CHECK-LABEL: define float @ret_assumed_uge_1(
1403 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1404 ; CHECK-NEXT: [[UGE_1:%.*]] = fcmp uge float [[ARG]], 1.000000e+00
1405 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_1]]) #[[ATTR5]]
1406 ; CHECK-NEXT: ret float [[ARG]]
1408 %uge.1 = fcmp uge float %arg, 1.0
1409 call void @llvm.assume(i1 %uge.1)
1413 define float @ret_assumed_ult_1(float %arg) {
1414 ; CHECK-LABEL: define float @ret_assumed_ult_1(
1415 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1416 ; CHECK-NEXT: [[ULT_1:%.*]] = fcmp ult float [[ARG]], 1.000000e+00
1417 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULT_1]]) #[[ATTR5]]
1418 ; CHECK-NEXT: ret float [[ARG]]
1420 %ult.1 = fcmp ult float %arg, 1.0
1421 call void @llvm.assume(i1 %ult.1)
1425 define float @ret_assumed_ule_1(float %arg) {
1426 ; CHECK-LABEL: define float @ret_assumed_ule_1(
1427 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1428 ; CHECK-NEXT: [[ULE_1:%.*]] = fcmp ule float [[ARG]], 1.000000e+00
1429 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULE_1]]) #[[ATTR5]]
1430 ; CHECK-NEXT: ret float [[ARG]]
1432 %ule.1 = fcmp ule float %arg, 1.0
1433 call void @llvm.assume(i1 %ule.1)
1437 define float @ret_assumed_fabs_ogt_1(float %arg) {
1438 ; CHECK-LABEL: define float @ret_assumed_fabs_ogt_1(
1439 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1440 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1441 ; CHECK-NEXT: [[OGT_1:%.*]] = fcmp ogt float [[ARG_FABS]], 1.000000e+00
1442 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_1]]) #[[ATTR5]]
1443 ; CHECK-NEXT: ret float [[ARG]]
1445 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1446 %ogt.1 = fcmp ogt float %arg.fabs, 1.0
1447 call void @llvm.assume(i1 %ogt.1)
1451 define float @ret_assumed_fabs_oge_1(float %arg) {
1452 ; CHECK-LABEL: define float @ret_assumed_fabs_oge_1(
1453 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1454 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1455 ; CHECK-NEXT: [[OGE_1:%.*]] = fcmp oge float [[ARG_FABS]], 1.000000e+00
1456 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_1]]) #[[ATTR5]]
1457 ; CHECK-NEXT: ret float [[ARG]]
1459 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1460 %oge.1 = fcmp oge float %arg.fabs, 1.0
1461 call void @llvm.assume(i1 %oge.1)
1465 define float @ret_assumed_fabs_olt_1(float %arg) {
1466 ; CHECK-LABEL: define float @ret_assumed_fabs_olt_1(
1467 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1468 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1469 ; CHECK-NEXT: [[OLT_1:%.*]] = fcmp olt float [[ARG_FABS]], 1.000000e+00
1470 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLT_1]]) #[[ATTR5]]
1471 ; CHECK-NEXT: ret float [[ARG]]
1473 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1474 %olt.1 = fcmp olt float %arg.fabs, 1.0
1475 call void @llvm.assume(i1 %olt.1)
1479 define float @ret_assumed_fabs_ole_1(float %arg) {
1480 ; CHECK-LABEL: define float @ret_assumed_fabs_ole_1(
1481 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1482 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1483 ; CHECK-NEXT: [[OLE_1:%.*]] = fcmp olt float [[ARG_FABS]], 1.000000e+00
1484 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLE_1]]) #[[ATTR5]]
1485 ; CHECK-NEXT: ret float [[ARG]]
1487 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1488 %ole.1 = fcmp olt float %arg.fabs, 1.0
1489 call void @llvm.assume(i1 %ole.1)
1493 define float @ret_assumed_fabs_ugt_1(float %arg) {
1494 ; CHECK-LABEL: define float @ret_assumed_fabs_ugt_1(
1495 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1496 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1497 ; CHECK-NEXT: [[UGT_1:%.*]] = fcmp ugt float [[ARG_FABS]], 1.000000e+00
1498 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_1]]) #[[ATTR5]]
1499 ; CHECK-NEXT: ret float [[ARG]]
1501 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1502 %ugt.1 = fcmp ugt float %arg.fabs, 1.0
1503 call void @llvm.assume(i1 %ugt.1)
1507 define float @ret_assumed_fabs_uge_1(float %arg) {
1508 ; CHECK-LABEL: define float @ret_assumed_fabs_uge_1(
1509 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1510 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1511 ; CHECK-NEXT: [[UGE_1:%.*]] = fcmp ugt float [[ARG_FABS]], 1.000000e+00
1512 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_1]]) #[[ATTR5]]
1513 ; CHECK-NEXT: ret float [[ARG]]
1515 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1516 %uge.1 = fcmp ugt float %arg.fabs, 1.0
1517 call void @llvm.assume(i1 %uge.1)
1521 define float @ret_assumed_fabs_ult_1(float %arg) {
1522 ; CHECK-LABEL: define float @ret_assumed_fabs_ult_1(
1523 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1524 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1525 ; CHECK-NEXT: [[ULT_1:%.*]] = fcmp ult float [[ARG_FABS]], 1.000000e+00
1526 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULT_1]]) #[[ATTR5]]
1527 ; CHECK-NEXT: ret float [[ARG]]
1529 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1530 %ult.1 = fcmp ult float %arg.fabs, 1.0
1531 call void @llvm.assume(i1 %ult.1)
1535 define float @ret_assumed_fabs_ule_1(float %arg) {
1536 ; CHECK-LABEL: define float @ret_assumed_fabs_ule_1(
1537 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1538 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1539 ; CHECK-NEXT: [[ULE_1:%.*]] = fcmp ule float [[ARG_FABS]], 1.000000e+00
1540 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULE_1]]) #[[ATTR5]]
1541 ; CHECK-NEXT: ret float [[ARG]]
1543 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1544 %ule.1 = fcmp ule float %arg.fabs, 1.0
1545 call void @llvm.assume(i1 %ule.1)
1549 define float @ret_assumed_ogt_neg1(float %arg) {
1550 ; CHECK-LABEL: define float @ret_assumed_ogt_neg1(
1551 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1552 ; CHECK-NEXT: [[OGT_NEG1:%.*]] = fcmp ogt float [[ARG]], -1.000000e+00
1553 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_NEG1]]) #[[ATTR5]]
1554 ; CHECK-NEXT: ret float [[ARG]]
1556 %ogt.neg1 = fcmp ogt float %arg, -1.0
1557 call void @llvm.assume(i1 %ogt.neg1)
1561 define float @ret_assumed_oge_neg1(float %arg) {
1562 ; CHECK-LABEL: define float @ret_assumed_oge_neg1(
1563 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1564 ; CHECK-NEXT: [[OGE_NEG1:%.*]] = fcmp ogt float [[ARG]], -1.000000e+00
1565 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_NEG1]]) #[[ATTR5]]
1566 ; CHECK-NEXT: ret float [[ARG]]
1568 %oge.neg1 = fcmp ogt float %arg, -1.0
1569 call void @llvm.assume(i1 %oge.neg1)
1573 define float @ret_assumed_olt_neg1(float %arg) {
1574 ; CHECK-LABEL: define float @ret_assumed_olt_neg1(
1575 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1576 ; CHECK-NEXT: [[OLT_NEG1:%.*]] = fcmp olt float [[ARG]], -1.000000e+00
1577 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLT_NEG1]]) #[[ATTR5]]
1578 ; CHECK-NEXT: ret float [[ARG]]
1580 %olt.neg1 = fcmp olt float %arg, -1.0
1581 call void @llvm.assume(i1 %olt.neg1)
1585 define float @ret_assumed_ole_neg1(float %arg) {
1586 ; CHECK-LABEL: define float @ret_assumed_ole_neg1(
1587 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1588 ; CHECK-NEXT: [[OLE_NEG1:%.*]] = fcmp ole float [[ARG]], -1.000000e+00
1589 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLE_NEG1]]) #[[ATTR5]]
1590 ; CHECK-NEXT: ret float [[ARG]]
1592 %ole.neg1 = fcmp ole float %arg, -1.0
1593 call void @llvm.assume(i1 %ole.neg1)
1597 define float @ret_assumed_ugt_neg1(float %arg) {
1598 ; CHECK-LABEL: define float @ret_assumed_ugt_neg1(
1599 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1600 ; CHECK-NEXT: [[UGT_NEG1:%.*]] = fcmp ugt float [[ARG]], -1.000000e+00
1601 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_NEG1]]) #[[ATTR5]]
1602 ; CHECK-NEXT: ret float [[ARG]]
1604 %ugt.neg1 = fcmp ugt float %arg, -1.0
1605 call void @llvm.assume(i1 %ugt.neg1)
1609 define float @ret_assumed_uge_neg1(float %arg) {
1610 ; CHECK-LABEL: define float @ret_assumed_uge_neg1(
1611 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1612 ; CHECK-NEXT: [[UGE_NEG1:%.*]] = fcmp uge float [[ARG]], -1.000000e+00
1613 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_NEG1]]) #[[ATTR5]]
1614 ; CHECK-NEXT: ret float [[ARG]]
1616 %uge.neg1 = fcmp uge float %arg, -1.0
1617 call void @llvm.assume(i1 %uge.neg1)
1621 define float @ret_assumed_ult_neg1(float %arg) {
1622 ; CHECK-LABEL: define float @ret_assumed_ult_neg1(
1623 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1624 ; CHECK-NEXT: [[ULT_NEG1:%.*]] = fcmp ult float [[ARG]], -1.000000e+00
1625 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULT_NEG1]]) #[[ATTR5]]
1626 ; CHECK-NEXT: ret float [[ARG]]
1628 %ult.neg1 = fcmp ult float %arg, -1.0
1629 call void @llvm.assume(i1 %ult.neg1)
1633 define float @ret_assumed_ule_neg1(float %arg) {
1634 ; CHECK-LABEL: define float @ret_assumed_ule_neg1(
1635 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1636 ; CHECK-NEXT: [[ULE_NEG1:%.*]] = fcmp ule float [[ARG]], -1.000000e+00
1637 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULE_NEG1]]) #[[ATTR5]]
1638 ; CHECK-NEXT: ret float [[ARG]]
1640 %ule.neg1 = fcmp ule float %arg, -1.0
1641 call void @llvm.assume(i1 %ule.neg1)
1645 define float @ret_assumed_oeq_1(float %arg) {
1646 ; CHECK-LABEL: define float @ret_assumed_oeq_1(
1647 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1648 ; CHECK-NEXT: [[OEQ_1:%.*]] = fcmp oeq float [[ARG]], 1.000000e+00
1649 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OEQ_1]]) #[[ATTR5]]
1650 ; CHECK-NEXT: ret float [[ARG]]
1652 %oeq.1 = fcmp oeq float %arg, 1.0
1653 call void @llvm.assume(i1 %oeq.1)
1657 define float @ret_assumed_ueq_1(float %arg) {
1658 ; CHECK-LABEL: define float @ret_assumed_ueq_1(
1659 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1660 ; CHECK-NEXT: [[UEQ_1:%.*]] = fcmp ueq float [[ARG]], 1.000000e+00
1661 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UEQ_1]]) #[[ATTR5]]
1662 ; CHECK-NEXT: ret float [[ARG]]
1664 %ueq.1 = fcmp ueq float %arg, 1.0
1665 call void @llvm.assume(i1 %ueq.1)
1669 define float @ret_assumed_one_1(float %arg) {
1670 ; CHECK-LABEL: define float @ret_assumed_one_1(
1671 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1672 ; CHECK-NEXT: [[ONE_1:%.*]] = fcmp one float [[ARG]], 1.000000e+00
1673 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ONE_1]]) #[[ATTR5]]
1674 ; CHECK-NEXT: ret float [[ARG]]
1676 %one.1 = fcmp one float %arg, 1.0
1677 call void @llvm.assume(i1 %one.1)
1681 define float @ret_assumed_one_neg1(float %arg) {
1682 ; CHECK-LABEL: define float @ret_assumed_one_neg1(
1683 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1684 ; CHECK-NEXT: [[ONE_NEG1:%.*]] = fcmp one float [[ARG]], -1.000000e+00
1685 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ONE_NEG1]]) #[[ATTR5]]
1686 ; CHECK-NEXT: ret float [[ARG]]
1688 %one.neg1 = fcmp one float %arg, -1.0
1689 call void @llvm.assume(i1 %one.neg1)
1693 define float @ret_assumed_une_neg1(float %arg) {
1694 ; CHECK-LABEL: define float @ret_assumed_une_neg1(
1695 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1696 ; CHECK-NEXT: [[UNE_NEG1:%.*]] = fcmp une float [[ARG]], -1.000000e+00
1697 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UNE_NEG1]]) #[[ATTR5]]
1698 ; CHECK-NEXT: ret float [[ARG]]
1700 %une.neg1 = fcmp une float %arg, -1.0
1701 call void @llvm.assume(i1 %une.neg1)
1705 define float @ret_assumed_une_1(float %arg) {
1706 ; CHECK-LABEL: define float @ret_assumed_une_1(
1707 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1708 ; CHECK-NEXT: [[UNE_1:%.*]] = fcmp une float [[ARG]], 1.000000e+00
1709 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UNE_1]]) #[[ATTR5]]
1710 ; CHECK-NEXT: ret float [[ARG]]
1712 %une.1 = fcmp une float %arg, 1.0
1713 call void @llvm.assume(i1 %une.1)
1717 define float @ret_assumed_fabs_oeq_1(float %arg) {
1718 ; CHECK-LABEL: define float @ret_assumed_fabs_oeq_1(
1719 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1720 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1721 ; CHECK-NEXT: [[OEQ_1:%.*]] = fcmp oeq float [[ARG_FABS]], 1.000000e+00
1722 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OEQ_1]]) #[[ATTR5]]
1723 ; CHECK-NEXT: ret float [[ARG]]
1725 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1726 %oeq.1 = fcmp oeq float %arg.fabs, 1.0
1727 call void @llvm.assume(i1 %oeq.1)
1731 define float @ret_assumed_fabs_ueq_1(float %arg) {
1732 ; CHECK-LABEL: define float @ret_assumed_fabs_ueq_1(
1733 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1734 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1735 ; CHECK-NEXT: [[UEQ_1:%.*]] = fcmp ueq float [[ARG_FABS]], 1.000000e+00
1736 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UEQ_1]]) #[[ATTR5]]
1737 ; CHECK-NEXT: ret float [[ARG]]
1739 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1740 %ueq.1 = fcmp ueq float %arg.fabs, 1.0
1741 call void @llvm.assume(i1 %ueq.1)
1745 define float @ret_assumed_fabs_one_1(float %arg) {
1746 ; CHECK-LABEL: define float @ret_assumed_fabs_one_1(
1747 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1748 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1749 ; CHECK-NEXT: [[ONE_1:%.*]] = fcmp one float [[ARG_FABS]], 1.000000e+00
1750 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ONE_1]]) #[[ATTR5]]
1751 ; CHECK-NEXT: ret float [[ARG]]
1753 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1754 %one.1 = fcmp one float %arg.fabs, 1.0
1755 call void @llvm.assume(i1 %one.1)
1759 define float @ret_assumed_fabs_une_1(float %arg) {
1760 ; CHECK-LABEL: define float @ret_assumed_fabs_une_1(
1761 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1762 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1763 ; CHECK-NEXT: [[UNE_1:%.*]] = fcmp one float [[ARG_FABS]], 1.000000e+00
1764 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UNE_1]]) #[[ATTR5]]
1765 ; CHECK-NEXT: ret float [[ARG]]
1767 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1768 %une.1 = fcmp one float %arg.fabs, 1.0
1769 call void @llvm.assume(i1 %une.1)
1773 define float @ret_assumed_fabs_oeq_neg1(float %arg) {
1774 ; CHECK-LABEL: define float @ret_assumed_fabs_oeq_neg1(
1775 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1776 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
1777 ; CHECK-NEXT: ret float [[ARG]]
1779 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1780 %oeq.neg1 = fcmp oeq float %arg.fabs, -1.0
1781 call void @llvm.assume(i1 %oeq.neg1)
1785 define float @ret_assumed_fabs_ueq_neg1(float %arg) {
1786 ; CHECK-LABEL: define float @ret_assumed_fabs_ueq_neg1(
1787 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1788 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1789 ; CHECK-NEXT: [[UEQ_NEG1:%.*]] = fcmp ueq float [[ARG_FABS]], -1.000000e+00
1790 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UEQ_NEG1]]) #[[ATTR5]]
1791 ; CHECK-NEXT: ret float [[ARG]]
1793 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1794 %ueq.neg1 = fcmp ueq float %arg.fabs, -1.0
1795 call void @llvm.assume(i1 %ueq.neg1)
1799 define float @ret_assumed_fabs_one_neg1(float %arg) {
1800 ; CHECK-LABEL: define float @ret_assumed_fabs_one_neg1(
1801 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1802 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1803 ; CHECK-NEXT: [[ONE_NEG1:%.*]] = fcmp one float [[ARG_FABS]], -1.000000e+00
1804 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ONE_NEG1]]) #[[ATTR5]]
1805 ; CHECK-NEXT: ret float [[ARG]]
1807 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1808 %one.neg1 = fcmp one float %arg.fabs, -1.0
1809 call void @llvm.assume(i1 %one.neg1)
1813 define float @ret_assumed_fabs_une_neg1(float %arg) {
1814 ; CHECK-LABEL: define float @ret_assumed_fabs_une_neg1(
1815 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1816 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
1817 ; CHECK-NEXT: ret float [[ARG]]
1819 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1820 %une.neg1 = fcmp une float %arg.fabs, -1.0
1821 call void @llvm.assume(i1 %une.neg1)
1825 ;---------------------------------------------------------------------
1826 ; compare > fabs(variable)
1827 ;---------------------------------------------------------------------
1830 define float @clamp_is_ogt_known_positive_to_1(float %arg, float %unknown) {
1831 ; CHECK-LABEL: define float @clamp_is_ogt_known_positive_to_1(
1832 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1833 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1834 ; CHECK-NEXT: [[IS_OGT_KNOWN_POSITIVE:%.*]] = fcmp ogt float [[ARG]], [[KNOWN_POSITIVE]]
1835 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1836 ; CHECK-NEXT: ret float [[SELECT]]
1838 %known.positive = call float @llvm.fabs.f32(float %unknown)
1839 %is.ogt.known.positive = fcmp ogt float %arg, %known.positive
1840 %select = select i1 %is.ogt.known.positive, float 1.0, float %arg
1844 define float @clamp_is_oge_known_positive_to_1(float %arg, float %unknown) {
1845 ; CHECK-LABEL: define float @clamp_is_oge_known_positive_to_1(
1846 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1847 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1848 ; CHECK-NEXT: [[IS_OGE_KNOWN_POSITIVE:%.*]] = fcmp oge float [[ARG]], [[KNOWN_POSITIVE]]
1849 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1850 ; CHECK-NEXT: ret float [[SELECT]]
1852 %known.positive = call float @llvm.fabs.f32(float %unknown)
1853 %is.oge.known.positive = fcmp oge float %arg, %known.positive
1854 %select = select i1 %is.oge.known.positive, float 1.0, float %arg
1858 define float @clamp_is_olt_known_positive_to_1(float %arg, float %unknown) {
1859 ; CHECK-LABEL: define float @clamp_is_olt_known_positive_to_1(
1860 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1861 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1862 ; CHECK-NEXT: [[IS_OLT_KNOWN_POSITIVE:%.*]] = fcmp olt float [[ARG]], [[KNOWN_POSITIVE]]
1863 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1864 ; CHECK-NEXT: ret float [[SELECT]]
1866 %known.positive = call float @llvm.fabs.f32(float %unknown)
1867 %is.olt.known.positive = fcmp olt float %arg, %known.positive
1868 %select = select i1 %is.olt.known.positive, float 1.0, float %arg
1872 define float @clamp_is_ole_known_positive_to_1(float %arg, float %unknown) {
1873 ; CHECK-LABEL: define float @clamp_is_ole_known_positive_to_1(
1874 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1875 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1876 ; CHECK-NEXT: [[IS_OLE_KNOWN_POSITIVE:%.*]] = fcmp olt float [[ARG]], [[KNOWN_POSITIVE]]
1877 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1878 ; CHECK-NEXT: ret float [[SELECT]]
1880 %known.positive = call float @llvm.fabs.f32(float %unknown)
1881 %is.ole.known.positive = fcmp olt float %arg, %known.positive
1882 %select = select i1 %is.ole.known.positive, float 1.0, float %arg
1886 define float @clamp_is_ugt_known_positive_to_1(float %arg, float %unknown) {
1887 ; CHECK-LABEL: define float @clamp_is_ugt_known_positive_to_1(
1888 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1889 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1890 ; CHECK-NEXT: [[IS_UGT_KNOWN_POSITIVE:%.*]] = fcmp ugt float [[ARG]], [[KNOWN_POSITIVE]]
1891 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1892 ; CHECK-NEXT: ret float [[SELECT]]
1894 %known.positive = call float @llvm.fabs.f32(float %unknown)
1895 %is.ugt.known.positive = fcmp ugt float %arg, %known.positive
1896 %select = select i1 %is.ugt.known.positive, float 1.0, float %arg
1900 define float @clamp_is_uge_known_positive_to_1(float %arg, float %unknown) {
1901 ; CHECK-LABEL: define float @clamp_is_uge_known_positive_to_1(
1902 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1903 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1904 ; CHECK-NEXT: [[IS_UGE_KNOWN_POSITIVE:%.*]] = fcmp uge float [[ARG]], [[KNOWN_POSITIVE]]
1905 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGE_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1906 ; CHECK-NEXT: ret float [[SELECT]]
1908 %known.positive = call float @llvm.fabs.f32(float %unknown)
1909 %is.uge.known.positive = fcmp uge float %arg, %known.positive
1910 %select = select i1 %is.uge.known.positive, float 1.0, float %arg
1914 define float @clamp_is_ult_known_positive_to_1(float %arg, float %unknown) {
1915 ; CHECK-LABEL: define float @clamp_is_ult_known_positive_to_1(
1916 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1917 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1918 ; CHECK-NEXT: [[IS_ULT_KNOWN_POSITIVE:%.*]] = fcmp ult float [[ARG]], [[KNOWN_POSITIVE]]
1919 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULT_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1920 ; CHECK-NEXT: ret float [[SELECT]]
1922 %known.positive = call float @llvm.fabs.f32(float %unknown)
1923 %is.ult.known.positive = fcmp ult float %arg, %known.positive
1924 %select = select i1 %is.ult.known.positive, float 1.0, float %arg
1928 define float @clamp_is_ule_known_positive_to_1(float %arg, float %unknown) {
1929 ; CHECK-LABEL: define float @clamp_is_ule_known_positive_to_1(
1930 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1931 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1932 ; CHECK-NEXT: [[IS_ULE_KNOWN_POSITIVE:%.*]] = fcmp ult float [[ARG]], [[KNOWN_POSITIVE]]
1933 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULE_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1934 ; CHECK-NEXT: ret float [[SELECT]]
1936 %known.positive = call float @llvm.fabs.f32(float %unknown)
1937 %is.ule.known.positive = fcmp ult float %arg, %known.positive
1938 %select = select i1 %is.ule.known.positive, float 1.0, float %arg
1942 define float @clamp_is_olt_known_negative_to_neg1(float %arg, float %unknown) {
1943 ; CHECK-LABEL: define float @clamp_is_olt_known_negative_to_neg1(
1944 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1945 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1946 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1947 ; CHECK-NEXT: [[IS_OLT_NEGATIVE:%.*]] = fcmp olt float [[ARG]], [[KNOWN_NEGATIVE]]
1948 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_NEGATIVE]], float -1.000000e+00, float [[ARG]]
1949 ; CHECK-NEXT: ret float [[SELECT]]
1951 %known.positive = call float @llvm.fabs.f32(float %unknown)
1952 %known.negative = fneg float %known.positive
1953 %is.olt.negative = fcmp olt float %arg, %known.negative
1954 %select = select i1 %is.olt.negative, float -1.0, float %arg
1958 define float @clamp_is_ole_known_negative_to_neg1(float %arg, float %unknown) {
1959 ; CHECK-LABEL: define float @clamp_is_ole_known_negative_to_neg1(
1960 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1961 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1962 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1963 ; CHECK-NEXT: [[IS_OLE_NEGATIVE:%.*]] = fcmp ole float [[ARG]], [[KNOWN_NEGATIVE]]
1964 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_NEGATIVE]], float -1.000000e+00, float [[ARG]]
1965 ; CHECK-NEXT: ret float [[SELECT]]
1967 %known.positive = call float @llvm.fabs.f32(float %unknown)
1968 %known.negative = fneg float %known.positive
1969 %is.ole.negative = fcmp ole float %arg, %known.negative
1970 %select = select i1 %is.ole.negative, float -1.0, float %arg
1974 define float @clamp_is_ogt_known_negative_to_neg1(float %arg, float %unknown) {
1975 ; CHECK-LABEL: define float @clamp_is_ogt_known_negative_to_neg1(
1976 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1977 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1978 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1979 ; CHECK-NEXT: [[IS_OGT_NEGATIVE:%.*]] = fcmp ogt float [[ARG]], [[KNOWN_NEGATIVE]]
1980 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_NEGATIVE]], float -1.000000e+00, float [[ARG]]
1981 ; CHECK-NEXT: ret float [[SELECT]]
1983 %known.positive = call float @llvm.fabs.f32(float %unknown)
1984 %known.negative = fneg float %known.positive
1985 %is.ogt.negative = fcmp ogt float %arg, %known.negative
1986 %select = select i1 %is.ogt.negative, float -1.0, float %arg
1990 define float @clamp_is_oge_known_negative_to_neg1(float %arg, float %unknown) {
1991 ; CHECK-LABEL: define float @clamp_is_oge_known_negative_to_neg1(
1992 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
1993 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1994 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1995 ; CHECK-NEXT: [[IS_OGE_NEGATIVE:%.*]] = fcmp oge float [[ARG]], [[KNOWN_NEGATIVE]]
1996 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_NEGATIVE]], float -1.000000e+00, float [[ARG]]
1997 ; CHECK-NEXT: ret float [[SELECT]]
1999 %known.positive = call float @llvm.fabs.f32(float %unknown)
2000 %known.negative = fneg float %known.positive
2001 %is.oge.negative = fcmp oge float %arg, %known.negative
2002 %select = select i1 %is.oge.negative, float -1.0, float %arg
2006 define float @clamp_is_ult_known_negative_to_neg1(float %arg, float %unknown) {
2007 ; CHECK-LABEL: define float @clamp_is_ult_known_negative_to_neg1(
2008 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
2009 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2010 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2011 ; CHECK-NEXT: [[IS_ULT_NEGATIVE:%.*]] = fcmp ult float [[ARG]], [[KNOWN_NEGATIVE]]
2012 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULT_NEGATIVE]], float -1.000000e+00, float [[ARG]]
2013 ; CHECK-NEXT: ret float [[SELECT]]
2015 %known.positive = call float @llvm.fabs.f32(float %unknown)
2016 %known.negative = fneg float %known.positive
2017 %is.ult.negative = fcmp ult float %arg, %known.negative
2018 %select = select i1 %is.ult.negative, float -1.0, float %arg
2022 define float @clamp_is_ule_known_negative_to_neg1(float %arg, float %unknown) {
2023 ; CHECK-LABEL: define float @clamp_is_ule_known_negative_to_neg1(
2024 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
2025 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2026 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2027 ; CHECK-NEXT: [[IS_ULE_NEGATIVE:%.*]] = fcmp ule float [[ARG]], [[KNOWN_NEGATIVE]]
2028 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULE_NEGATIVE]], float -1.000000e+00, float [[ARG]]
2029 ; CHECK-NEXT: ret float [[SELECT]]
2031 %known.positive = call float @llvm.fabs.f32(float %unknown)
2032 %known.negative = fneg float %known.positive
2033 %is.ule.negative = fcmp ule float %arg, %known.negative
2034 %select = select i1 %is.ule.negative, float -1.0, float %arg
2038 define float @clamp_is_ugt_known_negative_to_neg1(float %arg, float %unknown) {
2039 ; CHECK-LABEL: define float @clamp_is_ugt_known_negative_to_neg1(
2040 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
2041 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2042 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2043 ; CHECK-NEXT: [[IS_UGT_NEGATIVE:%.*]] = fcmp ugt float [[ARG]], [[KNOWN_NEGATIVE]]
2044 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_NEGATIVE]], float -1.000000e+00, float [[ARG]]
2045 ; CHECK-NEXT: ret float [[SELECT]]
2047 %known.positive = call float @llvm.fabs.f32(float %unknown)
2048 %known.negative = fneg float %known.positive
2049 %is.ugt.negative = fcmp ugt float %arg, %known.negative
2050 %select = select i1 %is.ugt.negative, float -1.0, float %arg
2054 define float @clamp_is_uge_known_negative_to_neg1(float %arg, float %unknown) {
2055 ; CHECK-LABEL: define float @clamp_is_uge_known_negative_to_neg1(
2056 ; CHECK-SAME: float [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR2]] {
2057 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2058 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2059 ; CHECK-NEXT: [[IS_UGE_NEGATIVE:%.*]] = fcmp uge float [[ARG]], [[KNOWN_NEGATIVE]]
2060 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGE_NEGATIVE]], float -1.000000e+00, float [[ARG]]
2061 ; CHECK-NEXT: ret float [[SELECT]]
2063 %known.positive = call float @llvm.fabs.f32(float %unknown)
2064 %known.negative = fneg float %known.positive
2065 %is.uge.negative = fcmp uge float %arg, %known.negative
2066 %select = select i1 %is.uge.negative, float -1.0, float %arg
2070 define float @ret_assumed_ogt_known_positive(float %arg, float %unknown) {
2071 ; CHECK-LABEL: define float @ret_assumed_ogt_known_positive(
2072 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2073 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2074 ; CHECK-NEXT: [[OGT_KNOWN_POSITIVE:%.*]] = fcmp ogt float [[ARG]], [[KNOWN_POSITIVE]]
2075 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_KNOWN_POSITIVE]]) #[[ATTR5]]
2076 ; CHECK-NEXT: ret float [[ARG]]
2078 %known.positive = call float @llvm.fabs.f32(float %unknown)
2079 %ogt.known.positive = fcmp ogt float %arg, %known.positive
2080 call void @llvm.assume(i1 %ogt.known.positive)
2084 define float @ret_assumed_oge_known_positive(float %arg, float %unknown) {
2085 ; CHECK-LABEL: define float @ret_assumed_oge_known_positive(
2086 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2087 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2088 ; CHECK-NEXT: [[OGE_KNOWN_POSITIVE:%.*]] = fcmp oge float [[ARG]], [[KNOWN_POSITIVE]]
2089 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_KNOWN_POSITIVE]]) #[[ATTR5]]
2090 ; CHECK-NEXT: ret float [[ARG]]
2092 %known.positive = call float @llvm.fabs.f32(float %unknown)
2093 %oge.known.positive = fcmp oge float %arg, %known.positive
2094 call void @llvm.assume(i1 %oge.known.positive)
2098 define float @ret_assumed_ugt_known_positive(float %arg, float %unknown) {
2099 ; CHECK-LABEL: define float @ret_assumed_ugt_known_positive(
2100 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2101 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2102 ; CHECK-NEXT: [[UGT_KNOWN_POSITIVE:%.*]] = fcmp ugt float [[ARG]], [[KNOWN_POSITIVE]]
2103 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_KNOWN_POSITIVE]]) #[[ATTR5]]
2104 ; CHECK-NEXT: ret float [[ARG]]
2106 %known.positive = call float @llvm.fabs.f32(float %unknown)
2107 %ugt.known.positive = fcmp ugt float %arg, %known.positive
2108 call void @llvm.assume(i1 %ugt.known.positive)
2112 define float @ret_assumed_uge_known_positive(float %arg, float %unknown) {
2113 ; CHECK-LABEL: define float @ret_assumed_uge_known_positive(
2114 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2115 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2116 ; CHECK-NEXT: [[UGE_KNOWN_POSITIVE:%.*]] = fcmp uge float [[ARG]], [[KNOWN_POSITIVE]]
2117 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_KNOWN_POSITIVE]]) #[[ATTR5]]
2118 ; CHECK-NEXT: ret float [[ARG]]
2120 %known.positive = call float @llvm.fabs.f32(float %unknown)
2121 %uge.known.positive = fcmp uge float %arg, %known.positive
2122 call void @llvm.assume(i1 %uge.known.positive)
2126 define float @ret_assumed_olt_known_negative(float %arg, float %unknown) {
2127 ; CHECK-LABEL: define float @ret_assumed_olt_known_negative(
2128 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2129 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2130 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2131 ; CHECK-NEXT: [[OLT_KNOWN_NEGATIVE:%.*]] = fcmp olt float [[ARG]], [[KNOWN_NEGATIVE]]
2132 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLT_KNOWN_NEGATIVE]]) #[[ATTR5]]
2133 ; CHECK-NEXT: ret float [[ARG]]
2135 %known.positive = call float @llvm.fabs.f32(float %unknown)
2136 %known.negative = fneg float %known.positive
2137 %olt.known.negative = fcmp olt float %arg, %known.negative
2138 call void @llvm.assume(i1 %olt.known.negative)
2142 define float @ret_assumed_ole_known_negative(float %arg, float %unknown) {
2143 ; CHECK-LABEL: define float @ret_assumed_ole_known_negative(
2144 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2145 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2146 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2147 ; CHECK-NEXT: [[OLE_KNOWN_NEGATIVE:%.*]] = fcmp ole float [[ARG]], [[KNOWN_NEGATIVE]]
2148 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLE_KNOWN_NEGATIVE]]) #[[ATTR5]]
2149 ; CHECK-NEXT: ret float [[ARG]]
2151 %known.positive = call float @llvm.fabs.f32(float %unknown)
2152 %known.negative = fneg float %known.positive
2153 %ole.known.negative = fcmp ole float %arg, %known.negative
2154 call void @llvm.assume(i1 %ole.known.negative)
2158 define float @ret_assumed_ult_known_negative(float %arg, float %unknown) {
2159 ; CHECK-LABEL: define float @ret_assumed_ult_known_negative(
2160 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2161 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2162 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2163 ; CHECK-NEXT: [[ULT_KNOWN_NEGATIVE:%.*]] = fcmp ult float [[ARG]], [[KNOWN_NEGATIVE]]
2164 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULT_KNOWN_NEGATIVE]]) #[[ATTR5]]
2165 ; CHECK-NEXT: ret float [[ARG]]
2167 %known.positive = call float @llvm.fabs.f32(float %unknown)
2168 %known.negative = fneg float %known.positive
2169 %ult.known.negative = fcmp ult float %arg, %known.negative
2170 call void @llvm.assume(i1 %ult.known.negative)
2174 define float @ret_assumed_ule_known_negative(float %arg, float %unknown) {
2175 ; CHECK-LABEL: define float @ret_assumed_ule_known_negative(
2176 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2177 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2178 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2179 ; CHECK-NEXT: [[ULE_KNOWN_NEGATIVE:%.*]] = fcmp ule float [[ARG]], [[KNOWN_NEGATIVE]]
2180 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULE_KNOWN_NEGATIVE]]) #[[ATTR5]]
2181 ; CHECK-NEXT: ret float [[ARG]]
2183 %known.positive = call float @llvm.fabs.f32(float %unknown)
2184 %known.negative = fneg float %known.positive
2185 %ule.known.negative = fcmp ule float %arg, %known.negative
2186 call void @llvm.assume(i1 %ule.known.negative)
2190 define float @ret_assumed_ogt_known_negative(float %arg, float %unknown) {
2191 ; CHECK-LABEL: define float @ret_assumed_ogt_known_negative(
2192 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2193 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2194 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2195 ; CHECK-NEXT: [[OGT_KNOWN_NEGATIVE:%.*]] = fcmp ogt float [[ARG]], [[KNOWN_NEGATIVE]]
2196 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_KNOWN_NEGATIVE]]) #[[ATTR5]]
2197 ; CHECK-NEXT: ret float [[ARG]]
2199 %known.positive = call float @llvm.fabs.f32(float %unknown)
2200 %known.negative = fneg float %known.positive
2201 %ogt.known.negative = fcmp ogt float %arg, %known.negative
2202 call void @llvm.assume(i1 %ogt.known.negative)
2206 define float @ret_assumed_oge_known_negative(float %arg, float %unknown) {
2207 ; CHECK-LABEL: define float @ret_assumed_oge_known_negative(
2208 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2209 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2210 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2211 ; CHECK-NEXT: [[OGE_KNOWN_NEGATIVE:%.*]] = fcmp oge float [[ARG]], [[KNOWN_NEGATIVE]]
2212 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_KNOWN_NEGATIVE]]) #[[ATTR5]]
2213 ; CHECK-NEXT: ret float [[ARG]]
2215 %known.positive = call float @llvm.fabs.f32(float %unknown)
2216 %known.negative = fneg float %known.positive
2217 %oge.known.negative = fcmp oge float %arg, %known.negative
2218 call void @llvm.assume(i1 %oge.known.negative)
2222 define float @ret_assumed_ugt_known_negative(float %arg, float %unknown) {
2223 ; CHECK-LABEL: define float @ret_assumed_ugt_known_negative(
2224 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2225 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2226 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2227 ; CHECK-NEXT: [[UGT_KNOWN_NEGATIVE:%.*]] = fcmp ugt float [[ARG]], [[KNOWN_NEGATIVE]]
2228 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_KNOWN_NEGATIVE]]) #[[ATTR5]]
2229 ; CHECK-NEXT: ret float [[ARG]]
2231 %known.positive = call float @llvm.fabs.f32(float %unknown)
2232 %known.negative = fneg float %known.positive
2233 %ugt.known.negative = fcmp ugt float %arg, %known.negative
2234 call void @llvm.assume(i1 %ugt.known.negative)
2238 define float @ret_assumed_uge_known_negative(float %arg, float %unknown) {
2239 ; CHECK-LABEL: define float @ret_assumed_uge_known_negative(
2240 ; CHECK-SAME: float returned [[ARG:%.*]], float [[UNKNOWN:%.*]]) #[[ATTR3]] {
2241 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2242 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2243 ; CHECK-NEXT: [[UGE_KNOWN_NEGATIVE:%.*]] = fcmp uge float [[ARG]], [[KNOWN_NEGATIVE]]
2244 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_KNOWN_NEGATIVE]]) #[[ATTR5]]
2245 ; CHECK-NEXT: ret float [[ARG]]
2247 %known.positive = call float @llvm.fabs.f32(float %unknown)
2248 %known.negative = fneg float %known.positive
2249 %uge.known.negative = fcmp uge float %arg, %known.negative
2250 call void @llvm.assume(i1 %uge.known.negative)
2254 ;---------------------------------------------------------------------
2255 ; assume compare to smallest normal
2256 ;---------------------------------------------------------------------
2258 define float @assume_oeq_smallest_normal(float %arg) {
2259 ; CHECK-LABEL: define float @assume_oeq_smallest_normal(
2260 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2261 ; CHECK-NEXT: [[IS_OEQ_SMALLEST_NORMAL:%.*]] = fcmp oeq float [[ARG]], 0x3810000000000000
2262 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_OEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2263 ; CHECK-NEXT: ret float [[ARG]]
2265 %is.oeq.smallest.normal = fcmp oeq float %arg, 0x3810000000000000
2266 call void @llvm.assume(i1 %is.oeq.smallest.normal)
2270 define float @assume_one_smallest_normal(float %arg) {
2271 ; CHECK-LABEL: define float @assume_one_smallest_normal(
2272 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2273 ; CHECK-NEXT: [[IS_ONE_SMALLEST_NORMAL:%.*]] = fcmp one float [[ARG]], 0x3810000000000000
2274 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_ONE_SMALLEST_NORMAL]]) #[[ATTR5]]
2275 ; CHECK-NEXT: ret float [[ARG]]
2277 %is.one.smallest.normal = fcmp one float %arg, 0x3810000000000000
2278 call void @llvm.assume(i1 %is.one.smallest.normal)
2282 define float @assume_ueq_smallest_normal(float %arg) {
2283 ; CHECK-LABEL: define float @assume_ueq_smallest_normal(
2284 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2285 ; CHECK-NEXT: [[IS_UEQ_SMALLEST_NORMAL:%.*]] = fcmp ueq float [[ARG]], 0x3810000000000000
2286 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2287 ; CHECK-NEXT: ret float [[ARG]]
2289 %is.ueq.smallest.normal = fcmp ueq float %arg, 0x3810000000000000
2290 call void @llvm.assume(i1 %is.ueq.smallest.normal)
2294 define float @assume_une_smallest_normal(float %arg) {
2295 ; CHECK-LABEL: define float @assume_une_smallest_normal(
2296 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2297 ; CHECK-NEXT: [[IS_UNE_SMALLEST_NORMAL:%.*]] = fcmp une float [[ARG]], 0x3810000000000000
2298 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UNE_SMALLEST_NORMAL]]) #[[ATTR5]]
2299 ; CHECK-NEXT: ret float [[ARG]]
2301 %is.une.smallest.normal = fcmp une float %arg, 0x3810000000000000
2302 call void @llvm.assume(i1 %is.une.smallest.normal)
2306 define float @assume_ord_smallest_normal(float %arg) {
2307 ; CHECK-LABEL: define float @assume_ord_smallest_normal(
2308 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2309 ; CHECK-NEXT: [[IS_ORD_SMALLEST_NORMAL:%.*]] = fcmp ord float [[ARG]], 0x3810000000000000
2310 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_ORD_SMALLEST_NORMAL]]) #[[ATTR5]]
2311 ; CHECK-NEXT: ret float [[ARG]]
2313 %is.ord.smallest.normal = fcmp ord float %arg, 0x3810000000000000
2314 call void @llvm.assume(i1 %is.ord.smallest.normal)
2318 define float @assume_uno_smallest_normal(float %arg) {
2319 ; CHECK-LABEL: define float @assume_uno_smallest_normal(
2320 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2321 ; CHECK-NEXT: [[IS_UNO_SMALLEST_NORMAL:%.*]] = fcmp uno float [[ARG]], 0x3810000000000000
2322 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UNO_SMALLEST_NORMAL]]) #[[ATTR5]]
2323 ; CHECK-NEXT: ret float [[ARG]]
2325 %is.uno.smallest.normal = fcmp uno float %arg, 0x3810000000000000
2326 call void @llvm.assume(i1 %is.uno.smallest.normal)
2330 define float @assume_fabs_oeq_smallest_normal(float %arg) {
2331 ; CHECK-LABEL: define float @assume_fabs_oeq_smallest_normal(
2332 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2333 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2334 ; CHECK-NEXT: [[IS_OEQ_SMALLEST_NORMAL:%.*]] = fcmp oeq float [[FABS_ARG]], 0x3810000000000000
2335 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_OEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2336 ; CHECK-NEXT: ret float [[ARG]]
2338 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2339 %is.oeq.smallest.normal = fcmp oeq float %fabs.arg, 0x3810000000000000
2340 call void @llvm.assume(i1 %is.oeq.smallest.normal)
2344 define float @assume_fabs_one_smallest_normal(float %arg) {
2345 ; CHECK-LABEL: define float @assume_fabs_one_smallest_normal(
2346 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2347 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2348 ; CHECK-NEXT: [[IS_ONE_SMALLEST_NORMAL:%.*]] = fcmp one float [[FABS_ARG]], 0x3810000000000000
2349 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_ONE_SMALLEST_NORMAL]]) #[[ATTR5]]
2350 ; CHECK-NEXT: ret float [[ARG]]
2352 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2353 %is.one.smallest.normal = fcmp one float %fabs.arg, 0x3810000000000000
2354 call void @llvm.assume(i1 %is.one.smallest.normal)
2358 define float @assume_fabs_ueq_smallest_normal(float %arg) {
2359 ; CHECK-LABEL: define float @assume_fabs_ueq_smallest_normal(
2360 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2361 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2362 ; CHECK-NEXT: [[IS_UEQ_SMALLEST_NORMAL:%.*]] = fcmp ueq float [[FABS_ARG]], 0x3810000000000000
2363 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2364 ; CHECK-NEXT: ret float [[ARG]]
2366 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2367 %is.ueq.smallest.normal = fcmp ueq float %fabs.arg, 0x3810000000000000
2368 call void @llvm.assume(i1 %is.ueq.smallest.normal)
2372 define float @assume_fabs_une_smallest_normal(float %arg) {
2373 ; CHECK-LABEL: define float @assume_fabs_une_smallest_normal(
2374 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2375 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2376 ; CHECK-NEXT: [[IS_UNE_SMALLEST_NORMAL:%.*]] = fcmp une float [[FABS_ARG]], 0x3810000000000000
2377 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UNE_SMALLEST_NORMAL]]) #[[ATTR5]]
2378 ; CHECK-NEXT: ret float [[ARG]]
2380 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2381 %is.une.smallest.normal = fcmp une float %fabs.arg, 0x3810000000000000
2382 call void @llvm.assume(i1 %is.une.smallest.normal)
2386 define float @assume_fabs_ord_smallest_normal(float %arg) {
2387 ; CHECK-LABEL: define float @assume_fabs_ord_smallest_normal(
2388 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2389 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2390 ; CHECK-NEXT: [[IS_ORD_SMALLEST_NORMAL:%.*]] = fcmp ord float [[FABS_ARG]], 0x3810000000000000
2391 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_ORD_SMALLEST_NORMAL]]) #[[ATTR5]]
2392 ; CHECK-NEXT: ret float [[ARG]]
2394 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2395 %is.ord.smallest.normal = fcmp ord float %fabs.arg, 0x3810000000000000
2396 call void @llvm.assume(i1 %is.ord.smallest.normal)
2400 define float @assume_fabs_uno_smallest_normal(float %arg) {
2401 ; CHECK-LABEL: define float @assume_fabs_uno_smallest_normal(
2402 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2403 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2404 ; CHECK-NEXT: [[IS_UNO_SMALLEST_NORMAL:%.*]] = fcmp uno float [[FABS_ARG]], 0x3810000000000000
2405 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UNO_SMALLEST_NORMAL]]) #[[ATTR5]]
2406 ; CHECK-NEXT: ret float [[ARG]]
2408 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2409 %is.uno.smallest.normal = fcmp uno float %fabs.arg, 0x3810000000000000
2410 call void @llvm.assume(i1 %is.uno.smallest.normal)
2414 define float @assume_oeq_smallest_normal_known_pos(float nofpclass(ninf nsub nnorm nzero) %arg) {
2415 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_oeq_smallest_normal_known_pos(
2416 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2417 ; CHECK-NEXT: [[IS_OEQ_SMALLEST_NORMAL:%.*]] = fcmp oeq float [[ARG]], 0x3810000000000000
2418 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_OEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2419 ; CHECK-NEXT: ret float [[ARG]]
2421 %is.oeq.smallest.normal = fcmp oeq float %arg, 0x3810000000000000
2422 call void @llvm.assume(i1 %is.oeq.smallest.normal)
2426 ;---------------------------------------------------------------------
2428 ;---------------------------------------------------------------------
2430 define float @assume_ole_pinf(float %arg) {
2431 ; CHECK-LABEL: define float @assume_ole_pinf(
2432 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2433 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ole float [[ARG]], 0x7FF0000000000000
2434 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2435 ; CHECK-NEXT: ret float [[ARG]]
2437 %fcmp = fcmp ole float %arg, 0x7FF0000000000000
2438 call void @llvm.assume(i1 %fcmp)
2442 define float @assume_ole_ninf(float %arg) {
2443 ; CHECK-LABEL: define float @assume_ole_ninf(
2444 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2445 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ole float [[ARG]], 0xFFF0000000000000
2446 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2447 ; CHECK-NEXT: ret float [[ARG]]
2449 %fcmp = fcmp ole float %arg, 0xFFF0000000000000
2450 call void @llvm.assume(i1 %fcmp)
2454 define float @assume_ugt_pinf(float %arg) {
2455 ; CHECK-LABEL: define float @assume_ugt_pinf(
2456 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2457 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ugt float [[ARG]], 0x7FF0000000000000
2458 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2459 ; CHECK-NEXT: ret float [[ARG]]
2461 %fcmp = fcmp ugt float %arg, 0x7FF0000000000000
2462 call void @llvm.assume(i1 %fcmp)
2466 define float @assume_ugt_ninf(float %arg) {
2467 ; CHECK-LABEL: define float @assume_ugt_ninf(
2468 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2469 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ugt float [[ARG]], 0xFFF0000000000000
2470 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2471 ; CHECK-NEXT: ret float [[ARG]]
2473 %fcmp = fcmp ugt float %arg, 0xFFF0000000000000
2474 call void @llvm.assume(i1 %fcmp)
2478 define float @assume_fabs_ole_pinf(float %arg) {
2479 ; CHECK-LABEL: define float @assume_fabs_ole_pinf(
2480 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2481 ; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2482 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ole float [[FABS]], 0x7FF0000000000000
2483 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2484 ; CHECK-NEXT: ret float [[ARG]]
2486 %fabs = call float @llvm.fabs.f32(float %arg)
2487 %fcmp = fcmp ole float %fabs, 0x7FF0000000000000
2488 call void @llvm.assume(i1 %fcmp)
2492 define float @assume_fabs_ole_ninf(float %arg) {
2493 ; CHECK-LABEL: define float @assume_fabs_ole_ninf(
2494 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2495 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2496 ; CHECK-NEXT: ret float [[ARG]]
2498 %fabs = call float @llvm.fabs.f32(float %arg)
2499 %fcmp = fcmp ole float %fabs, 0xFFF0000000000000
2500 call void @llvm.assume(i1 %fcmp)
2504 define float @assume_fabs_ugt_pinf(float %arg) {
2505 ; CHECK-LABEL: define float @assume_fabs_ugt_pinf(
2506 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2507 ; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2508 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ugt float [[FABS]], 0x7FF0000000000000
2509 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2510 ; CHECK-NEXT: ret float [[ARG]]
2512 %fabs = call float @llvm.fabs.f32(float %arg)
2513 %fcmp = fcmp ugt float %fabs, 0x7FF0000000000000
2514 call void @llvm.assume(i1 %fcmp)
2518 define float @assume_fabs_ugt_ninf(float %arg) {
2519 ; CHECK-LABEL: define float @assume_fabs_ugt_ninf(
2520 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2521 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2522 ; CHECK-NEXT: ret float [[ARG]]
2524 %fabs = call float @llvm.fabs.f32(float %arg)
2525 %fcmp = fcmp ugt float %fabs, 0xFFF0000000000000
2526 call void @llvm.assume(i1 %fcmp)
2530 ;---------------------------------------------------------------------
2532 ;---------------------------------------------------------------------
2534 define float @assume_fabs_false_pinf(float %arg) {
2535 ; CHECK-LABEL: define float @assume_fabs_false_pinf(
2536 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2537 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2538 ; CHECK-NEXT: ret float [[ARG]]
2540 %fabs = call float @llvm.fabs.f32(float %arg)
2541 %fcmp = fcmp false float %fabs, 0x7FF0000000000000
2542 call void @llvm.assume(i1 %fcmp)
2546 define float @assume_fabs_false_ninf(float %arg) {
2547 ; CHECK-LABEL: define float @assume_fabs_false_ninf(
2548 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2549 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2550 ; CHECK-NEXT: ret float [[ARG]]
2552 %fabs = call float @llvm.fabs.f32(float %arg)
2553 %fcmp = fcmp false float %fabs, 0xFFF0000000000000
2554 call void @llvm.assume(i1 %fcmp)
2558 define float @assume_false_pinf(float %arg) {
2559 ; CHECK-LABEL: define float @assume_false_pinf(
2560 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2561 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2562 ; CHECK-NEXT: ret float [[ARG]]
2564 %fcmp = fcmp false float %arg, 0x7FF0000000000000
2565 call void @llvm.assume(i1 %fcmp)
2569 define float @assume_false_ninf(float %arg) {
2570 ; CHECK-LABEL: define float @assume_false_ninf(
2571 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2572 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2573 ; CHECK-NEXT: ret float [[ARG]]
2575 %fcmp = fcmp false float %arg, 0xFFF0000000000000
2576 call void @llvm.assume(i1 %fcmp)
2580 define float @clamp_false_pinf_0.0(float %arg) {
2581 ; CHECK-LABEL: define float @clamp_false_pinf_0.0(
2582 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2583 ; CHECK-NEXT: ret float [[ARG]]
2585 %fcmp = fcmp false float %arg, 0x7FF0000000000000
2586 %select = select i1 %fcmp, float 0.0, float %arg
2590 define float @clamp_false_ninf_0.0(float %arg) {
2591 ; CHECK-LABEL: define float @clamp_false_ninf_0.0(
2592 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2593 ; CHECK-NEXT: ret float [[ARG]]
2595 %fcmp = fcmp false float %arg, 0xFFF0000000000000
2596 %select = select i1 %fcmp, float 0.0, float %arg
2600 define float @clamp_false_smallest_normal_0.0(float %arg) {
2601 ; CHECK-LABEL: define float @clamp_false_smallest_normal_0.0(
2602 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2603 ; CHECK-NEXT: ret float [[ARG]]
2605 %fcmp = fcmp false float %arg, 0x3810000000000000
2606 %select = select i1 %fcmp, float 0.0, float %arg
2610 define float @assume_false_p0(float %arg) {
2611 ; CHECK-LABEL: define float @assume_false_p0(
2612 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2613 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2614 ; CHECK-NEXT: ret float [[ARG]]
2616 %fcmp = fcmp false float %arg, 0.0
2617 call void @llvm.assume(i1 %fcmp)
2621 define float @assume_false_n0(float %arg) {
2622 ; CHECK-LABEL: define float @assume_false_n0(
2623 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2624 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2625 ; CHECK-NEXT: ret float [[ARG]]
2627 %fcmp = fcmp false float %arg, -0.0
2628 call void @llvm.assume(i1 %fcmp)
2632 define float @assume_false_smallest_normal(float %arg) {
2633 ; CHECK-LABEL: define float @assume_false_smallest_normal(
2634 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2635 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2636 ; CHECK-NEXT: ret float [[ARG]]
2638 %fcmp = fcmp false float %arg, 0x3810000000000000
2639 call void @llvm.assume(i1 %fcmp)
2643 define float @clamp_false_nan(float %arg) {
2644 ; CHECK-LABEL: define float @clamp_false_nan(
2645 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2646 ; CHECK-NEXT: ret float [[ARG]]
2648 %fcmp = fcmp false float %arg, 0x7FF8000000000000
2649 %select = select i1 %fcmp, float 0.0, float %arg
2653 define float @clamp_false_p0(float %arg) {
2654 ; CHECK-LABEL: define float @clamp_false_p0(
2655 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2656 ; CHECK-NEXT: ret float [[ARG]]
2658 %fcmp = fcmp false float %arg, 0.0
2659 %select = select i1 %fcmp, float 0.0, float %arg
2663 define float @clamp_false_n0(float %arg) {
2664 ; CHECK-LABEL: define float @clamp_false_n0(
2665 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2666 ; CHECK-NEXT: ret float [[ARG]]
2668 %fcmp = fcmp false float %arg, -0.0
2669 %select = select i1 %fcmp, float 0.0, float %arg
2673 ;---------------------------------------------------------------------
2675 ;---------------------------------------------------------------------
2677 define float @assume_fabs_true_pinf(float %arg) {
2678 ; CHECK-LABEL: define float @assume_fabs_true_pinf(
2679 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2680 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2681 ; CHECK-NEXT: ret float [[ARG]]
2683 %fabs = call float @llvm.fabs.f32(float %arg)
2684 %fcmp = fcmp true float %fabs, 0x7FF0000000000000
2685 call void @llvm.assume(i1 %fcmp)
2689 define float @assume_fabs_true_ninf(float %arg) {
2690 ; CHECK-LABEL: define float @assume_fabs_true_ninf(
2691 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2692 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2693 ; CHECK-NEXT: ret float [[ARG]]
2695 %fabs = call float @llvm.fabs.f32(float %arg)
2696 %fcmp = fcmp true float %fabs, 0xFFF0000000000000
2697 call void @llvm.assume(i1 %fcmp)
2701 define float @assume_true_pinf(float %arg) {
2702 ; CHECK-LABEL: define float @assume_true_pinf(
2703 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2704 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2705 ; CHECK-NEXT: ret float [[ARG]]
2707 %fcmp = fcmp true float %arg, 0x7FF0000000000000
2708 call void @llvm.assume(i1 %fcmp)
2712 define float @assume_true_ninf(float %arg) {
2713 ; CHECK-LABEL: define float @assume_true_ninf(
2714 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2715 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2716 ; CHECK-NEXT: ret float [[ARG]]
2718 %fcmp = fcmp true float %arg, 0xFFF0000000000000
2719 call void @llvm.assume(i1 %fcmp)
2723 define float @assume_true_p0(float %arg) {
2724 ; CHECK-LABEL: define float @assume_true_p0(
2725 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2726 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2727 ; CHECK-NEXT: ret float [[ARG]]
2729 %fcmp = fcmp true float %arg, 0.0
2730 call void @llvm.assume(i1 %fcmp)
2734 define float @assume_true_n0(float %arg) {
2735 ; CHECK-LABEL: define float @assume_true_n0(
2736 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2737 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2738 ; CHECK-NEXT: ret float [[ARG]]
2740 %fcmp = fcmp true float %arg, -0.0
2741 call void @llvm.assume(i1 %fcmp)
2745 define float @assume_true_smallest_normal(float %arg) {
2746 ; CHECK-LABEL: define float @assume_true_smallest_normal(
2747 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2748 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2749 ; CHECK-NEXT: ret float [[ARG]]
2751 %fcmp = fcmp true float %arg, 0x3810000000000000
2752 call void @llvm.assume(i1 %fcmp)
2756 define float @clamp_true_pinf_0.0(float %arg) {
2757 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_pinf_0.0(
2758 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
2759 ; CHECK-NEXT: ret float 0.000000e+00
2761 %fcmp = fcmp true float %arg, 0x7FF0000000000000
2762 %select = select i1 %fcmp, float 0.0, float %arg
2766 define float @clamp_true_ninf_0.0(float %arg) {
2767 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_ninf_0.0(
2768 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
2769 ; CHECK-NEXT: ret float 0.000000e+00
2771 %fcmp = fcmp true float %arg, 0xFFF0000000000000
2772 %select = select i1 %fcmp, float 0.0, float %arg
2776 define float @clamp_true_smallest_normal_0.0(float %arg) {
2777 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_smallest_normal_0.0(
2778 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
2779 ; CHECK-NEXT: ret float 0.000000e+00
2781 %fcmp = fcmp true float %arg, 0x3810000000000000
2782 %select = select i1 %fcmp, float 0.0, float %arg
2786 define float @clamp_true_nan(float %arg) {
2787 ; CHECK-LABEL: define float @clamp_true_nan(
2788 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2789 ; CHECK-NEXT: ret float [[ARG]]
2791 %fcmp = fcmp true float %arg, 0x7FF8000000000000
2792 %select = select i1 %fcmp, float %arg, float 0.0
2796 define float @clamp_true_p0(float %arg) {
2797 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_p0(
2798 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
2799 ; CHECK-NEXT: ret float 0.000000e+00
2801 %fcmp = fcmp true float %arg, 0.0
2802 %select = select i1 %fcmp, float 0.0, float %arg
2806 define float @clamp_true_n0(float %arg) {
2807 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_n0(
2808 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
2809 ; CHECK-NEXT: ret float 0.000000e+00
2811 %fcmp = fcmp true float %arg, -0.0
2812 %select = select i1 %fcmp, float 0.0, float %arg
2816 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: