• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instsimplify -S | FileCheck %s
3
4define float @fadd_undef_op0(float %x) {
5; CHECK-LABEL: @fadd_undef_op0(
6; CHECK-NEXT:    ret float 0x7FF8000000000000
7;
8  %r = fadd float undef, %x
9  ret float %r
10}
11
12define float @fadd_undef_op1(float %x) {
13; CHECK-LABEL: @fadd_undef_op1(
14; CHECK-NEXT:    ret float 0x7FF8000000000000
15;
16  %r = fadd float %x, undef
17  ret float %r
18}
19
20define float @fsub_undef_op0(float %x) {
21; CHECK-LABEL: @fsub_undef_op0(
22; CHECK-NEXT:    ret float 0x7FF8000000000000
23;
24  %r = fsub float undef, %x
25  ret float %r
26}
27
28define float @fsub_undef_op1(float %x) {
29; CHECK-LABEL: @fsub_undef_op1(
30; CHECK-NEXT:    ret float 0x7FF8000000000000
31;
32  %r = fsub float %x, undef
33  ret float %r
34}
35
36define float @fmul_undef_op0(float %x) {
37; CHECK-LABEL: @fmul_undef_op0(
38; CHECK-NEXT:    ret float 0x7FF8000000000000
39;
40  %r = fmul float undef, %x
41  ret float %r
42}
43
44define float @fmul_undef_op1(float %x) {
45; CHECK-LABEL: @fmul_undef_op1(
46; CHECK-NEXT:    ret float 0x7FF8000000000000
47;
48  %r = fmul float %x, undef
49  ret float %r
50}
51
52define float @fdiv_undef_op0(float %x) {
53; CHECK-LABEL: @fdiv_undef_op0(
54; CHECK-NEXT:    ret float 0x7FF8000000000000
55;
56  %r = fdiv float undef, %x
57  ret float %r
58}
59
60define float @fdiv_undef_op1(float %x) {
61; CHECK-LABEL: @fdiv_undef_op1(
62; CHECK-NEXT:    ret float 0x7FF8000000000000
63;
64  %r = fdiv float %x, undef
65  ret float %r
66}
67
68define float @frem_undef_op0(float %x) {
69; CHECK-LABEL: @frem_undef_op0(
70; CHECK-NEXT:    ret float 0x7FF8000000000000
71;
72  %r = frem float undef, %x
73  ret float %r
74}
75
76define float @frem_undef_op1(float %x) {
77; CHECK-LABEL: @frem_undef_op1(
78; CHECK-NEXT:    ret float 0x7FF8000000000000
79;
80  %r = frem float %x, undef
81  ret float %r
82}
83
84; Repeat all tests with fast-math-flags. Alternate 'nnan' and 'fast' for more coverage.
85
86define float @fadd_undef_op0_nnan(float %x) {
87; CHECK-LABEL: @fadd_undef_op0_nnan(
88; CHECK-NEXT:    ret float 0x7FF8000000000000
89;
90  %r = fadd nnan float undef, %x
91  ret float %r
92}
93
94define float @fadd_undef_op1_fast(float %x) {
95; CHECK-LABEL: @fadd_undef_op1_fast(
96; CHECK-NEXT:    ret float 0x7FF8000000000000
97;
98  %r = fadd fast float %x, undef
99  ret float %r
100}
101
102define float @fsub_undef_op0_fast(float %x) {
103; CHECK-LABEL: @fsub_undef_op0_fast(
104; CHECK-NEXT:    ret float 0x7FF8000000000000
105;
106  %r = fsub fast float undef, %x
107  ret float %r
108}
109
110define float @fsub_undef_op1_nnan(float %x) {
111; CHECK-LABEL: @fsub_undef_op1_nnan(
112; CHECK-NEXT:    ret float 0x7FF8000000000000
113;
114  %r = fsub nnan float %x, undef
115  ret float %r
116}
117
118define float @fmul_undef_op0_nnan(float %x) {
119; CHECK-LABEL: @fmul_undef_op0_nnan(
120; CHECK-NEXT:    ret float 0x7FF8000000000000
121;
122  %r = fmul nnan float undef, %x
123  ret float %r
124}
125
126define float @fmul_undef_op1_fast(float %x) {
127; CHECK-LABEL: @fmul_undef_op1_fast(
128; CHECK-NEXT:    ret float 0x7FF8000000000000
129;
130  %r = fmul fast float %x, undef
131  ret float %r
132}
133
134define float @fdiv_undef_op0_fast(float %x) {
135; CHECK-LABEL: @fdiv_undef_op0_fast(
136; CHECK-NEXT:    ret float 0x7FF8000000000000
137;
138  %r = fdiv fast float undef, %x
139  ret float %r
140}
141
142define float @fdiv_undef_op1_nnan(float %x) {
143; CHECK-LABEL: @fdiv_undef_op1_nnan(
144; CHECK-NEXT:    ret float 0x7FF8000000000000
145;
146  %r = fdiv nnan float %x, undef
147  ret float %r
148}
149
150define float @frem_undef_op0_nnan(float %x) {
151; CHECK-LABEL: @frem_undef_op0_nnan(
152; CHECK-NEXT:    ret float 0x7FF8000000000000
153;
154  %r = frem nnan float undef, %x
155  ret float %r
156}
157
158define float @frem_undef_op1_fast(float %x) {
159; CHECK-LABEL: @frem_undef_op1_fast(
160; CHECK-NEXT:    ret float 0x7FF8000000000000
161;
162  %r = frem fast float %x, undef
163  ret float %r
164}
165
166; Constant folding - undef undef.
167
168define double @fadd_undef_undef(double %x) {
169; CHECK-LABEL: @fadd_undef_undef(
170; CHECK-NEXT:    ret double undef
171;
172  %r = fadd double undef, undef
173  ret double %r
174}
175
176define double @fsub_undef_undef(double %x) {
177; CHECK-LABEL: @fsub_undef_undef(
178; CHECK-NEXT:    ret double undef
179;
180  %r = fsub double undef, undef
181  ret double %r
182}
183
184define double @fmul_undef_undef(double %x) {
185; CHECK-LABEL: @fmul_undef_undef(
186; CHECK-NEXT:    ret double undef
187;
188  %r = fmul double undef, undef
189  ret double %r
190}
191
192define double @fdiv_undef_undef(double %x) {
193; CHECK-LABEL: @fdiv_undef_undef(
194; CHECK-NEXT:    ret double undef
195;
196  %r = fdiv double undef, undef
197  ret double %r
198}
199
200define double @frem_undef_undef(double %x) {
201; CHECK-LABEL: @frem_undef_undef(
202; CHECK-NEXT:    ret double undef
203;
204  %r = frem double undef, undef
205  ret double %r
206}
207
208; Constant folding.
209
210define float @fadd_undef_op0_nnan_constant(float %x) {
211; CHECK-LABEL: @fadd_undef_op0_nnan_constant(
212; CHECK-NEXT:    ret float 0x7FF8000000000000
213;
214  %r = fadd nnan float undef, 1.0
215  ret float %r
216}
217
218define float @fadd_undef_op1_constant(float %x) {
219; CHECK-LABEL: @fadd_undef_op1_constant(
220; CHECK-NEXT:    ret float 0x7FF8000000000000
221;
222  %r = fadd float 2.0, undef
223  ret float %r
224}
225
226define float @fsub_undef_op0_fast_constant(float %x) {
227; CHECK-LABEL: @fsub_undef_op0_fast_constant(
228; CHECK-NEXT:    ret float 0x7FF8000000000000
229;
230  %r = fsub fast float undef, 3.0
231  ret float %r
232}
233
234define float @fsub_undef_op1_constant(float %x) {
235; CHECK-LABEL: @fsub_undef_op1_constant(
236; CHECK-NEXT:    ret float 0x7FF8000000000000
237;
238  %r = fsub float 4.0, undef
239  ret float %r
240}
241
242define float @fmul_undef_op0_nnan_constant(float %x) {
243; CHECK-LABEL: @fmul_undef_op0_nnan_constant(
244; CHECK-NEXT:    ret float 0x7FF8000000000000
245;
246  %r = fmul nnan float undef, 5.0
247  ret float %r
248}
249
250define float @fmul_undef_op1_constant(float %x) {
251; CHECK-LABEL: @fmul_undef_op1_constant(
252; CHECK-NEXT:    ret float 0x7FF8000000000000
253;
254  %r = fmul float 6.0, undef
255  ret float %r
256}
257
258define float @fdiv_undef_op0_fast_constant(float %x) {
259; CHECK-LABEL: @fdiv_undef_op0_fast_constant(
260; CHECK-NEXT:    ret float 0x7FF8000000000000
261;
262  %r = fdiv fast float undef, 7.0
263  ret float %r
264}
265
266define float @fdiv_undef_op1_constant(float %x) {
267; CHECK-LABEL: @fdiv_undef_op1_constant(
268; CHECK-NEXT:    ret float 0x7FF8000000000000
269;
270  %r = fdiv float 8.0, undef
271  ret float %r
272}
273
274define float @frem_undef_op0_nnan_constant(float %x) {
275; CHECK-LABEL: @frem_undef_op0_nnan_constant(
276; CHECK-NEXT:    ret float 0x7FF8000000000000
277;
278  %r = frem nnan float undef, 9.0
279  ret float %r
280}
281
282define float @frem_undef_op1_constant(float %x) {
283; CHECK-LABEL: @frem_undef_op1_constant(
284; CHECK-NEXT:    ret float 0x7FF8000000000000
285;
286  %r = frem float 10.0, undef
287  ret float %r
288}
289
290; Constant folding - special constants: NaN.
291
292define double @fadd_undef_op0_constant_nan(double %x) {
293; CHECK-LABEL: @fadd_undef_op0_constant_nan(
294; CHECK-NEXT:    ret double 0x7FF8000000000000
295;
296  %r = fadd double undef, 0x7FF8000000000000
297  ret double %r
298}
299
300define double @fadd_undef_op1_fast_constant_nan(double %x) {
301; CHECK-LABEL: @fadd_undef_op1_fast_constant_nan(
302; CHECK-NEXT:    ret double 0x7FF8000000000000
303;
304  %r = fadd fast double 0xFFF0000000000001, undef
305  ret double %r
306}
307
308define double @fsub_undef_op0_constant_nan(double %x) {
309; CHECK-LABEL: @fsub_undef_op0_constant_nan(
310; CHECK-NEXT:    ret double 0x7FF8000000000000
311;
312  %r = fsub double undef, 0xFFF8000000000010
313  ret double %r
314}
315
316define double @fsub_undef_op1_nnan_constant_nan(double %x) {
317; CHECK-LABEL: @fsub_undef_op1_nnan_constant_nan(
318; CHECK-NEXT:    ret double 0x7FF8000000000000
319;
320  %r = fsub nnan double 0x7FF0000000000011, undef
321  ret double %r
322}
323
324define double @fmul_undef_op0_constant_nan(double %x) {
325; CHECK-LABEL: @fmul_undef_op0_constant_nan(
326; CHECK-NEXT:    ret double 0x7FF8000000000000
327;
328  %r = fmul double undef, 0x7FF8000000000100
329  ret double %r
330}
331
332define double @fmul_undef_op1_fast_constant_nan(double %x) {
333; CHECK-LABEL: @fmul_undef_op1_fast_constant_nan(
334; CHECK-NEXT:    ret double 0x7FF8000000000000
335;
336  %r = fmul fast double 0xFFF0000000000101, undef
337  ret double %r
338}
339
340define double @fdiv_undef_op0_constant_nan(double %x) {
341; CHECK-LABEL: @fdiv_undef_op0_constant_nan(
342; CHECK-NEXT:    ret double 0x7FF8000000000000
343;
344  %r = fdiv double undef, 0xFFF8000000000110
345  ret double %r
346}
347
348define double @fdiv_undef_op1_nnan_constant_nan(double %x) {
349; CHECK-LABEL: @fdiv_undef_op1_nnan_constant_nan(
350; CHECK-NEXT:    ret double 0x7FF8000000000000
351;
352  %r = fdiv nnan double 0x7FF0000000000111, undef
353  ret double %r
354}
355
356define double @frem_undef_op0_constant_nan(double %x) {
357; CHECK-LABEL: @frem_undef_op0_constant_nan(
358; CHECK-NEXT:    ret double 0x7FF8000000000000
359;
360  %r = frem double undef, 0x7FF8000000001000
361  ret double %r
362}
363
364define double @frem_undef_op1_fast_constant_nan(double %x) {
365; CHECK-LABEL: @frem_undef_op1_fast_constant_nan(
366; CHECK-NEXT:    ret double 0x7FF8000000000000
367;
368  %r = frem fast double 0xFFF0000000001001, undef
369  ret double %r
370}
371
372; Constant folding - special constants: Inf.
373
374define double @fadd_undef_op0_constant_inf(double %x) {
375; CHECK-LABEL: @fadd_undef_op0_constant_inf(
376; CHECK-NEXT:    ret double 0x7FF8000000000000
377;
378  %r = fadd double undef, 0x7FF0000000000000
379  ret double %r
380}
381
382define double @fadd_undef_op1_fast_constant_inf(double %x) {
383; CHECK-LABEL: @fadd_undef_op1_fast_constant_inf(
384; CHECK-NEXT:    ret double 0x7FF8000000000000
385;
386  %r = fadd fast double 0xFFF0000000000000, undef
387  ret double %r
388}
389
390define double @fsub_undef_op0_constant_inf(double %x) {
391; CHECK-LABEL: @fsub_undef_op0_constant_inf(
392; CHECK-NEXT:    ret double 0x7FF8000000000000
393;
394  %r = fsub double undef, 0xFFF0000000000000
395  ret double %r
396}
397
398define double @fsub_undef_op1_ninf_constant_inf(double %x) {
399; CHECK-LABEL: @fsub_undef_op1_ninf_constant_inf(
400; CHECK-NEXT:    ret double 0x7FF8000000000000
401;
402  %r = fsub ninf double 0x7FF0000000000000, undef
403  ret double %r
404}
405
406define double @fmul_undef_op0_constant_inf(double %x) {
407; CHECK-LABEL: @fmul_undef_op0_constant_inf(
408; CHECK-NEXT:    ret double 0x7FF8000000000000
409;
410  %r = fmul double undef, 0x7FF0000000000000
411  ret double %r
412}
413
414define double @fmul_undef_op1_fast_constant_inf(double %x) {
415; CHECK-LABEL: @fmul_undef_op1_fast_constant_inf(
416; CHECK-NEXT:    ret double 0x7FF8000000000000
417;
418  %r = fmul fast double 0xFFF0000000000000, undef
419  ret double %r
420}
421
422define double @fdiv_undef_op0_constant_inf(double %x) {
423; CHECK-LABEL: @fdiv_undef_op0_constant_inf(
424; CHECK-NEXT:    ret double 0x7FF8000000000000
425;
426  %r = fdiv double undef, 0xFFF0000000000000
427  ret double %r
428}
429
430define double @fdiv_undef_op1_ninf_constant_inf(double %x) {
431; CHECK-LABEL: @fdiv_undef_op1_ninf_constant_inf(
432; CHECK-NEXT:    ret double 0x7FF8000000000000
433;
434  %r = fdiv ninf double 0x7FF0000000000000, undef
435  ret double %r
436}
437
438define double @frem_undef_op0_constant_inf(double %x) {
439; CHECK-LABEL: @frem_undef_op0_constant_inf(
440; CHECK-NEXT:    ret double 0x7FF8000000000000
441;
442  %r = frem double undef, 0x7FF0000000000000
443  ret double %r
444}
445
446define double @frem_undef_op1_fast_constant_inf(double %x) {
447; CHECK-LABEL: @frem_undef_op1_fast_constant_inf(
448; CHECK-NEXT:    ret double 0x7FF8000000000000
449;
450  %r = frem fast double 0xFFF0000000000000, undef
451  ret double %r
452}
453
454