@@ -25,7 +25,7 @@ define float @select_fpclass_fadd(i1 %cond, float nofpclass(nan) %A, float %B) {
2525
2626define float @select_fpclass_fadd_ninf1 (i1 %cond , float nofpclass(nan) %A , float %B ) {
2727; CHECK-LABEL: @select_fpclass_fadd_ninf1(
28- ; CHECK-NEXT: [[C:%.*]] = select i1 [[COND:%.*]], float [[B:%.*]], float -0.000000e+00
28+ ; CHECK-NEXT: [[C:%.*]] = select ninf i1 [[COND:%.*]], float [[B:%.*]], float -0.000000e+00
2929; CHECK-NEXT: [[D:%.*]] = fadd float [[A:%.*]], [[C]]
3030; CHECK-NEXT: ret float [[D]]
3131;
@@ -91,7 +91,7 @@ define float @select_nnan_fadd_swapped(i1 %cond, float %A, float %B) {
9191
9292define float @select_nnan_fadd_fast_math (i1 %cond , float %A , float %B ) {
9393; CHECK-LABEL: @select_nnan_fadd_fast_math(
94- ; CHECK-NEXT: [[C:%.*]] = select nnan i1 [[COND:%.*]], float [[B:%.*]], float -0.000000e+00
94+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float [[B:%.*]], float -0.000000e+00
9595; CHECK-NEXT: [[D:%.*]] = fadd reassoc nnan arcp contract afn float [[A:%.*]], [[C]]
9696; CHECK-NEXT: ret float [[D]]
9797;
@@ -102,7 +102,7 @@ define float @select_nnan_fadd_fast_math(i1 %cond, float %A, float %B) {
102102
103103define float @select_nnan_fadd_swapped_fast_math (i1 %cond , float %A , float %B ) {
104104; CHECK-LABEL: @select_nnan_fadd_swapped_fast_math(
105- ; CHECK-NEXT: [[C:%.*]] = select nnan i1 [[COND:%.*]], float -0.000000e+00, float [[B:%.*]]
105+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float -0.000000e+00, float [[B:%.*]]
106106; CHECK-NEXT: [[D:%.*]] = fadd reassoc nnan arcp contract afn float [[A:%.*]], [[C]]
107107; CHECK-NEXT: ret float [[D]]
108108;
@@ -168,7 +168,7 @@ define float @select_nnan_fmul_swapped(i1 %cond, float %A, float %B) {
168168
169169define float @select_nnan_fmul_fast_math (i1 %cond , float %A , float %B ) {
170170; CHECK-LABEL: @select_nnan_fmul_fast_math(
171- ; CHECK-NEXT: [[C:%.*]] = select nnan i1 [[COND:%.*]], float [[B:%.*]], float 1.000000e+00
171+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float [[B:%.*]], float 1.000000e+00
172172; CHECK-NEXT: [[D:%.*]] = fmul reassoc nnan arcp contract afn float [[A:%.*]], [[C]]
173173; CHECK-NEXT: ret float [[D]]
174174;
@@ -179,7 +179,7 @@ define float @select_nnan_fmul_fast_math(i1 %cond, float %A, float %B) {
179179
180180define float @select_nnan_fmul_swapped_fast_math (i1 %cond , float %A , float %B ) {
181181; CHECK-LABEL: @select_nnan_fmul_swapped_fast_math(
182- ; CHECK-NEXT: [[C:%.*]] = select nnan i1 [[COND:%.*]], float 1.000000e+00, float [[B:%.*]]
182+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float 1.000000e+00, float [[B:%.*]]
183183; CHECK-NEXT: [[D:%.*]] = fmul reassoc nnan arcp contract afn float [[A:%.*]], [[C]]
184184; CHECK-NEXT: ret float [[D]]
185185;
@@ -188,6 +188,50 @@ define float @select_nnan_fmul_swapped_fast_math(i1 %cond, float %A, float %B) {
188188 ret float %D
189189}
190190
191+ define float @select_fpclass_fmul_ninf1 (i1 %cond , float nofpclass(nan) %A , float %B ) {
192+ ; CHECK-LABEL: @select_fpclass_fmul_ninf1(
193+ ; CHECK-NEXT: [[C:%.*]] = select ninf i1 [[COND:%.*]], float [[B:%.*]], float 1.000000e+00
194+ ; CHECK-NEXT: [[D:%.*]] = fmul float [[A:%.*]], [[C]]
195+ ; CHECK-NEXT: ret float [[D]]
196+ ;
197+ %C = fmul ninf float %A , %B
198+ %D = select i1 %cond , float %C , float %A
199+ ret float %D
200+ }
201+
202+ define float @select_fpclass_fmul_ninf2 (i1 %cond , float nofpclass(nan) %A , float %B ) {
203+ ; CHECK-LABEL: @select_fpclass_fmul_ninf2(
204+ ; CHECK-NEXT: [[C:%.*]] = select i1 [[COND:%.*]], float [[B:%.*]], float 1.000000e+00
205+ ; CHECK-NEXT: [[D:%.*]] = fmul float [[A:%.*]], [[C]]
206+ ; CHECK-NEXT: ret float [[D]]
207+ ;
208+ %C = fmul float %A , %B
209+ %D = select ninf i1 %cond , float %C , float %A
210+ ret float %D
211+ }
212+
213+ define float @select_fpclass_fmul_ninf3 (i1 %cond , float nofpclass(nan) %A , float %B ) {
214+ ; CHECK-LABEL: @select_fpclass_fmul_ninf3(
215+ ; CHECK-NEXT: [[C:%.*]] = select ninf i1 [[COND:%.*]], float [[B:%.*]], float 1.000000e+00
216+ ; CHECK-NEXT: [[D:%.*]] = fmul ninf float [[A:%.*]], [[C]]
217+ ; CHECK-NEXT: ret float [[D]]
218+ ;
219+ %C = fmul ninf float %A , %B
220+ %D = select ninf i1 %cond , float %C , float %A
221+ ret float %D
222+ }
223+
224+ define float @select_fpclass_fmul_nnan_ninf (i1 %cond , float nofpclass(nan) %A , float %B ) {
225+ ; CHECK-LABEL: @select_fpclass_fmul_nnan_ninf(
226+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float [[B:%.*]], float 1.000000e+00
227+ ; CHECK-NEXT: [[D:%.*]] = fmul float [[A:%.*]], [[C]]
228+ ; CHECK-NEXT: ret float [[D]]
229+ ;
230+ %C = fmul float %A , %B
231+ %D = select nnan ninf i1 %cond , float %C , float %A
232+ ret float %D
233+ }
234+
191235define float @select_nnan_fsub (i1 %cond , float %A , float %B ) {
192236; CHECK-LABEL: @select_nnan_fsub(
193237; CHECK-NEXT: [[C:%.*]] = select nnan i1 [[COND:%.*]], float [[B:%.*]], float 0.000000e+00
@@ -212,7 +256,7 @@ define float @select_nnan_fsub_swapped(i1 %cond, float %A, float %B) {
212256
213257define float @select_nnan_fsub_fast_math (i1 %cond , float %A , float %B ) {
214258; CHECK-LABEL: @select_nnan_fsub_fast_math(
215- ; CHECK-NEXT: [[C:%.*]] = select nnan i1 [[COND:%.*]], float [[B:%.*]], float 0.000000e+00
259+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float [[B:%.*]], float 0.000000e+00
216260; CHECK-NEXT: [[D:%.*]] = fsub reassoc nnan arcp contract afn float [[A:%.*]], [[C]]
217261; CHECK-NEXT: ret float [[D]]
218262;
@@ -223,7 +267,7 @@ define float @select_nnan_fsub_fast_math(i1 %cond, float %A, float %B) {
223267
224268define float @select_nnan_fsub_swapped_fast_math (i1 %cond , float %A , float %B ) {
225269; CHECK-LABEL: @select_nnan_fsub_swapped_fast_math(
226- ; CHECK-NEXT: [[C:%.*]] = select nnan i1 [[COND:%.*]], float 0.000000e+00, float [[B:%.*]]
270+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float 0.000000e+00, float [[B:%.*]]
227271; CHECK-NEXT: [[D:%.*]] = fsub reassoc nnan arcp contract afn float [[A:%.*]], [[C]]
228272; CHECK-NEXT: ret float [[D]]
229273;
@@ -232,6 +276,50 @@ define float @select_nnan_fsub_swapped_fast_math(i1 %cond, float %A, float %B) {
232276 ret float %D
233277}
234278
279+ define float @select_fpclass_fsub_ninf1 (i1 %cond , float nofpclass(nan) %A , float %B ) {
280+ ; CHECK-LABEL: @select_fpclass_fsub_ninf1(
281+ ; CHECK-NEXT: [[C:%.*]] = select ninf i1 [[COND:%.*]], float [[B:%.*]], float 0.000000e+00
282+ ; CHECK-NEXT: [[D:%.*]] = fsub float [[A:%.*]], [[C]]
283+ ; CHECK-NEXT: ret float [[D]]
284+ ;
285+ %C = fsub ninf float %A , %B
286+ %D = select i1 %cond , float %C , float %A
287+ ret float %D
288+ }
289+
290+ define float @select_fpclass_fsub_ninf2 (i1 %cond , float nofpclass(nan) %A , float %B ) {
291+ ; CHECK-LABEL: @select_fpclass_fsub_ninf2(
292+ ; CHECK-NEXT: [[C:%.*]] = select i1 [[COND:%.*]], float [[B:%.*]], float 0.000000e+00
293+ ; CHECK-NEXT: [[D:%.*]] = fsub float [[A:%.*]], [[C]]
294+ ; CHECK-NEXT: ret float [[D]]
295+ ;
296+ %C = fsub float %A , %B
297+ %D = select ninf i1 %cond , float %C , float %A
298+ ret float %D
299+ }
300+
301+ define float @select_fpclass_fsub_ninf3 (i1 %cond , float nofpclass(nan) %A , float %B ) {
302+ ; CHECK-LABEL: @select_fpclass_fsub_ninf3(
303+ ; CHECK-NEXT: [[C:%.*]] = select ninf i1 [[COND:%.*]], float [[B:%.*]], float 0.000000e+00
304+ ; CHECK-NEXT: [[D:%.*]] = fsub ninf float [[A:%.*]], [[C]]
305+ ; CHECK-NEXT: ret float [[D]]
306+ ;
307+ %C = fsub ninf float %A , %B
308+ %D = select ninf i1 %cond , float %C , float %A
309+ ret float %D
310+ }
311+
312+ define float @select_fpclass_fsub_nnan_ninf (i1 %cond , float nofpclass(nan) %A , float %B ) {
313+ ; CHECK-LABEL: @select_fpclass_fsub_nnan_ninf(
314+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float [[B:%.*]], float 0.000000e+00
315+ ; CHECK-NEXT: [[D:%.*]] = fsub float [[A:%.*]], [[C]]
316+ ; CHECK-NEXT: ret float [[D]]
317+ ;
318+ %C = fsub float %A , %B
319+ %D = select nnan ninf i1 %cond , float %C , float %A
320+ ret float %D
321+ }
322+
235323define <4 x float > @select_nnan_nsz_fsub_v4f32 (<4 x i1 > %cond , <4 x float > %A , <4 x float > %B ) {
236324; CHECK-LABEL: @select_nnan_nsz_fsub_v4f32(
237325; CHECK-NEXT: [[C:%.*]] = select nnan nsz <4 x i1> [[COND:%.*]], <4 x float> [[B:%.*]], <4 x float> zeroinitializer
@@ -290,7 +378,7 @@ define float @select_nnan_fdiv_swapped(i1 %cond, float %A, float %B) {
290378
291379define float @select_nnan_fdiv_fast_math (i1 %cond , float %A , float %B ) {
292380; CHECK-LABEL: @select_nnan_fdiv_fast_math(
293- ; CHECK-NEXT: [[C:%.*]] = select nnan i1 [[COND:%.*]], float [[B:%.*]], float 1.000000e+00
381+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float [[B:%.*]], float 1.000000e+00
294382; CHECK-NEXT: [[D:%.*]] = fdiv reassoc nnan arcp contract afn float [[A:%.*]], [[C]]
295383; CHECK-NEXT: ret float [[D]]
296384;
@@ -301,7 +389,7 @@ define float @select_nnan_fdiv_fast_math(i1 %cond, float %A, float %B) {
301389
302390define float @select_nnan_fdiv_swapped_fast_math (i1 %cond , float %A , float %B ) {
303391; CHECK-LABEL: @select_nnan_fdiv_swapped_fast_math(
304- ; CHECK-NEXT: [[C:%.*]] = select nnan i1 [[COND:%.*]], float 1.000000e+00, float [[B:%.*]]
392+ ; CHECK-NEXT: [[C:%.*]] = select nnan ninf i1 [[COND:%.*]], float 1.000000e+00, float [[B:%.*]]
305393; CHECK-NEXT: [[D:%.*]] = fdiv reassoc nnan arcp contract afn float [[A:%.*]], [[C]]
306394; CHECK-NEXT: ret float [[D]]
307395;
0 commit comments