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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 nofpclass(zero) [[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 nofpclass(nan zero) [[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 nofpclass(zero) [[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 nofpclass(inf sub nnorm) [[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 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(ninf nzero nsub nnorm) float @fcmp_fabs_oeq_1_else_1(
528 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[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 nofpclass(ninf nzero nsub nnorm) float @fcmp_fabs_oeq_1_0_else_arg(
542 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[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(ninf nzero nsub nnorm) float @fcmp_fabs_ueq_1_0_else_arg(
556 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[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(ninf nzero nsub nnorm) float @fcmp_fabs_one_1_arg_else_0(
570 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[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 nofpclass(ninf nzero nsub nnorm) float @fcmp_fabs_une_1_arg_else_0(
584 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[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(ninf nzero nsub nnorm) float @fcmp_fabs_one_1_0_else_arg(
598 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[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(ninf nzero nsub nnorm) float @fcmp_fabs_une_1_0_else_arg(
612 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[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(ninf nzero nsub) float @fcmp_fabs_one_1_neg2_else_arg(
626 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[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 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 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 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 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 float @clamp_ogt_largest_denormal_0.0(
692 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
693 ; CHECK-NEXT: [[IS_OGT_LARGEST_DENORMAL:%.*]] = fcmp ugt 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 ugt 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 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 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 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 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 ;---------------------------------------------------------------------
751 ; clamp fabs to 1 copysign
752 ;---------------------------------------------------------------------
755 define float @clamp_fabs_value_ogt_1_to_1_copysign(float %arg) {
756 ; CHECK-LABEL: define nofpclass(nan inf zero sub) float @clamp_fabs_value_ogt_1_to_1_copysign(
757 ; CHECK-SAME: float nofpclass(nan inf zero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
758 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
759 ; CHECK-NEXT: [[FABS_IS_OGT_1:%.*]] = fcmp ogt float [[FABS_ARG]], 1.000000e+00
760 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
761 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OGT_1]], float [[COPYSIGN]], float [[ARG]]
762 ; CHECK-NEXT: ret float [[SELECT]]
764 %fabs.arg = call float @llvm.fabs.f32(float %arg)
765 %fabs.is.ogt.1 = fcmp ogt float %fabs.arg, 1.0
766 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
767 %select = select i1 %fabs.is.ogt.1, float %copysign, float %arg
772 define float @clamp_fabs_value_oge_1_to_1_copysign(float %arg) {
773 ; CHECK-LABEL: define nofpclass(nan inf zero sub) float @clamp_fabs_value_oge_1_to_1_copysign(
774 ; CHECK-SAME: float nofpclass(nan inf zero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
775 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
776 ; CHECK-NEXT: [[FABS_IS_OGE_1:%.*]] = fcmp oge float [[FABS_ARG]], 1.000000e+00
777 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
778 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OGE_1]], float [[COPYSIGN]], float [[ARG]]
779 ; CHECK-NEXT: ret float [[SELECT]]
781 %fabs.arg = call float @llvm.fabs.f32(float %arg)
782 %fabs.is.oge.1 = fcmp oge float %fabs.arg, 1.0
783 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
784 %select = select i1 %fabs.is.oge.1, float %copysign, float %arg
788 ; can't be inf or nan
789 define float @clamp_fabs_value_olt_1_to_1_copysign(float %arg) {
790 ; CHECK-LABEL: define nofpclass(nan inf zero sub) float @clamp_fabs_value_olt_1_to_1_copysign(
791 ; CHECK-SAME: float nofpclass(nan inf zero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
792 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
793 ; CHECK-NEXT: [[FABS_IS_OLT_1:%.*]] = fcmp olt float [[FABS_ARG]], 1.000000e+00
794 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
795 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OLT_1]], float [[ARG]], float [[COPYSIGN]]
796 ; CHECK-NEXT: ret float [[SELECT]]
798 %fabs.arg = call float @llvm.fabs.f32(float %arg)
799 %fabs.is.olt.1 = fcmp olt float %fabs.arg, 1.0
800 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
801 %select = select i1 %fabs.is.olt.1, float %arg, float %copysign
805 ; can't be inf or nan
806 define float @clamp_fabs_value_ole_1_to_1_copysign(float %arg) {
807 ; CHECK-LABEL: define nofpclass(nan inf zero sub) float @clamp_fabs_value_ole_1_to_1_copysign(
808 ; CHECK-SAME: float nofpclass(nan inf zero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
809 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
810 ; CHECK-NEXT: [[FABS_IS_OLE_1:%.*]] = fcmp ole float [[FABS_ARG]], 1.000000e+00
811 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
812 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OLE_1]], float [[ARG]], float [[COPYSIGN]]
813 ; CHECK-NEXT: ret float [[SELECT]]
815 %fabs.arg = call float @llvm.fabs.f32(float %arg)
816 %fabs.is.ole.1 = fcmp ole float %fabs.arg, 1.0
817 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
818 %select = select i1 %fabs.is.ole.1, float %arg, float %copysign
822 ; can't be inf or nan
823 define float @clamp_fabs_value_ugt_1_to_1_copysign(float %arg) {
824 ; CHECK-LABEL: define nofpclass(nan inf zero sub) float @clamp_fabs_value_ugt_1_to_1_copysign(
825 ; CHECK-SAME: float nofpclass(nan inf zero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
826 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
827 ; CHECK-NEXT: [[FABS_IS_UGT_1:%.*]] = fcmp ugt float [[FABS_ARG]], 1.000000e+00
828 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
829 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_UGT_1]], float [[COPYSIGN]], float [[ARG]]
830 ; CHECK-NEXT: ret float [[SELECT]]
832 %fabs.arg = call float @llvm.fabs.f32(float %arg)
833 %fabs.is.ugt.1 = fcmp ugt float %fabs.arg, 1.0
834 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
835 %select = select i1 %fabs.is.ugt.1, float %copysign, float %arg
839 ; can't be inf or nan
840 define float @clamp_fabs_value_uge_1_to_1_copysign(float %arg) {
841 ; CHECK-LABEL: define nofpclass(nan inf zero sub) float @clamp_fabs_value_uge_1_to_1_copysign(
842 ; CHECK-SAME: float nofpclass(nan inf zero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
843 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
844 ; CHECK-NEXT: [[FABS_IS_UGE_1:%.*]] = fcmp ugt float [[FABS_ARG]], 1.000000e+00
845 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
846 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_UGE_1]], float [[COPYSIGN]], float [[ARG]]
847 ; CHECK-NEXT: ret float [[SELECT]]
849 %fabs.arg = call float @llvm.fabs.f32(float %arg)
850 %fabs.is.uge.1 = fcmp ugt float %fabs.arg, 1.0
851 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
852 %select = select i1 %fabs.is.uge.1, float %copysign, float %arg
857 define float @clamp_fabs_value_ult_1_to_1_copysign(float %arg) {
858 ; CHECK-LABEL: define nofpclass(nan inf zero sub) float @clamp_fabs_value_ult_1_to_1_copysign(
859 ; CHECK-SAME: float nofpclass(nan inf zero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
860 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
861 ; CHECK-NEXT: [[FABS_IS_ULT_1:%.*]] = fcmp ult float [[FABS_ARG]], 1.000000e+00
862 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
863 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ULT_1]], float [[ARG]], float [[COPYSIGN]]
864 ; CHECK-NEXT: ret float [[SELECT]]
866 %fabs.arg = call float @llvm.fabs.f32(float %arg)
867 %fabs.is.ult.1 = fcmp ult float %fabs.arg, 1.0
868 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
869 %select = select i1 %fabs.is.ult.1, float %arg, float %copysign
874 define float @clamp_fabs_value_ule_1_to_1_copysign(float %arg) {
875 ; CHECK-LABEL: define nofpclass(nan inf zero sub) float @clamp_fabs_value_ule_1_to_1_copysign(
876 ; CHECK-SAME: float nofpclass(nan inf zero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
877 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
878 ; CHECK-NEXT: [[FABS_IS_ULE_1:%.*]] = fcmp ule float [[FABS_ARG]], 1.000000e+00
879 ; CHECK-NEXT: [[COPYSIGN:%.*]] = call nofpclass(nan inf zero sub) float @llvm.copysign.f32(float noundef 1.000000e+00, float [[ARG]]) #[[ATTR4]]
880 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ULE_1]], float [[ARG]], float [[COPYSIGN]]
881 ; CHECK-NEXT: ret float [[SELECT]]
883 %fabs.arg = call float @llvm.fabs.f32(float %arg)
884 %fabs.is.ule.1 = fcmp ule float %fabs.arg, 1.0
885 %copysign = call float @llvm.copysign.f32(float 1.0, float %arg)
886 %select = select i1 %fabs.is.ule.1, float %arg, float %copysign
890 ;---------------------------------------------------------------------
891 ; compare to largest normal
892 ;---------------------------------------------------------------------
895 define float @clamp_is_ogt_largest_normal_to_largest_normal(float %arg) {
896 ; CHECK-LABEL: define float @clamp_is_ogt_largest_normal_to_largest_normal(
897 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
898 ; CHECK-NEXT: [[IS_OGT_LARGEST_NORMAL:%.*]] = fcmp ogt float [[ARG]], 0x47EFFFFFE0000000
899 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
900 ; CHECK-NEXT: ret float [[SELECT]]
902 %is.ogt.largest.normal = fcmp ogt float %arg, 0x47EFFFFFE0000000
903 %select = select i1 %is.ogt.largest.normal, float 0x47EFFFFFE0000000, float %arg
908 define float @clamp_is_oge_largest_normal_to_largest_normal(float %arg) {
909 ; CHECK-LABEL: define float @clamp_is_oge_largest_normal_to_largest_normal(
910 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
911 ; CHECK-NEXT: [[IS_OGE_LARGEST_NORMAL:%.*]] = fcmp oge float [[ARG]], 0x47EFFFFFE0000000
912 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
913 ; CHECK-NEXT: ret float [[SELECT]]
915 %is.oge.largest.normal = fcmp oge float %arg, 0x47EFFFFFE0000000
916 %select = select i1 %is.oge.largest.normal, float 0x47EFFFFFE0000000, float %arg
920 ; Can't be +inf or nan
921 define float @clamp_is_ugt_largest_normal_to_largest_normal(float %arg) {
922 ; CHECK-LABEL: define float @clamp_is_ugt_largest_normal_to_largest_normal(
923 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
924 ; CHECK-NEXT: [[IS_UGT_LARGEST_NORMAL:%.*]] = fcmp ugt float [[ARG]], 0x47EFFFFFE0000000
925 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
926 ; CHECK-NEXT: ret float [[SELECT]]
928 %is.ugt.largest.normal = fcmp ugt float %arg, 0x47EFFFFFE0000000
929 %select = select i1 %is.ugt.largest.normal, float 0x47EFFFFFE0000000, float %arg
933 ; Can't be +inf or nan
934 define float @clamp_is_uge_largest_normal_to_largest_normal(float %arg) {
935 ; CHECK-LABEL: define float @clamp_is_uge_largest_normal_to_largest_normal(
936 ; CHECK-SAME: float [[ARG:%.*]]) #[[ATTR2]] {
937 ; CHECK-NEXT: [[IS_UGE_LARGEST_NORMAL:%.*]] = fcmp uge float [[ARG]], 0x47EFFFFFE0000000
938 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGE_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
939 ; CHECK-NEXT: ret float [[SELECT]]
941 %is.uge.largest.normal = fcmp uge float %arg, 0x47EFFFFFE0000000
942 %select = select i1 %is.uge.largest.normal, float 0x47EFFFFFE0000000, float %arg
946 ; Can't be +inf or -inf
947 define float @clamp_fabs_is_ogt_largest_normal_to_largest_normal(float %arg) {
948 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_is_ogt_largest_normal_to_largest_normal(
949 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
950 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
951 ; CHECK-NEXT: [[IS_OGT_LARGEST_NORMAL:%.*]] = fcmp ogt float [[FABS_ARG]], 0x47EFFFFFE0000000
952 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
953 ; CHECK-NEXT: ret float [[SELECT]]
955 %fabs.arg = call float @llvm.fabs.f32(float %arg)
956 %is.ogt.largest.normal = fcmp ogt float %fabs.arg, 0x47EFFFFFE0000000
957 %select = select i1 %is.ogt.largest.normal, float 0x47EFFFFFE0000000, float %arg
961 ; Can't be +inf or -inf
962 define float @clamp_fabs_is_oge_largest_normal_to_largest_normal(float %arg) {
963 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_is_oge_largest_normal_to_largest_normal(
964 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
965 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
966 ; CHECK-NEXT: [[IS_OGE_LARGEST_NORMAL:%.*]] = fcmp oge float [[FABS_ARG]], 0x47EFFFFFE0000000
967 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
968 ; CHECK-NEXT: ret float [[SELECT]]
970 %fabs.arg = call float @llvm.fabs.f32(float %arg)
971 %is.oge.largest.normal = fcmp oge float %fabs.arg, 0x47EFFFFFE0000000
972 %select = select i1 %is.oge.largest.normal, float 0x47EFFFFFE0000000, float %arg
976 ; Can't be +inf or -inf or nan
977 define float @clamp_fabs_is_ugt_largest_normal_to_largest_normal(float %arg) {
978 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_is_ugt_largest_normal_to_largest_normal(
979 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
980 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
981 ; CHECK-NEXT: [[IS_UGT_LARGEST_NORMAL:%.*]] = fcmp ugt float [[FABS_ARG]], 0x47EFFFFFE0000000
982 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
983 ; CHECK-NEXT: ret float [[SELECT]]
985 %fabs.arg = call float @llvm.fabs.f32(float %arg)
986 %is.ugt.largest.normal = fcmp ugt float %fabs.arg, 0x47EFFFFFE0000000
987 %select = select i1 %is.ugt.largest.normal, float 0x47EFFFFFE0000000, float %arg
991 ; Can't be +inf or -inf or nan
992 define float @clamp_fabs_is_uge_largest_normal_to_largest_normal(float %arg) {
993 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_is_uge_largest_normal_to_largest_normal(
994 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
995 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
996 ; CHECK-NEXT: [[IS_UGT_LARGEST_NORMAL:%.*]] = fcmp uge float [[FABS_ARG]], 0x47EFFFFFE0000000
997 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_LARGEST_NORMAL]], float 0x47EFFFFFE0000000, float [[ARG]]
998 ; CHECK-NEXT: ret float [[SELECT]]
1000 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1001 %is.ugt.largest.normal = fcmp uge float %fabs.arg, 0x47EFFFFFE0000000
1002 %select = select i1 %is.ugt.largest.normal, float 0x47EFFFFFE0000000, float %arg
1006 ;---------------------------------------------------------------------
1007 ; compare to smallest normal
1008 ;---------------------------------------------------------------------
1010 ; can't be negative or positive subnormal
1011 define float @clamp_fabs_ogt_smallest_normal_to_zero(float %arg) {
1012 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_ogt_smallest_normal_to_zero(
1013 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1014 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1015 ; CHECK-NEXT: [[IS_OGT_SMALLEST_NORMAL:%.*]] = fcmp ogt float [[FABS_ARG]], 0x3810000000000000
1016 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1017 ; CHECK-NEXT: ret float [[SELECT]]
1020 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1021 %is.ogt.smallest.normal = fcmp ogt float %fabs.arg, 0x3810000000000000
1022 %select = select i1 %is.ogt.smallest.normal, float 0.0, float %arg
1026 ; can't be negative or positive subnormal
1027 define float @clamp_fabs_oge_smallest_normal_to_zero(float %arg) {
1028 ; CHECK-LABEL: define nofpclass(inf nzero nsub norm) float @clamp_fabs_oge_smallest_normal_to_zero(
1029 ; CHECK-SAME: float nofpclass(inf nzero nsub norm) [[ARG:%.*]]) #[[ATTR2]] {
1030 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1031 ; CHECK-NEXT: [[IS_OGE_SMALLEST_NORMAL:%.*]] = fcmp oge float [[FABS_ARG]], 0x3810000000000000
1032 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1033 ; CHECK-NEXT: ret float [[SELECT]]
1035 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1036 %is.oge.smallest.normal = fcmp oge float %fabs.arg, 0x3810000000000000
1037 %select = select i1 %is.oge.smallest.normal, float 0.0, float %arg
1041 ; can't be negative or subnormal
1042 define float @clamp_fabs_olt_smallest_normal_to_zero(float %arg) {
1043 ; CHECK-LABEL: define nofpclass(ninf nzero sub nnorm) float @clamp_fabs_olt_smallest_normal_to_zero(
1044 ; CHECK-SAME: float nofpclass(ninf nzero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1045 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1046 ; CHECK-NEXT: [[IS_OLT_SMALLEST_NORMAL:%.*]] = fcmp olt float [[FABS_ARG]], 0x3810000000000000
1047 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1048 ; CHECK-NEXT: ret float [[SELECT]]
1050 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1051 %is.olt.smallest.normal = fcmp olt float %fabs.arg, 0x3810000000000000
1052 %select = select i1 %is.olt.smallest.normal, float 0.0, float %arg
1056 ; can't be negative or subnormal
1057 define float @clamp_fabs_ole_smallest_normal_to_zero(float %arg) {
1058 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_ole_smallest_normal_to_zero(
1059 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1060 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1061 ; CHECK-NEXT: [[IS_OLE_SMALLEST_NORMAL:%.*]] = fcmp ole float [[FABS_ARG]], 0x3810000000000000
1062 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1063 ; CHECK-NEXT: ret float [[SELECT]]
1065 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1066 %is.ole.smallest.normal = fcmp ole float %fabs.arg, 0x3810000000000000
1067 %select = select i1 %is.ole.smallest.normal, float 0.0, float %arg
1071 define float @clamp_fabs_is_is_olt_smallest_normal_to_0(float %arg) {
1072 ; CHECK-LABEL: define nofpclass(ninf nzero sub nnorm) float @clamp_fabs_is_is_olt_smallest_normal_to_0(
1073 ; CHECK-SAME: float nofpclass(ninf nzero sub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1074 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1075 ; CHECK-NEXT: [[IS_OLT_SMALLEST_NORMAL:%.*]] = fcmp olt float [[FABS_ARG]], 0x3810000000000000
1076 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_SMALLEST_NORMAL]], float 0.000000e+00, float [[ARG]]
1077 ; CHECK-NEXT: ret float [[SELECT]]
1079 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1080 %is.olt.smallest.normal = fcmp olt float %fabs.arg, 0x3810000000000000
1081 %select = select i1 %is.olt.smallest.normal, float 0.0, float %arg
1085 define float @clamp_fabs_is_is_ole_smallest_normal_to_0(float %arg) {
1086 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_is_is_ole_smallest_normal_to_0(
1087 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[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_oeq_smallest_normal_to_zero(float %arg) {
1100 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_oeq_smallest_normal_to_zero(
1101 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1102 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1103 ; CHECK-NEXT: [[IS_OEQ_SMALLEST_NORMAL:%.*]] = fcmp oeq float [[FABS_ARG]], 0x3810000000000000
1104 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OEQ_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.oeq.smallest.normal = fcmp oeq float %fabs.arg, 0x3810000000000000
1109 %select = select i1 %is.oeq.smallest.normal, float 0.0, float %arg
1113 define float @clamp_fabs_one_smallest_normal_to_zero(float %arg) {
1114 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_one_smallest_normal_to_zero(
1115 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1116 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1117 ; CHECK-NEXT: [[IS_ONE_SMALLEST_NORMAL:%.*]] = fcmp one float [[FABS_ARG]], 0x3810000000000000
1118 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ONE_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.one.smallest.normal = fcmp one float %fabs.arg, 0x3810000000000000
1123 %select = select i1 %is.one.smallest.normal, float 0.0, float %arg
1127 define float @clamp_fabs_ueq_smallest_normal_to_zero(float %arg) {
1128 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_ueq_smallest_normal_to_zero(
1129 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1130 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1131 ; CHECK-NEXT: [[IS_UEQ_SMALLEST_NORMAL:%.*]] = fcmp ueq float [[FABS_ARG]], 0x3810000000000000
1132 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UEQ_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.ueq.smallest.normal = fcmp ueq float %fabs.arg, 0x3810000000000000
1137 %select = select i1 %is.ueq.smallest.normal, float 0.0, float %arg
1141 define float @clamp_fabs_une_smallest_normal_to_zero(float %arg) {
1142 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_une_smallest_normal_to_zero(
1143 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1144 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1145 ; CHECK-NEXT: [[IS_UNE_SMALLEST_NORMAL:%.*]] = fcmp une float [[FABS_ARG]], 0x3810000000000000
1146 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UNE_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.une.smallest.normal = fcmp une float %fabs.arg, 0x3810000000000000
1151 %select = select i1 %is.une.smallest.normal, float 0.0, float %arg
1155 ;---------------------------------------------------------------------
1156 ; compare fabs to negative normal
1157 ;---------------------------------------------------------------------
1159 define float @clamp_fabs_olt_neg1_to_neg1(float %arg) {
1160 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_olt_neg1_to_neg1(
1161 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1162 ; CHECK-NEXT: ret float [[ARG]]
1164 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1165 %fabs.is.olt.neg1 = fcmp olt float %fabs.arg, -1.0
1166 %select = select i1 %fabs.is.olt.neg1, float -1.0, float %arg
1170 define float @clamp_fabs_ole_neg1_to_neg1(float %arg) {
1171 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_ole_neg1_to_neg1(
1172 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1173 ; CHECK-NEXT: ret float [[ARG]]
1175 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1176 %fabs.is.ole.neg1 = fcmp ole float %fabs.arg, -1.0
1177 %select = select i1 %fabs.is.ole.neg1, float -1.0, float %arg
1181 define float @clamp_fabs_ult_neg1_to_neg1(float %arg) {
1182 ; CHECK-LABEL: define nofpclass(ninf nzero nsub) float @clamp_fabs_ult_neg1_to_neg1(
1183 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1184 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1185 ; CHECK-NEXT: [[FABS_IS_ULT_NEG1:%.*]] = fcmp ult float [[FABS_ARG]], -1.000000e+00
1186 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ULT_NEG1]], float -1.000000e+00, float [[ARG]]
1187 ; CHECK-NEXT: ret float [[SELECT]]
1189 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1190 %fabs.is.ult.neg1 = fcmp ult float %fabs.arg, -1.0
1191 %select = select i1 %fabs.is.ult.neg1, float -1.0, float %arg
1195 define float @clamp_fabs_ule_neg1_to_neg1(float %arg) {
1196 ; CHECK-LABEL: define nofpclass(ninf nzero nsub) float @clamp_fabs_ule_neg1_to_neg1(
1197 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1198 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1199 ; CHECK-NEXT: [[FABS_IS_ULE_NEG1:%.*]] = fcmp ule float [[FABS_ARG]], -1.000000e+00
1200 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ULE_NEG1]], float -1.000000e+00, float [[ARG]]
1201 ; CHECK-NEXT: ret float [[SELECT]]
1203 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1204 %fabs.is.ule.neg1 = fcmp ule float %fabs.arg, -1.0
1205 %select = select i1 %fabs.is.ule.neg1, float -1.0, float %arg
1209 define float @clamp_fabs_ogt_neg1_to_neg1(float %arg) {
1210 ; CHECK-LABEL: define nofpclass(ninf nzero nsub) float @clamp_fabs_ogt_neg1_to_neg1(
1211 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1212 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1213 ; CHECK-NEXT: [[FABS_IS_OGT_NEG1:%.*]] = fcmp ogt float [[FABS_ARG]], -1.000000e+00
1214 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OGT_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.ogt.neg1 = fcmp ogt float %fabs.arg, -1.0
1219 %select = select i1 %fabs.is.ogt.neg1, float -1.0, float %arg
1223 define float @clamp_fabs_oge_neg1_to_neg1(float %arg) {
1224 ; CHECK-LABEL: define nofpclass(ninf nzero nsub) float @clamp_fabs_oge_neg1_to_neg1(
1225 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1226 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1227 ; CHECK-NEXT: [[FABS_IS_OGE_NEG1:%.*]] = fcmp oge float [[FABS_ARG]], -1.000000e+00
1228 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_OGE_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.oge.neg1 = fcmp oge float %fabs.arg, -1.0
1233 %select = select i1 %fabs.is.oge.neg1, float -1.0, float %arg
1237 define float @clamp_fabs_ugt_neg1_to_neg1(float %arg) {
1238 ; CHECK-LABEL: define noundef nofpclass(nan inf zero sub pnorm) float @clamp_fabs_ugt_neg1_to_neg1(
1239 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1240 ; CHECK-NEXT: ret float -1.000000e+00
1242 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1243 %fabs.is.ugt.neg1 = fcmp ugt float %fabs.arg, -1.0
1244 %select = select i1 %fabs.is.ugt.neg1, float -1.0, float %arg
1248 define float @clamp_fabs_uge_neg1_to_neg1(float %arg) {
1249 ; CHECK-LABEL: define noundef nofpclass(nan inf zero sub pnorm) float @clamp_fabs_uge_neg1_to_neg1(
1250 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1251 ; CHECK-NEXT: ret float -1.000000e+00
1253 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1254 %fabs.is.uge.neg1 = fcmp uge float %fabs.arg, -1.0
1255 %select = select i1 %fabs.is.uge.neg1, float -1.0, float %arg
1259 define float @clamp_fabs_oeq_neg1_to_neg1(float %arg) {
1260 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @clamp_fabs_oeq_neg1_to_neg1(
1261 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1262 ; CHECK-NEXT: ret float [[ARG]]
1264 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1265 %fabs.is.oeq.neg1 = fcmp oeq float %fabs.arg, -1.0
1266 %select = select i1 %fabs.is.oeq.neg1, float -1.0, float %arg
1270 define float @clamp_fabs_ueq_neg1_to_neg1(float %arg) {
1271 ; CHECK-LABEL: define nofpclass(ninf nzero nsub) float @clamp_fabs_ueq_neg1_to_neg1(
1272 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1273 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1274 ; CHECK-NEXT: [[FABS_IS_UEQ_NEG1:%.*]] = fcmp ueq float [[FABS_ARG]], -1.000000e+00
1275 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_UEQ_NEG1]], float -1.000000e+00, float [[ARG]]
1276 ; CHECK-NEXT: ret float [[SELECT]]
1278 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1279 %fabs.is.ueq.neg1 = fcmp ueq float %fabs.arg, -1.0
1280 %select = select i1 %fabs.is.ueq.neg1, float -1.0, float %arg
1284 define float @clamp_fabs_one_neg1_to_neg1(float %arg) {
1285 ; CHECK-LABEL: define nofpclass(ninf nzero nsub) float @clamp_fabs_one_neg1_to_neg1(
1286 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1287 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1288 ; CHECK-NEXT: [[FABS_IS_ONE_NEG1:%.*]] = fcmp one float [[FABS_ARG]], -1.000000e+00
1289 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[FABS_IS_ONE_NEG1]], float -1.000000e+00, float [[ARG]]
1290 ; CHECK-NEXT: ret float [[SELECT]]
1292 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1293 %fabs.is.one.neg1 = fcmp one float %fabs.arg, -1.0
1294 %select = select i1 %fabs.is.one.neg1, float -1.0, float %arg
1298 define float @clamp_fabs_une_neg1_to_neg1(float %arg) {
1299 ; CHECK-LABEL: define noundef nofpclass(nan inf zero sub pnorm) float @clamp_fabs_une_neg1_to_neg1(
1300 ; CHECK-SAME: float nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR2]] {
1301 ; CHECK-NEXT: ret float -1.000000e+00
1303 %fabs.arg = call float @llvm.fabs.f32(float %arg)
1304 %fabs.is.une.neg1 = fcmp une float %fabs.arg, -1.0
1305 %select = select i1 %fabs.is.une.neg1, float -1.0, float %arg
1309 ;---------------------------------------------------------------------
1310 ; assume > < to normal
1311 ;---------------------------------------------------------------------
1313 define float @ret_assumed_ogt_1(float %arg) {
1314 ; CHECK-LABEL: define float @ret_assumed_ogt_1(
1315 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3:[0-9]+]] {
1316 ; CHECK-NEXT: [[OGT_1:%.*]] = fcmp ogt float [[ARG]], 1.000000e+00
1317 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_1]]) #[[ATTR5:[0-9]+]]
1318 ; CHECK-NEXT: ret float [[ARG]]
1320 %ogt.1 = fcmp ogt float %arg, 1.0
1321 call void @llvm.assume(i1 %ogt.1)
1325 define float @ret_assumed_oge_1(float %arg) {
1326 ; CHECK-LABEL: define float @ret_assumed_oge_1(
1327 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1328 ; CHECK-NEXT: [[OGE_1:%.*]] = fcmp ogt float [[ARG]], 1.000000e+00
1329 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_1]]) #[[ATTR5]]
1330 ; CHECK-NEXT: ret float [[ARG]]
1332 %oge.1 = fcmp ogt float %arg, 1.0
1333 call void @llvm.assume(i1 %oge.1)
1337 define float @ret_assumed_olt_1(float %arg) {
1338 ; CHECK-LABEL: define float @ret_assumed_olt_1(
1339 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1340 ; CHECK-NEXT: [[OLT_1:%.*]] = fcmp olt float [[ARG]], 1.000000e+00
1341 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLT_1]]) #[[ATTR5]]
1342 ; CHECK-NEXT: ret float [[ARG]]
1344 %olt.1 = fcmp olt float %arg, 1.0
1345 call void @llvm.assume(i1 %olt.1)
1349 define float @ret_assumed_ole_1(float %arg) {
1350 ; CHECK-LABEL: define float @ret_assumed_ole_1(
1351 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1352 ; CHECK-NEXT: [[OLE_1:%.*]] = fcmp ole float [[ARG]], 1.000000e+00
1353 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLE_1]]) #[[ATTR5]]
1354 ; CHECK-NEXT: ret float [[ARG]]
1356 %ole.1 = fcmp ole float %arg, 1.0
1357 call void @llvm.assume(i1 %ole.1)
1361 define float @ret_assumed_ugt_1(float %arg) {
1362 ; CHECK-LABEL: define float @ret_assumed_ugt_1(
1363 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1364 ; CHECK-NEXT: [[UGT_1:%.*]] = fcmp ugt float [[ARG]], 1.000000e+00
1365 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_1]]) #[[ATTR5]]
1366 ; CHECK-NEXT: ret float [[ARG]]
1368 %ugt.1 = fcmp ugt float %arg, 1.0
1369 call void @llvm.assume(i1 %ugt.1)
1373 define float @ret_assumed_uge_1(float %arg) {
1374 ; CHECK-LABEL: define float @ret_assumed_uge_1(
1375 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1376 ; CHECK-NEXT: [[UGE_1:%.*]] = fcmp uge float [[ARG]], 1.000000e+00
1377 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_1]]) #[[ATTR5]]
1378 ; CHECK-NEXT: ret float [[ARG]]
1380 %uge.1 = fcmp uge float %arg, 1.0
1381 call void @llvm.assume(i1 %uge.1)
1385 define float @ret_assumed_ult_1(float %arg) {
1386 ; CHECK-LABEL: define float @ret_assumed_ult_1(
1387 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1388 ; CHECK-NEXT: [[ULT_1:%.*]] = fcmp ult float [[ARG]], 1.000000e+00
1389 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULT_1]]) #[[ATTR5]]
1390 ; CHECK-NEXT: ret float [[ARG]]
1392 %ult.1 = fcmp ult float %arg, 1.0
1393 call void @llvm.assume(i1 %ult.1)
1397 define float @ret_assumed_ule_1(float %arg) {
1398 ; CHECK-LABEL: define float @ret_assumed_ule_1(
1399 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1400 ; CHECK-NEXT: [[ULE_1:%.*]] = fcmp ule float [[ARG]], 1.000000e+00
1401 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULE_1]]) #[[ATTR5]]
1402 ; CHECK-NEXT: ret float [[ARG]]
1404 %ule.1 = fcmp ule float %arg, 1.0
1405 call void @llvm.assume(i1 %ule.1)
1409 define float @ret_assumed_fabs_ogt_1(float %arg) {
1410 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_ogt_1(
1411 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1412 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1413 ; CHECK-NEXT: [[OGT_1:%.*]] = fcmp ogt float [[ARG_FABS]], 1.000000e+00
1414 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_1]]) #[[ATTR5]]
1415 ; CHECK-NEXT: ret float [[ARG]]
1417 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1418 %ogt.1 = fcmp ogt float %arg.fabs, 1.0
1419 call void @llvm.assume(i1 %ogt.1)
1423 define float @ret_assumed_fabs_oge_1(float %arg) {
1424 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_oge_1(
1425 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1426 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1427 ; CHECK-NEXT: [[OGE_1:%.*]] = fcmp oge float [[ARG_FABS]], 1.000000e+00
1428 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_1]]) #[[ATTR5]]
1429 ; CHECK-NEXT: ret float [[ARG]]
1431 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1432 %oge.1 = fcmp oge float %arg.fabs, 1.0
1433 call void @llvm.assume(i1 %oge.1)
1437 define float @ret_assumed_fabs_olt_1(float %arg) {
1438 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_olt_1(
1439 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1440 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1441 ; CHECK-NEXT: [[OLT_1:%.*]] = fcmp olt float [[ARG_FABS]], 1.000000e+00
1442 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLT_1]]) #[[ATTR5]]
1443 ; CHECK-NEXT: ret float [[ARG]]
1445 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1446 %olt.1 = fcmp olt float %arg.fabs, 1.0
1447 call void @llvm.assume(i1 %olt.1)
1451 define float @ret_assumed_fabs_ole_1(float %arg) {
1452 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_ole_1(
1453 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1454 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1455 ; CHECK-NEXT: [[OLE_1:%.*]] = fcmp olt float [[ARG_FABS]], 1.000000e+00
1456 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLE_1]]) #[[ATTR5]]
1457 ; CHECK-NEXT: ret float [[ARG]]
1459 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1460 %ole.1 = fcmp olt float %arg.fabs, 1.0
1461 call void @llvm.assume(i1 %ole.1)
1465 define float @ret_assumed_fabs_ugt_1(float %arg) {
1466 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_ugt_1(
1467 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1468 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1469 ; CHECK-NEXT: [[UGT_1:%.*]] = fcmp ugt float [[ARG_FABS]], 1.000000e+00
1470 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_1]]) #[[ATTR5]]
1471 ; CHECK-NEXT: ret float [[ARG]]
1473 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1474 %ugt.1 = fcmp ugt float %arg.fabs, 1.0
1475 call void @llvm.assume(i1 %ugt.1)
1479 define float @ret_assumed_fabs_uge_1(float %arg) {
1480 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_uge_1(
1481 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1482 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1483 ; CHECK-NEXT: [[UGE_1:%.*]] = fcmp ugt float [[ARG_FABS]], 1.000000e+00
1484 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_1]]) #[[ATTR5]]
1485 ; CHECK-NEXT: ret float [[ARG]]
1487 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1488 %uge.1 = fcmp ugt float %arg.fabs, 1.0
1489 call void @llvm.assume(i1 %uge.1)
1493 define float @ret_assumed_fabs_ult_1(float %arg) {
1494 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_ult_1(
1495 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1496 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1497 ; CHECK-NEXT: [[ULT_1:%.*]] = fcmp ult float [[ARG_FABS]], 1.000000e+00
1498 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULT_1]]) #[[ATTR5]]
1499 ; CHECK-NEXT: ret float [[ARG]]
1501 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1502 %ult.1 = fcmp ult float %arg.fabs, 1.0
1503 call void @llvm.assume(i1 %ult.1)
1507 define float @ret_assumed_fabs_ule_1(float %arg) {
1508 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_ule_1(
1509 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1510 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1511 ; CHECK-NEXT: [[ULE_1:%.*]] = fcmp ule float [[ARG_FABS]], 1.000000e+00
1512 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULE_1]]) #[[ATTR5]]
1513 ; CHECK-NEXT: ret float [[ARG]]
1515 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1516 %ule.1 = fcmp ule float %arg.fabs, 1.0
1517 call void @llvm.assume(i1 %ule.1)
1521 define float @ret_assumed_ogt_neg1(float %arg) {
1522 ; CHECK-LABEL: define float @ret_assumed_ogt_neg1(
1523 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1524 ; CHECK-NEXT: [[OGT_NEG1:%.*]] = fcmp ogt float [[ARG]], -1.000000e+00
1525 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_NEG1]]) #[[ATTR5]]
1526 ; CHECK-NEXT: ret float [[ARG]]
1528 %ogt.neg1 = fcmp ogt float %arg, -1.0
1529 call void @llvm.assume(i1 %ogt.neg1)
1533 define float @ret_assumed_oge_neg1(float %arg) {
1534 ; CHECK-LABEL: define float @ret_assumed_oge_neg1(
1535 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1536 ; CHECK-NEXT: [[OGE_NEG1:%.*]] = fcmp ogt float [[ARG]], -1.000000e+00
1537 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_NEG1]]) #[[ATTR5]]
1538 ; CHECK-NEXT: ret float [[ARG]]
1540 %oge.neg1 = fcmp ogt float %arg, -1.0
1541 call void @llvm.assume(i1 %oge.neg1)
1545 define float @ret_assumed_olt_neg1(float %arg) {
1546 ; CHECK-LABEL: define float @ret_assumed_olt_neg1(
1547 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1548 ; CHECK-NEXT: [[OLT_NEG1:%.*]] = fcmp olt float [[ARG]], -1.000000e+00
1549 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLT_NEG1]]) #[[ATTR5]]
1550 ; CHECK-NEXT: ret float [[ARG]]
1552 %olt.neg1 = fcmp olt float %arg, -1.0
1553 call void @llvm.assume(i1 %olt.neg1)
1557 define float @ret_assumed_ole_neg1(float %arg) {
1558 ; CHECK-LABEL: define float @ret_assumed_ole_neg1(
1559 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1560 ; CHECK-NEXT: [[OLE_NEG1:%.*]] = fcmp ole float [[ARG]], -1.000000e+00
1561 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLE_NEG1]]) #[[ATTR5]]
1562 ; CHECK-NEXT: ret float [[ARG]]
1564 %ole.neg1 = fcmp ole float %arg, -1.0
1565 call void @llvm.assume(i1 %ole.neg1)
1569 define float @ret_assumed_ugt_neg1(float %arg) {
1570 ; CHECK-LABEL: define float @ret_assumed_ugt_neg1(
1571 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1572 ; CHECK-NEXT: [[UGT_NEG1:%.*]] = fcmp ugt float [[ARG]], -1.000000e+00
1573 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_NEG1]]) #[[ATTR5]]
1574 ; CHECK-NEXT: ret float [[ARG]]
1576 %ugt.neg1 = fcmp ugt float %arg, -1.0
1577 call void @llvm.assume(i1 %ugt.neg1)
1581 define float @ret_assumed_uge_neg1(float %arg) {
1582 ; CHECK-LABEL: define float @ret_assumed_uge_neg1(
1583 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1584 ; CHECK-NEXT: [[UGE_NEG1:%.*]] = fcmp uge float [[ARG]], -1.000000e+00
1585 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_NEG1]]) #[[ATTR5]]
1586 ; CHECK-NEXT: ret float [[ARG]]
1588 %uge.neg1 = fcmp uge float %arg, -1.0
1589 call void @llvm.assume(i1 %uge.neg1)
1593 define float @ret_assumed_ult_neg1(float %arg) {
1594 ; CHECK-LABEL: define float @ret_assumed_ult_neg1(
1595 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1596 ; CHECK-NEXT: [[ULT_NEG1:%.*]] = fcmp ult float [[ARG]], -1.000000e+00
1597 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULT_NEG1]]) #[[ATTR5]]
1598 ; CHECK-NEXT: ret float [[ARG]]
1600 %ult.neg1 = fcmp ult float %arg, -1.0
1601 call void @llvm.assume(i1 %ult.neg1)
1605 define float @ret_assumed_ule_neg1(float %arg) {
1606 ; CHECK-LABEL: define float @ret_assumed_ule_neg1(
1607 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1608 ; CHECK-NEXT: [[ULE_NEG1:%.*]] = fcmp ule float [[ARG]], -1.000000e+00
1609 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULE_NEG1]]) #[[ATTR5]]
1610 ; CHECK-NEXT: ret float [[ARG]]
1612 %ule.neg1 = fcmp ule float %arg, -1.0
1613 call void @llvm.assume(i1 %ule.neg1)
1617 define float @ret_assumed_oeq_1(float %arg) {
1618 ; CHECK-LABEL: define float @ret_assumed_oeq_1(
1619 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1620 ; CHECK-NEXT: [[OEQ_1:%.*]] = fcmp oeq float [[ARG]], 1.000000e+00
1621 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OEQ_1]]) #[[ATTR5]]
1622 ; CHECK-NEXT: ret float [[ARG]]
1624 %oeq.1 = fcmp oeq float %arg, 1.0
1625 call void @llvm.assume(i1 %oeq.1)
1629 define float @ret_assumed_ueq_1(float %arg) {
1630 ; CHECK-LABEL: define float @ret_assumed_ueq_1(
1631 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1632 ; CHECK-NEXT: [[UEQ_1:%.*]] = fcmp ueq float [[ARG]], 1.000000e+00
1633 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UEQ_1]]) #[[ATTR5]]
1634 ; CHECK-NEXT: ret float [[ARG]]
1636 %ueq.1 = fcmp ueq float %arg, 1.0
1637 call void @llvm.assume(i1 %ueq.1)
1641 define float @ret_assumed_one_1(float %arg) {
1642 ; CHECK-LABEL: define float @ret_assumed_one_1(
1643 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1644 ; CHECK-NEXT: [[ONE_1:%.*]] = fcmp one float [[ARG]], 1.000000e+00
1645 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ONE_1]]) #[[ATTR5]]
1646 ; CHECK-NEXT: ret float [[ARG]]
1648 %one.1 = fcmp one float %arg, 1.0
1649 call void @llvm.assume(i1 %one.1)
1653 define float @ret_assumed_one_neg1(float %arg) {
1654 ; CHECK-LABEL: define float @ret_assumed_one_neg1(
1655 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1656 ; CHECK-NEXT: [[ONE_NEG1:%.*]] = fcmp one float [[ARG]], -1.000000e+00
1657 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ONE_NEG1]]) #[[ATTR5]]
1658 ; CHECK-NEXT: ret float [[ARG]]
1660 %one.neg1 = fcmp one float %arg, -1.0
1661 call void @llvm.assume(i1 %one.neg1)
1665 define float @ret_assumed_une_neg1(float %arg) {
1666 ; CHECK-LABEL: define float @ret_assumed_une_neg1(
1667 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1668 ; CHECK-NEXT: [[UNE_NEG1:%.*]] = fcmp une float [[ARG]], -1.000000e+00
1669 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UNE_NEG1]]) #[[ATTR5]]
1670 ; CHECK-NEXT: ret float [[ARG]]
1672 %une.neg1 = fcmp une float %arg, -1.0
1673 call void @llvm.assume(i1 %une.neg1)
1677 define float @ret_assumed_une_1(float %arg) {
1678 ; CHECK-LABEL: define float @ret_assumed_une_1(
1679 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
1680 ; CHECK-NEXT: [[UNE_1:%.*]] = fcmp une float [[ARG]], 1.000000e+00
1681 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UNE_1]]) #[[ATTR5]]
1682 ; CHECK-NEXT: ret float [[ARG]]
1684 %une.1 = fcmp une float %arg, 1.0
1685 call void @llvm.assume(i1 %une.1)
1689 define float @ret_assumed_fabs_oeq_1(float %arg) {
1690 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_oeq_1(
1691 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1692 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1693 ; CHECK-NEXT: [[OEQ_1:%.*]] = fcmp oeq float [[ARG_FABS]], 1.000000e+00
1694 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OEQ_1]]) #[[ATTR5]]
1695 ; CHECK-NEXT: ret float [[ARG]]
1697 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1698 %oeq.1 = fcmp oeq float %arg.fabs, 1.0
1699 call void @llvm.assume(i1 %oeq.1)
1703 define float @ret_assumed_fabs_ueq_1(float %arg) {
1704 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_ueq_1(
1705 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1706 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1707 ; CHECK-NEXT: [[UEQ_1:%.*]] = fcmp ueq float [[ARG_FABS]], 1.000000e+00
1708 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UEQ_1]]) #[[ATTR5]]
1709 ; CHECK-NEXT: ret float [[ARG]]
1711 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1712 %ueq.1 = fcmp ueq float %arg.fabs, 1.0
1713 call void @llvm.assume(i1 %ueq.1)
1717 define float @ret_assumed_fabs_one_1(float %arg) {
1718 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_one_1(
1719 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1720 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1721 ; CHECK-NEXT: [[ONE_1:%.*]] = fcmp one float [[ARG_FABS]], 1.000000e+00
1722 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ONE_1]]) #[[ATTR5]]
1723 ; CHECK-NEXT: ret float [[ARG]]
1725 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1726 %one.1 = fcmp one float %arg.fabs, 1.0
1727 call void @llvm.assume(i1 %one.1)
1731 define float @ret_assumed_fabs_une_1(float %arg) {
1732 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_une_1(
1733 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1734 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1735 ; CHECK-NEXT: [[UNE_1:%.*]] = fcmp one float [[ARG_FABS]], 1.000000e+00
1736 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UNE_1]]) #[[ATTR5]]
1737 ; CHECK-NEXT: ret float [[ARG]]
1739 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1740 %une.1 = fcmp one float %arg.fabs, 1.0
1741 call void @llvm.assume(i1 %une.1)
1745 define float @ret_assumed_fabs_oeq_neg1(float %arg) {
1746 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_oeq_neg1(
1747 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1748 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
1749 ; CHECK-NEXT: ret float [[ARG]]
1751 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1752 %oeq.neg1 = fcmp oeq float %arg.fabs, -1.0
1753 call void @llvm.assume(i1 %oeq.neg1)
1757 define float @ret_assumed_fabs_ueq_neg1(float %arg) {
1758 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_ueq_neg1(
1759 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1760 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1761 ; CHECK-NEXT: [[UEQ_NEG1:%.*]] = fcmp ueq float [[ARG_FABS]], -1.000000e+00
1762 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UEQ_NEG1]]) #[[ATTR5]]
1763 ; CHECK-NEXT: ret float [[ARG]]
1765 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1766 %ueq.neg1 = fcmp ueq float %arg.fabs, -1.0
1767 call void @llvm.assume(i1 %ueq.neg1)
1771 define float @ret_assumed_fabs_one_neg1(float %arg) {
1772 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_one_neg1(
1773 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1774 ; CHECK-NEXT: [[ARG_FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
1775 ; CHECK-NEXT: [[ONE_NEG1:%.*]] = fcmp one float [[ARG_FABS]], -1.000000e+00
1776 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ONE_NEG1]]) #[[ATTR5]]
1777 ; CHECK-NEXT: ret float [[ARG]]
1779 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1780 %one.neg1 = fcmp one float %arg.fabs, -1.0
1781 call void @llvm.assume(i1 %one.neg1)
1785 define float @ret_assumed_fabs_une_neg1(float %arg) {
1786 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @ret_assumed_fabs_une_neg1(
1787 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
1788 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
1789 ; CHECK-NEXT: ret float [[ARG]]
1791 %arg.fabs = call float @llvm.fabs.f32(float %arg)
1792 %une.neg1 = fcmp une float %arg.fabs, -1.0
1793 call void @llvm.assume(i1 %une.neg1)
1797 ;---------------------------------------------------------------------
1798 ; compare > fabs(variable)
1799 ;---------------------------------------------------------------------
1802 define float @clamp_is_ogt_known_positive_to_1(float %arg, float %unknown) {
1803 ; CHECK-LABEL: define float @clamp_is_ogt_known_positive_to_1(
1804 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1805 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1806 ; CHECK-NEXT: [[IS_OGT_KNOWN_POSITIVE:%.*]] = fcmp ogt float [[ARG]], [[KNOWN_POSITIVE]]
1807 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1808 ; CHECK-NEXT: ret float [[SELECT]]
1810 %known.positive = call float @llvm.fabs.f32(float %unknown)
1811 %is.ogt.known.positive = fcmp ogt float %arg, %known.positive
1812 %select = select i1 %is.ogt.known.positive, float 1.0, float %arg
1816 define float @clamp_is_oge_known_positive_to_1(float %arg, float %unknown) {
1817 ; CHECK-LABEL: define float @clamp_is_oge_known_positive_to_1(
1818 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1819 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1820 ; CHECK-NEXT: [[IS_OGE_KNOWN_POSITIVE:%.*]] = fcmp oge float [[ARG]], [[KNOWN_POSITIVE]]
1821 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_KNOWN_POSITIVE]], float 1.000000e+00, float [[ARG]]
1822 ; CHECK-NEXT: ret float [[SELECT]]
1824 %known.positive = call float @llvm.fabs.f32(float %unknown)
1825 %is.oge.known.positive = fcmp oge float %arg, %known.positive
1826 %select = select i1 %is.oge.known.positive, float 1.0, float %arg
1830 define float @clamp_is_olt_known_positive_to_1(float %arg, float %unknown) {
1831 ; CHECK-LABEL: define float @clamp_is_olt_known_positive_to_1(
1832 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1833 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1834 ; CHECK-NEXT: [[IS_OLT_KNOWN_POSITIVE:%.*]] = fcmp olt float [[ARG]], [[KNOWN_POSITIVE]]
1835 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_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.olt.known.positive = fcmp olt float %arg, %known.positive
1840 %select = select i1 %is.olt.known.positive, float 1.0, float %arg
1844 define float @clamp_is_ole_known_positive_to_1(float %arg, float %unknown) {
1845 ; CHECK-LABEL: define float @clamp_is_ole_known_positive_to_1(
1846 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1847 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1848 ; CHECK-NEXT: [[IS_OLE_KNOWN_POSITIVE:%.*]] = fcmp olt float [[ARG]], [[KNOWN_POSITIVE]]
1849 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_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.ole.known.positive = fcmp olt float %arg, %known.positive
1854 %select = select i1 %is.ole.known.positive, float 1.0, float %arg
1858 define float @clamp_is_ugt_known_positive_to_1(float %arg, float %unknown) {
1859 ; CHECK-LABEL: define float @clamp_is_ugt_known_positive_to_1(
1860 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1861 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1862 ; CHECK-NEXT: [[IS_UGT_KNOWN_POSITIVE:%.*]] = fcmp ugt float [[ARG]], [[KNOWN_POSITIVE]]
1863 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_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.ugt.known.positive = fcmp ugt float %arg, %known.positive
1868 %select = select i1 %is.ugt.known.positive, float 1.0, float %arg
1872 define float @clamp_is_uge_known_positive_to_1(float %arg, float %unknown) {
1873 ; CHECK-LABEL: define float @clamp_is_uge_known_positive_to_1(
1874 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1875 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1876 ; CHECK-NEXT: [[IS_UGE_KNOWN_POSITIVE:%.*]] = fcmp uge float [[ARG]], [[KNOWN_POSITIVE]]
1877 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGE_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.uge.known.positive = fcmp uge float %arg, %known.positive
1882 %select = select i1 %is.uge.known.positive, float 1.0, float %arg
1886 define float @clamp_is_ult_known_positive_to_1(float %arg, float %unknown) {
1887 ; CHECK-LABEL: define float @clamp_is_ult_known_positive_to_1(
1888 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1889 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1890 ; CHECK-NEXT: [[IS_ULT_KNOWN_POSITIVE:%.*]] = fcmp ult float [[ARG]], [[KNOWN_POSITIVE]]
1891 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULT_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.ult.known.positive = fcmp ult float %arg, %known.positive
1896 %select = select i1 %is.ult.known.positive, float 1.0, float %arg
1900 define float @clamp_is_ule_known_positive_to_1(float %arg, float %unknown) {
1901 ; CHECK-LABEL: define float @clamp_is_ule_known_positive_to_1(
1902 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1903 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1904 ; CHECK-NEXT: [[IS_ULE_KNOWN_POSITIVE:%.*]] = fcmp ult float [[ARG]], [[KNOWN_POSITIVE]]
1905 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULE_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.ule.known.positive = fcmp ult float %arg, %known.positive
1910 %select = select i1 %is.ule.known.positive, float 1.0, float %arg
1914 define float @clamp_is_olt_known_negative_to_neg1(float %arg, float %unknown) {
1915 ; CHECK-LABEL: define float @clamp_is_olt_known_negative_to_neg1(
1916 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1917 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1918 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1919 ; CHECK-NEXT: [[IS_OLT_NEGATIVE:%.*]] = fcmp olt float [[ARG]], [[KNOWN_NEGATIVE]]
1920 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLT_NEGATIVE]], float -1.000000e+00, float [[ARG]]
1921 ; CHECK-NEXT: ret float [[SELECT]]
1923 %known.positive = call float @llvm.fabs.f32(float %unknown)
1924 %known.negative = fneg float %known.positive
1925 %is.olt.negative = fcmp olt float %arg, %known.negative
1926 %select = select i1 %is.olt.negative, float -1.0, float %arg
1930 define float @clamp_is_ole_known_negative_to_neg1(float %arg, float %unknown) {
1931 ; CHECK-LABEL: define float @clamp_is_ole_known_negative_to_neg1(
1932 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1933 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1934 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1935 ; CHECK-NEXT: [[IS_OLE_NEGATIVE:%.*]] = fcmp ole float [[ARG]], [[KNOWN_NEGATIVE]]
1936 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OLE_NEGATIVE]], float -1.000000e+00, float [[ARG]]
1937 ; CHECK-NEXT: ret float [[SELECT]]
1939 %known.positive = call float @llvm.fabs.f32(float %unknown)
1940 %known.negative = fneg float %known.positive
1941 %is.ole.negative = fcmp ole float %arg, %known.negative
1942 %select = select i1 %is.ole.negative, float -1.0, float %arg
1946 define float @clamp_is_ogt_known_negative_to_neg1(float %arg, float %unknown) {
1947 ; CHECK-LABEL: define float @clamp_is_ogt_known_negative_to_neg1(
1948 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1949 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1950 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1951 ; CHECK-NEXT: [[IS_OGT_NEGATIVE:%.*]] = fcmp ogt float [[ARG]], [[KNOWN_NEGATIVE]]
1952 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGT_NEGATIVE]], float -1.000000e+00, float [[ARG]]
1953 ; CHECK-NEXT: ret float [[SELECT]]
1955 %known.positive = call float @llvm.fabs.f32(float %unknown)
1956 %known.negative = fneg float %known.positive
1957 %is.ogt.negative = fcmp ogt float %arg, %known.negative
1958 %select = select i1 %is.ogt.negative, float -1.0, float %arg
1962 define float @clamp_is_oge_known_negative_to_neg1(float %arg, float %unknown) {
1963 ; CHECK-LABEL: define float @clamp_is_oge_known_negative_to_neg1(
1964 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1965 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1966 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1967 ; CHECK-NEXT: [[IS_OGE_NEGATIVE:%.*]] = fcmp oge float [[ARG]], [[KNOWN_NEGATIVE]]
1968 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_OGE_NEGATIVE]], float -1.000000e+00, float [[ARG]]
1969 ; CHECK-NEXT: ret float [[SELECT]]
1971 %known.positive = call float @llvm.fabs.f32(float %unknown)
1972 %known.negative = fneg float %known.positive
1973 %is.oge.negative = fcmp oge float %arg, %known.negative
1974 %select = select i1 %is.oge.negative, float -1.0, float %arg
1978 define float @clamp_is_ult_known_negative_to_neg1(float %arg, float %unknown) {
1979 ; CHECK-LABEL: define float @clamp_is_ult_known_negative_to_neg1(
1980 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1981 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1982 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1983 ; CHECK-NEXT: [[IS_ULT_NEGATIVE:%.*]] = fcmp ult float [[ARG]], [[KNOWN_NEGATIVE]]
1984 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULT_NEGATIVE]], float -1.000000e+00, float [[ARG]]
1985 ; CHECK-NEXT: ret float [[SELECT]]
1987 %known.positive = call float @llvm.fabs.f32(float %unknown)
1988 %known.negative = fneg float %known.positive
1989 %is.ult.negative = fcmp ult float %arg, %known.negative
1990 %select = select i1 %is.ult.negative, float -1.0, float %arg
1994 define float @clamp_is_ule_known_negative_to_neg1(float %arg, float %unknown) {
1995 ; CHECK-LABEL: define float @clamp_is_ule_known_negative_to_neg1(
1996 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
1997 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
1998 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
1999 ; CHECK-NEXT: [[IS_ULE_NEGATIVE:%.*]] = fcmp ule float [[ARG]], [[KNOWN_NEGATIVE]]
2000 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_ULE_NEGATIVE]], float -1.000000e+00, float [[ARG]]
2001 ; CHECK-NEXT: ret float [[SELECT]]
2003 %known.positive = call float @llvm.fabs.f32(float %unknown)
2004 %known.negative = fneg float %known.positive
2005 %is.ule.negative = fcmp ule float %arg, %known.negative
2006 %select = select i1 %is.ule.negative, float -1.0, float %arg
2010 define float @clamp_is_ugt_known_negative_to_neg1(float %arg, float %unknown) {
2011 ; CHECK-LABEL: define float @clamp_is_ugt_known_negative_to_neg1(
2012 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
2013 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2014 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2015 ; CHECK-NEXT: [[IS_UGT_NEGATIVE:%.*]] = fcmp ugt float [[ARG]], [[KNOWN_NEGATIVE]]
2016 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGT_NEGATIVE]], float -1.000000e+00, float [[ARG]]
2017 ; CHECK-NEXT: ret float [[SELECT]]
2019 %known.positive = call float @llvm.fabs.f32(float %unknown)
2020 %known.negative = fneg float %known.positive
2021 %is.ugt.negative = fcmp ugt float %arg, %known.negative
2022 %select = select i1 %is.ugt.negative, float -1.0, float %arg
2026 define float @clamp_is_uge_known_negative_to_neg1(float %arg, float %unknown) {
2027 ; CHECK-LABEL: define float @clamp_is_uge_known_negative_to_neg1(
2028 ; CHECK-SAME: float [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR2]] {
2029 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2030 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2031 ; CHECK-NEXT: [[IS_UGE_NEGATIVE:%.*]] = fcmp uge float [[ARG]], [[KNOWN_NEGATIVE]]
2032 ; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[IS_UGE_NEGATIVE]], float -1.000000e+00, float [[ARG]]
2033 ; CHECK-NEXT: ret float [[SELECT]]
2035 %known.positive = call float @llvm.fabs.f32(float %unknown)
2036 %known.negative = fneg float %known.positive
2037 %is.uge.negative = fcmp uge float %arg, %known.negative
2038 %select = select i1 %is.uge.negative, float -1.0, float %arg
2042 define float @ret_assumed_ogt_known_positive(float %arg, float %unknown) {
2043 ; CHECK-LABEL: define float @ret_assumed_ogt_known_positive(
2044 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2045 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2046 ; CHECK-NEXT: [[OGT_KNOWN_POSITIVE:%.*]] = fcmp ogt float [[ARG]], [[KNOWN_POSITIVE]]
2047 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_KNOWN_POSITIVE]]) #[[ATTR5]]
2048 ; CHECK-NEXT: ret float [[ARG]]
2050 %known.positive = call float @llvm.fabs.f32(float %unknown)
2051 %ogt.known.positive = fcmp ogt float %arg, %known.positive
2052 call void @llvm.assume(i1 %ogt.known.positive)
2056 define float @ret_assumed_oge_known_positive(float %arg, float %unknown) {
2057 ; CHECK-LABEL: define float @ret_assumed_oge_known_positive(
2058 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2059 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2060 ; CHECK-NEXT: [[OGE_KNOWN_POSITIVE:%.*]] = fcmp oge float [[ARG]], [[KNOWN_POSITIVE]]
2061 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_KNOWN_POSITIVE]]) #[[ATTR5]]
2062 ; CHECK-NEXT: ret float [[ARG]]
2064 %known.positive = call float @llvm.fabs.f32(float %unknown)
2065 %oge.known.positive = fcmp oge float %arg, %known.positive
2066 call void @llvm.assume(i1 %oge.known.positive)
2070 define float @ret_assumed_ugt_known_positive(float %arg, float %unknown) {
2071 ; CHECK-LABEL: define float @ret_assumed_ugt_known_positive(
2072 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2073 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2074 ; CHECK-NEXT: [[UGT_KNOWN_POSITIVE:%.*]] = fcmp ugt float [[ARG]], [[KNOWN_POSITIVE]]
2075 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_KNOWN_POSITIVE]]) #[[ATTR5]]
2076 ; CHECK-NEXT: ret float [[ARG]]
2078 %known.positive = call float @llvm.fabs.f32(float %unknown)
2079 %ugt.known.positive = fcmp ugt float %arg, %known.positive
2080 call void @llvm.assume(i1 %ugt.known.positive)
2084 define float @ret_assumed_uge_known_positive(float %arg, float %unknown) {
2085 ; CHECK-LABEL: define float @ret_assumed_uge_known_positive(
2086 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(ninf nzero nsub nnorm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2087 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2088 ; CHECK-NEXT: [[UGE_KNOWN_POSITIVE:%.*]] = fcmp uge float [[ARG]], [[KNOWN_POSITIVE]]
2089 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_KNOWN_POSITIVE]]) #[[ATTR5]]
2090 ; CHECK-NEXT: ret float [[ARG]]
2092 %known.positive = call float @llvm.fabs.f32(float %unknown)
2093 %uge.known.positive = fcmp uge float %arg, %known.positive
2094 call void @llvm.assume(i1 %uge.known.positive)
2098 define float @ret_assumed_olt_known_negative(float %arg, float %unknown) {
2099 ; CHECK-LABEL: define float @ret_assumed_olt_known_negative(
2100 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2101 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2102 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2103 ; CHECK-NEXT: [[OLT_KNOWN_NEGATIVE:%.*]] = fcmp olt float [[ARG]], [[KNOWN_NEGATIVE]]
2104 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLT_KNOWN_NEGATIVE]]) #[[ATTR5]]
2105 ; CHECK-NEXT: ret float [[ARG]]
2107 %known.positive = call float @llvm.fabs.f32(float %unknown)
2108 %known.negative = fneg float %known.positive
2109 %olt.known.negative = fcmp olt float %arg, %known.negative
2110 call void @llvm.assume(i1 %olt.known.negative)
2114 define float @ret_assumed_ole_known_negative(float %arg, float %unknown) {
2115 ; CHECK-LABEL: define float @ret_assumed_ole_known_negative(
2116 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2117 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2118 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2119 ; CHECK-NEXT: [[OLE_KNOWN_NEGATIVE:%.*]] = fcmp ole float [[ARG]], [[KNOWN_NEGATIVE]]
2120 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OLE_KNOWN_NEGATIVE]]) #[[ATTR5]]
2121 ; CHECK-NEXT: ret float [[ARG]]
2123 %known.positive = call float @llvm.fabs.f32(float %unknown)
2124 %known.negative = fneg float %known.positive
2125 %ole.known.negative = fcmp ole float %arg, %known.negative
2126 call void @llvm.assume(i1 %ole.known.negative)
2130 define float @ret_assumed_ult_known_negative(float %arg, float %unknown) {
2131 ; CHECK-LABEL: define float @ret_assumed_ult_known_negative(
2132 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2133 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2134 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2135 ; CHECK-NEXT: [[ULT_KNOWN_NEGATIVE:%.*]] = fcmp ult float [[ARG]], [[KNOWN_NEGATIVE]]
2136 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULT_KNOWN_NEGATIVE]]) #[[ATTR5]]
2137 ; CHECK-NEXT: ret float [[ARG]]
2139 %known.positive = call float @llvm.fabs.f32(float %unknown)
2140 %known.negative = fneg float %known.positive
2141 %ult.known.negative = fcmp ult float %arg, %known.negative
2142 call void @llvm.assume(i1 %ult.known.negative)
2146 define float @ret_assumed_ule_known_negative(float %arg, float %unknown) {
2147 ; CHECK-LABEL: define float @ret_assumed_ule_known_negative(
2148 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2149 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2150 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2151 ; CHECK-NEXT: [[ULE_KNOWN_NEGATIVE:%.*]] = fcmp ule float [[ARG]], [[KNOWN_NEGATIVE]]
2152 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[ULE_KNOWN_NEGATIVE]]) #[[ATTR5]]
2153 ; CHECK-NEXT: ret float [[ARG]]
2155 %known.positive = call float @llvm.fabs.f32(float %unknown)
2156 %known.negative = fneg float %known.positive
2157 %ule.known.negative = fcmp ule float %arg, %known.negative
2158 call void @llvm.assume(i1 %ule.known.negative)
2162 define float @ret_assumed_ogt_known_negative(float %arg, float %unknown) {
2163 ; CHECK-LABEL: define float @ret_assumed_ogt_known_negative(
2164 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2165 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2166 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2167 ; CHECK-NEXT: [[OGT_KNOWN_NEGATIVE:%.*]] = fcmp ogt float [[ARG]], [[KNOWN_NEGATIVE]]
2168 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGT_KNOWN_NEGATIVE]]) #[[ATTR5]]
2169 ; CHECK-NEXT: ret float [[ARG]]
2171 %known.positive = call float @llvm.fabs.f32(float %unknown)
2172 %known.negative = fneg float %known.positive
2173 %ogt.known.negative = fcmp ogt float %arg, %known.negative
2174 call void @llvm.assume(i1 %ogt.known.negative)
2178 define float @ret_assumed_oge_known_negative(float %arg, float %unknown) {
2179 ; CHECK-LABEL: define float @ret_assumed_oge_known_negative(
2180 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2181 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2182 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2183 ; CHECK-NEXT: [[OGE_KNOWN_NEGATIVE:%.*]] = fcmp oge float [[ARG]], [[KNOWN_NEGATIVE]]
2184 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[OGE_KNOWN_NEGATIVE]]) #[[ATTR5]]
2185 ; CHECK-NEXT: ret float [[ARG]]
2187 %known.positive = call float @llvm.fabs.f32(float %unknown)
2188 %known.negative = fneg float %known.positive
2189 %oge.known.negative = fcmp oge float %arg, %known.negative
2190 call void @llvm.assume(i1 %oge.known.negative)
2194 define float @ret_assumed_ugt_known_negative(float %arg, float %unknown) {
2195 ; CHECK-LABEL: define float @ret_assumed_ugt_known_negative(
2196 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2197 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2198 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2199 ; CHECK-NEXT: [[UGT_KNOWN_NEGATIVE:%.*]] = fcmp ugt float [[ARG]], [[KNOWN_NEGATIVE]]
2200 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGT_KNOWN_NEGATIVE]]) #[[ATTR5]]
2201 ; CHECK-NEXT: ret float [[ARG]]
2203 %known.positive = call float @llvm.fabs.f32(float %unknown)
2204 %known.negative = fneg float %known.positive
2205 %ugt.known.negative = fcmp ugt float %arg, %known.negative
2206 call void @llvm.assume(i1 %ugt.known.negative)
2210 define float @ret_assumed_uge_known_negative(float %arg, float %unknown) {
2211 ; CHECK-LABEL: define float @ret_assumed_uge_known_negative(
2212 ; CHECK-SAME: float returned [[ARG:%.*]], float nofpclass(inf zero sub norm) [[UNKNOWN:%.*]]) #[[ATTR3]] {
2213 ; CHECK-NEXT: [[KNOWN_POSITIVE:%.*]] = call float @llvm.fabs.f32(float [[UNKNOWN]]) #[[ATTR4]]
2214 ; CHECK-NEXT: [[KNOWN_NEGATIVE:%.*]] = fneg float [[KNOWN_POSITIVE]]
2215 ; CHECK-NEXT: [[UGE_KNOWN_NEGATIVE:%.*]] = fcmp uge float [[ARG]], [[KNOWN_NEGATIVE]]
2216 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[UGE_KNOWN_NEGATIVE]]) #[[ATTR5]]
2217 ; CHECK-NEXT: ret float [[ARG]]
2219 %known.positive = call float @llvm.fabs.f32(float %unknown)
2220 %known.negative = fneg float %known.positive
2221 %uge.known.negative = fcmp uge float %arg, %known.negative
2222 call void @llvm.assume(i1 %uge.known.negative)
2226 ;---------------------------------------------------------------------
2227 ; assume compare to smallest normal
2228 ;---------------------------------------------------------------------
2230 define float @assume_oeq_smallest_normal(float %arg) {
2231 ; CHECK-LABEL: define float @assume_oeq_smallest_normal(
2232 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2233 ; CHECK-NEXT: [[IS_OEQ_SMALLEST_NORMAL:%.*]] = fcmp oeq float [[ARG]], 0x3810000000000000
2234 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_OEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2235 ; CHECK-NEXT: ret float [[ARG]]
2237 %is.oeq.smallest.normal = fcmp oeq float %arg, 0x3810000000000000
2238 call void @llvm.assume(i1 %is.oeq.smallest.normal)
2242 define float @assume_one_smallest_normal(float %arg) {
2243 ; CHECK-LABEL: define float @assume_one_smallest_normal(
2244 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2245 ; CHECK-NEXT: [[IS_ONE_SMALLEST_NORMAL:%.*]] = fcmp one float [[ARG]], 0x3810000000000000
2246 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_ONE_SMALLEST_NORMAL]]) #[[ATTR5]]
2247 ; CHECK-NEXT: ret float [[ARG]]
2249 %is.one.smallest.normal = fcmp one float %arg, 0x3810000000000000
2250 call void @llvm.assume(i1 %is.one.smallest.normal)
2254 define float @assume_ueq_smallest_normal(float %arg) {
2255 ; CHECK-LABEL: define float @assume_ueq_smallest_normal(
2256 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2257 ; CHECK-NEXT: [[IS_UEQ_SMALLEST_NORMAL:%.*]] = fcmp ueq float [[ARG]], 0x3810000000000000
2258 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2259 ; CHECK-NEXT: ret float [[ARG]]
2261 %is.ueq.smallest.normal = fcmp ueq float %arg, 0x3810000000000000
2262 call void @llvm.assume(i1 %is.ueq.smallest.normal)
2266 define float @assume_une_smallest_normal(float %arg) {
2267 ; CHECK-LABEL: define float @assume_une_smallest_normal(
2268 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2269 ; CHECK-NEXT: [[IS_UNE_SMALLEST_NORMAL:%.*]] = fcmp une float [[ARG]], 0x3810000000000000
2270 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UNE_SMALLEST_NORMAL]]) #[[ATTR5]]
2271 ; CHECK-NEXT: ret float [[ARG]]
2273 %is.une.smallest.normal = fcmp une float %arg, 0x3810000000000000
2274 call void @llvm.assume(i1 %is.une.smallest.normal)
2278 define float @assume_ord_smallest_normal(float %arg) {
2279 ; CHECK-LABEL: define nofpclass(nan) float @assume_ord_smallest_normal(
2280 ; CHECK-SAME: float returned nofpclass(nan) [[ARG:%.*]]) #[[ATTR3]] {
2281 ; CHECK-NEXT: [[IS_ORD_SMALLEST_NORMAL:%.*]] = fcmp ord float [[ARG]], 0x3810000000000000
2282 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_ORD_SMALLEST_NORMAL]]) #[[ATTR5]]
2283 ; CHECK-NEXT: ret float [[ARG]]
2285 %is.ord.smallest.normal = fcmp ord float %arg, 0x3810000000000000
2286 call void @llvm.assume(i1 %is.ord.smallest.normal)
2290 define float @assume_uno_smallest_normal(float %arg) {
2291 ; CHECK-LABEL: define nofpclass(inf zero sub norm) float @assume_uno_smallest_normal(
2292 ; CHECK-SAME: float returned nofpclass(inf zero sub norm) [[ARG:%.*]]) #[[ATTR3]] {
2293 ; CHECK-NEXT: [[IS_UNO_SMALLEST_NORMAL:%.*]] = fcmp uno float [[ARG]], 0x3810000000000000
2294 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UNO_SMALLEST_NORMAL]]) #[[ATTR5]]
2295 ; CHECK-NEXT: ret float [[ARG]]
2297 %is.uno.smallest.normal = fcmp uno float %arg, 0x3810000000000000
2298 call void @llvm.assume(i1 %is.uno.smallest.normal)
2302 define float @assume_fabs_oeq_smallest_normal(float %arg) {
2303 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_oeq_smallest_normal(
2304 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2305 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2306 ; CHECK-NEXT: [[IS_OEQ_SMALLEST_NORMAL:%.*]] = fcmp oeq float [[FABS_ARG]], 0x3810000000000000
2307 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_OEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2308 ; CHECK-NEXT: ret float [[ARG]]
2310 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2311 %is.oeq.smallest.normal = fcmp oeq float %fabs.arg, 0x3810000000000000
2312 call void @llvm.assume(i1 %is.oeq.smallest.normal)
2316 define float @assume_fabs_one_smallest_normal(float %arg) {
2317 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_one_smallest_normal(
2318 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2319 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2320 ; CHECK-NEXT: [[IS_ONE_SMALLEST_NORMAL:%.*]] = fcmp one float [[FABS_ARG]], 0x3810000000000000
2321 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_ONE_SMALLEST_NORMAL]]) #[[ATTR5]]
2322 ; CHECK-NEXT: ret float [[ARG]]
2324 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2325 %is.one.smallest.normal = fcmp one float %fabs.arg, 0x3810000000000000
2326 call void @llvm.assume(i1 %is.one.smallest.normal)
2330 define float @assume_fabs_ueq_smallest_normal(float %arg) {
2331 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_ueq_smallest_normal(
2332 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2333 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2334 ; CHECK-NEXT: [[IS_UEQ_SMALLEST_NORMAL:%.*]] = fcmp ueq float [[FABS_ARG]], 0x3810000000000000
2335 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2336 ; CHECK-NEXT: ret float [[ARG]]
2338 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2339 %is.ueq.smallest.normal = fcmp ueq float %fabs.arg, 0x3810000000000000
2340 call void @llvm.assume(i1 %is.ueq.smallest.normal)
2344 define float @assume_fabs_une_smallest_normal(float %arg) {
2345 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_une_smallest_normal(
2346 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2347 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2348 ; CHECK-NEXT: [[IS_UNE_SMALLEST_NORMAL:%.*]] = fcmp une float [[FABS_ARG]], 0x3810000000000000
2349 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UNE_SMALLEST_NORMAL]]) #[[ATTR5]]
2350 ; CHECK-NEXT: ret float [[ARG]]
2352 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2353 %is.une.smallest.normal = fcmp une float %fabs.arg, 0x3810000000000000
2354 call void @llvm.assume(i1 %is.une.smallest.normal)
2358 define float @assume_fabs_ord_smallest_normal(float %arg) {
2359 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_ord_smallest_normal(
2360 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2361 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2362 ; CHECK-NEXT: [[IS_ORD_SMALLEST_NORMAL:%.*]] = fcmp ord float [[FABS_ARG]], 0x3810000000000000
2363 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_ORD_SMALLEST_NORMAL]]) #[[ATTR5]]
2364 ; CHECK-NEXT: ret float [[ARG]]
2366 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2367 %is.ord.smallest.normal = fcmp ord float %fabs.arg, 0x3810000000000000
2368 call void @llvm.assume(i1 %is.ord.smallest.normal)
2372 define float @assume_fabs_uno_smallest_normal(float %arg) {
2373 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_uno_smallest_normal(
2374 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2375 ; CHECK-NEXT: [[FABS_ARG:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2376 ; CHECK-NEXT: [[IS_UNO_SMALLEST_NORMAL:%.*]] = fcmp uno float [[FABS_ARG]], 0x3810000000000000
2377 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_UNO_SMALLEST_NORMAL]]) #[[ATTR5]]
2378 ; CHECK-NEXT: ret float [[ARG]]
2380 %fabs.arg = call float @llvm.fabs.f32(float %arg)
2381 %is.uno.smallest.normal = fcmp uno float %fabs.arg, 0x3810000000000000
2382 call void @llvm.assume(i1 %is.uno.smallest.normal)
2386 define float @assume_oeq_smallest_normal_known_pos(float nofpclass(ninf nsub nnorm nzero) %arg) {
2387 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_oeq_smallest_normal_known_pos(
2388 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2389 ; CHECK-NEXT: [[IS_OEQ_SMALLEST_NORMAL:%.*]] = fcmp oeq float [[ARG]], 0x3810000000000000
2390 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[IS_OEQ_SMALLEST_NORMAL]]) #[[ATTR5]]
2391 ; CHECK-NEXT: ret float [[ARG]]
2393 %is.oeq.smallest.normal = fcmp oeq float %arg, 0x3810000000000000
2394 call void @llvm.assume(i1 %is.oeq.smallest.normal)
2398 ;---------------------------------------------------------------------
2400 ;---------------------------------------------------------------------
2402 define float @assume_ole_pinf(float %arg) {
2403 ; CHECK-LABEL: define nofpclass(nan) float @assume_ole_pinf(
2404 ; CHECK-SAME: float returned nofpclass(nan) [[ARG:%.*]]) #[[ATTR3]] {
2405 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ole float [[ARG]], 0x7FF0000000000000
2406 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2407 ; CHECK-NEXT: ret float [[ARG]]
2409 %fcmp = fcmp ole float %arg, 0x7FF0000000000000
2410 call void @llvm.assume(i1 %fcmp)
2414 define float @assume_ole_ninf(float %arg) {
2415 ; CHECK-LABEL: define nofpclass(nan pinf zero sub norm) float @assume_ole_ninf(
2416 ; CHECK-SAME: float returned nofpclass(nan pinf zero sub norm) [[ARG:%.*]]) #[[ATTR3]] {
2417 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ole float [[ARG]], 0xFFF0000000000000
2418 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2419 ; CHECK-NEXT: ret float [[ARG]]
2421 %fcmp = fcmp ole float %arg, 0xFFF0000000000000
2422 call void @llvm.assume(i1 %fcmp)
2426 define float @assume_ugt_pinf(float %arg) {
2427 ; CHECK-LABEL: define nofpclass(inf zero sub norm) float @assume_ugt_pinf(
2428 ; CHECK-SAME: float returned nofpclass(inf zero sub norm) [[ARG:%.*]]) #[[ATTR3]] {
2429 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ugt float [[ARG]], 0x7FF0000000000000
2430 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2431 ; CHECK-NEXT: ret float [[ARG]]
2433 %fcmp = fcmp ugt float %arg, 0x7FF0000000000000
2434 call void @llvm.assume(i1 %fcmp)
2438 define float @assume_ugt_ninf(float %arg) {
2439 ; CHECK-LABEL: define nofpclass(ninf) float @assume_ugt_ninf(
2440 ; CHECK-SAME: float returned nofpclass(ninf) [[ARG:%.*]]) #[[ATTR3]] {
2441 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ugt float [[ARG]], 0xFFF0000000000000
2442 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2443 ; CHECK-NEXT: ret float [[ARG]]
2445 %fcmp = fcmp ugt float %arg, 0xFFF0000000000000
2446 call void @llvm.assume(i1 %fcmp)
2450 define float @assume_fabs_ole_pinf(float %arg) {
2451 ; CHECK-LABEL: define nofpclass(nan ninf nzero nsub nnorm) float @assume_fabs_ole_pinf(
2452 ; CHECK-SAME: float returned nofpclass(nan ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2453 ; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2454 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ole float [[FABS]], 0x7FF0000000000000
2455 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2456 ; CHECK-NEXT: ret float [[ARG]]
2458 %fabs = call float @llvm.fabs.f32(float %arg)
2459 %fcmp = fcmp ole float %fabs, 0x7FF0000000000000
2460 call void @llvm.assume(i1 %fcmp)
2464 define float @assume_fabs_ole_ninf(float %arg) {
2465 ; CHECK-LABEL: define nofpclass(all) float @assume_fabs_ole_ninf(
2466 ; CHECK-SAME: float returned nofpclass(all) [[ARG:%.*]]) #[[ATTR3]] {
2467 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2468 ; CHECK-NEXT: ret float [[ARG]]
2470 %fabs = call float @llvm.fabs.f32(float %arg)
2471 %fcmp = fcmp ole float %fabs, 0xFFF0000000000000
2472 call void @llvm.assume(i1 %fcmp)
2476 define float @assume_fabs_ugt_pinf(float %arg) {
2477 ; CHECK-LABEL: define nofpclass(inf zero sub norm) float @assume_fabs_ugt_pinf(
2478 ; CHECK-SAME: float returned nofpclass(inf zero sub norm) [[ARG:%.*]]) #[[ATTR3]] {
2479 ; CHECK-NEXT: [[FABS:%.*]] = call float @llvm.fabs.f32(float [[ARG]]) #[[ATTR4]]
2480 ; CHECK-NEXT: [[FCMP:%.*]] = fcmp ugt float [[FABS]], 0x7FF0000000000000
2481 ; CHECK-NEXT: call void @llvm.assume(i1 noundef [[FCMP]]) #[[ATTR5]]
2482 ; CHECK-NEXT: ret float [[ARG]]
2484 %fabs = call float @llvm.fabs.f32(float %arg)
2485 %fcmp = fcmp ugt float %fabs, 0x7FF0000000000000
2486 call void @llvm.assume(i1 %fcmp)
2490 define float @assume_fabs_ugt_ninf(float %arg) {
2491 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_ugt_ninf(
2492 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2493 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2494 ; CHECK-NEXT: ret float [[ARG]]
2496 %fabs = call float @llvm.fabs.f32(float %arg)
2497 %fcmp = fcmp ugt float %fabs, 0xFFF0000000000000
2498 call void @llvm.assume(i1 %fcmp)
2502 ;---------------------------------------------------------------------
2504 ;---------------------------------------------------------------------
2506 define float @assume_fabs_false_pinf(float %arg) {
2507 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_false_pinf(
2508 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2509 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2510 ; CHECK-NEXT: ret float [[ARG]]
2512 %fabs = call float @llvm.fabs.f32(float %arg)
2513 %fcmp = fcmp false float %fabs, 0x7FF0000000000000
2514 call void @llvm.assume(i1 %fcmp)
2518 define float @assume_fabs_false_ninf(float %arg) {
2519 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_false_ninf(
2520 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2521 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2522 ; CHECK-NEXT: ret float [[ARG]]
2524 %fabs = call float @llvm.fabs.f32(float %arg)
2525 %fcmp = fcmp false float %fabs, 0xFFF0000000000000
2526 call void @llvm.assume(i1 %fcmp)
2530 define float @assume_false_pinf(float %arg) {
2531 ; CHECK-LABEL: define nofpclass(all) float @assume_false_pinf(
2532 ; CHECK-SAME: float returned nofpclass(all) [[ARG:%.*]]) #[[ATTR3]] {
2533 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2534 ; CHECK-NEXT: ret float [[ARG]]
2536 %fcmp = fcmp false float %arg, 0x7FF0000000000000
2537 call void @llvm.assume(i1 %fcmp)
2541 define float @assume_false_ninf(float %arg) {
2542 ; CHECK-LABEL: define nofpclass(all) float @assume_false_ninf(
2543 ; CHECK-SAME: float returned nofpclass(all) [[ARG:%.*]]) #[[ATTR3]] {
2544 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2545 ; CHECK-NEXT: ret float [[ARG]]
2547 %fcmp = fcmp false float %arg, 0xFFF0000000000000
2548 call void @llvm.assume(i1 %fcmp)
2552 define float @clamp_false_pinf_0.0(float %arg) {
2553 ; CHECK-LABEL: define float @clamp_false_pinf_0.0(
2554 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2555 ; CHECK-NEXT: ret float [[ARG]]
2557 %fcmp = fcmp false float %arg, 0x7FF0000000000000
2558 %select = select i1 %fcmp, float 0.0, float %arg
2562 define float @clamp_false_ninf_0.0(float %arg) {
2563 ; CHECK-LABEL: define float @clamp_false_ninf_0.0(
2564 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2565 ; CHECK-NEXT: ret float [[ARG]]
2567 %fcmp = fcmp false float %arg, 0xFFF0000000000000
2568 %select = select i1 %fcmp, float 0.0, float %arg
2572 define float @clamp_false_smallest_normal_0.0(float %arg) {
2573 ; CHECK-LABEL: define float @clamp_false_smallest_normal_0.0(
2574 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2575 ; CHECK-NEXT: ret float [[ARG]]
2577 %fcmp = fcmp false float %arg, 0x3810000000000000
2578 %select = select i1 %fcmp, float 0.0, float %arg
2582 define float @assume_false_p0(float %arg) {
2583 ; CHECK-LABEL: define nofpclass(all) float @assume_false_p0(
2584 ; CHECK-SAME: float returned nofpclass(all) [[ARG:%.*]]) #[[ATTR3]] {
2585 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2586 ; CHECK-NEXT: ret float [[ARG]]
2588 %fcmp = fcmp false float %arg, 0.0
2589 call void @llvm.assume(i1 %fcmp)
2593 define float @assume_false_n0(float %arg) {
2594 ; CHECK-LABEL: define nofpclass(all) float @assume_false_n0(
2595 ; CHECK-SAME: float returned nofpclass(all) [[ARG:%.*]]) #[[ATTR3]] {
2596 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2597 ; CHECK-NEXT: ret float [[ARG]]
2599 %fcmp = fcmp false float %arg, -0.0
2600 call void @llvm.assume(i1 %fcmp)
2604 define float @assume_false_smallest_normal(float %arg) {
2605 ; CHECK-LABEL: define nofpclass(all) float @assume_false_smallest_normal(
2606 ; CHECK-SAME: float returned nofpclass(all) [[ARG:%.*]]) #[[ATTR3]] {
2607 ; CHECK-NEXT: call void @llvm.assume(i1 noundef false) #[[ATTR5]]
2608 ; CHECK-NEXT: ret float [[ARG]]
2610 %fcmp = fcmp false float %arg, 0x3810000000000000
2611 call void @llvm.assume(i1 %fcmp)
2615 define float @clamp_false_nan(float %arg) {
2616 ; CHECK-LABEL: define float @clamp_false_nan(
2617 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2618 ; CHECK-NEXT: ret float [[ARG]]
2620 %fcmp = fcmp false float %arg, 0x7FF8000000000000
2621 %select = select i1 %fcmp, float 0.0, float %arg
2625 define float @clamp_false_p0(float %arg) {
2626 ; CHECK-LABEL: define float @clamp_false_p0(
2627 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2628 ; CHECK-NEXT: ret float [[ARG]]
2630 %fcmp = fcmp false float %arg, 0.0
2631 %select = select i1 %fcmp, float 0.0, float %arg
2635 define float @clamp_false_n0(float %arg) {
2636 ; CHECK-LABEL: define float @clamp_false_n0(
2637 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR2]] {
2638 ; CHECK-NEXT: ret float [[ARG]]
2640 %fcmp = fcmp false float %arg, -0.0
2641 %select = select i1 %fcmp, float 0.0, float %arg
2645 ;---------------------------------------------------------------------
2647 ;---------------------------------------------------------------------
2649 define float @assume_fabs_true_pinf(float %arg) {
2650 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_true_pinf(
2651 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2652 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2653 ; CHECK-NEXT: ret float [[ARG]]
2655 %fabs = call float @llvm.fabs.f32(float %arg)
2656 %fcmp = fcmp true float %fabs, 0x7FF0000000000000
2657 call void @llvm.assume(i1 %fcmp)
2661 define float @assume_fabs_true_ninf(float %arg) {
2662 ; CHECK-LABEL: define nofpclass(ninf nzero nsub nnorm) float @assume_fabs_true_ninf(
2663 ; CHECK-SAME: float returned nofpclass(ninf nzero nsub nnorm) [[ARG:%.*]]) #[[ATTR3]] {
2664 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2665 ; CHECK-NEXT: ret float [[ARG]]
2667 %fabs = call float @llvm.fabs.f32(float %arg)
2668 %fcmp = fcmp true float %fabs, 0xFFF0000000000000
2669 call void @llvm.assume(i1 %fcmp)
2673 define float @assume_true_pinf(float %arg) {
2674 ; CHECK-LABEL: define float @assume_true_pinf(
2675 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2676 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2677 ; CHECK-NEXT: ret float [[ARG]]
2679 %fcmp = fcmp true float %arg, 0x7FF0000000000000
2680 call void @llvm.assume(i1 %fcmp)
2684 define float @assume_true_ninf(float %arg) {
2685 ; CHECK-LABEL: define float @assume_true_ninf(
2686 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2687 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2688 ; CHECK-NEXT: ret float [[ARG]]
2690 %fcmp = fcmp true float %arg, 0xFFF0000000000000
2691 call void @llvm.assume(i1 %fcmp)
2695 define float @assume_true_p0(float %arg) {
2696 ; CHECK-LABEL: define float @assume_true_p0(
2697 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2698 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2699 ; CHECK-NEXT: ret float [[ARG]]
2701 %fcmp = fcmp true float %arg, 0.0
2702 call void @llvm.assume(i1 %fcmp)
2706 define float @assume_true_n0(float %arg) {
2707 ; CHECK-LABEL: define float @assume_true_n0(
2708 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2709 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2710 ; CHECK-NEXT: ret float [[ARG]]
2712 %fcmp = fcmp true float %arg, -0.0
2713 call void @llvm.assume(i1 %fcmp)
2717 define float @assume_true_smallest_normal(float %arg) {
2718 ; CHECK-LABEL: define float @assume_true_smallest_normal(
2719 ; CHECK-SAME: float returned [[ARG:%.*]]) #[[ATTR3]] {
2720 ; CHECK-NEXT: call void @llvm.assume(i1 noundef true) #[[ATTR5]]
2721 ; CHECK-NEXT: ret float [[ARG]]
2723 %fcmp = fcmp true float %arg, 0x3810000000000000
2724 call void @llvm.assume(i1 %fcmp)
2728 define float @clamp_true_pinf_0.0(float %arg) {
2729 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_pinf_0.0(
2730 ; CHECK-SAME: float nofpclass(nan inf nzero sub norm) [[ARG:%.*]]) #[[ATTR2]] {
2731 ; CHECK-NEXT: ret float 0.000000e+00
2733 %fcmp = fcmp true float %arg, 0x7FF0000000000000
2734 %select = select i1 %fcmp, float 0.0, float %arg
2738 define float @clamp_true_ninf_0.0(float %arg) {
2739 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_ninf_0.0(
2740 ; CHECK-SAME: float nofpclass(nan inf nzero sub norm) [[ARG:%.*]]) #[[ATTR2]] {
2741 ; CHECK-NEXT: ret float 0.000000e+00
2743 %fcmp = fcmp true float %arg, 0xFFF0000000000000
2744 %select = select i1 %fcmp, float 0.0, float %arg
2748 define float @clamp_true_smallest_normal_0.0(float %arg) {
2749 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_smallest_normal_0.0(
2750 ; CHECK-SAME: float nofpclass(nan inf nzero sub norm) [[ARG:%.*]]) #[[ATTR2]] {
2751 ; CHECK-NEXT: ret float 0.000000e+00
2753 %fcmp = fcmp true float %arg, 0x3810000000000000
2754 %select = select i1 %fcmp, float 0.0, float %arg
2758 define float @clamp_true_nan(float %arg) {
2759 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_nan(
2760 ; CHECK-SAME: float nofpclass(nan inf nzero sub norm) [[ARG:%.*]]) #[[ATTR2]] {
2761 ; CHECK-NEXT: ret float 0.000000e+00
2763 %fcmp = fcmp true float %arg, 0x7FF8000000000000
2764 %select = select i1 %fcmp, float 0.0, float %arg
2768 define float @clamp_true_p0(float %arg) {
2769 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_p0(
2770 ; CHECK-SAME: float nofpclass(nan inf nzero sub norm) [[ARG:%.*]]) #[[ATTR2]] {
2771 ; CHECK-NEXT: ret float 0.000000e+00
2773 %fcmp = fcmp true float %arg, 0.0
2774 %select = select i1 %fcmp, float 0.0, float %arg
2778 define float @clamp_true_n0(float %arg) {
2779 ; CHECK-LABEL: define noundef nofpclass(nan inf nzero sub norm) float @clamp_true_n0(
2780 ; CHECK-SAME: float nofpclass(nan inf nzero sub norm) [[ARG:%.*]]) #[[ATTR2]] {
2781 ; CHECK-NEXT: ret float 0.000000e+00
2783 %fcmp = fcmp true float %arg, -0.0
2784 %select = select i1 %fcmp, float 0.0, float %arg
2788 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: