@@ -1004,3 +1004,115 @@ define float @test_ui_add_with_signed_constant(i32 %shr.i) {
1004
1004
%add = fadd float %sub , -16383 .0
1005
1005
ret float %add
1006
1006
}
1007
+
1008
+
1009
+ ;; Reduced form of bug noticed due to #82555
1010
+ define float @missed_nonzero_check_on_constant_for_si_fmul (i1 %c , i1 %.b , ptr %g_2345 ) {
1011
+ ; CHECK-LABEL: @missed_nonzero_check_on_constant_for_si_fmul(
1012
+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 53264
1013
+ ; CHECK-NEXT: store i32 [[SEL]], ptr [[G_2345:%.*]], align 4
1014
+ ; CHECK-NEXT: ret float 0.000000e+00
1015
+ ;
1016
+ %sel = select i1 %c , i32 65529 , i32 53264
1017
+ %conv.i = trunc i32 %sel to i16
1018
+ %conv1.i = sitofp i16 %conv.i to float
1019
+ %mul3.i.i = fmul float %conv1.i , 0 .000000e+00
1020
+ store i32 %sel , ptr %g_2345 , align 4
1021
+ ret float %mul3.i.i
1022
+ }
1023
+
1024
+ define <2 x float > @missed_nonzero_check_on_constant_for_si_fmul_vec (i1 %c , i1 %.b , ptr %g_2345 ) {
1025
+ ; CHECK-LABEL: @missed_nonzero_check_on_constant_for_si_fmul_vec(
1026
+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 53264
1027
+ ; CHECK-NEXT: store i32 [[SEL]], ptr [[G_2345:%.*]], align 4
1028
+ ; CHECK-NEXT: ret <2 x float> zeroinitializer
1029
+ ;
1030
+ %sel = select i1 %c , i32 65529 , i32 53264
1031
+ %conv.i.s = trunc i32 %sel to i16
1032
+ %conv.i.v = insertelement <2 x i16 > poison, i16 %conv.i.s , i64 0
1033
+ %conv.i = insertelement <2 x i16 > %conv.i.v , i16 %conv.i.s , i64 1
1034
+ %conv1.i = sitofp <2 x i16 > %conv.i to <2 x float >
1035
+ %mul3.i.i = fmul <2 x float > %conv1.i , zeroinitializer
1036
+ store i32 %sel , ptr %g_2345 , align 4
1037
+ ret <2 x float > %mul3.i.i
1038
+ }
1039
+
1040
+ define float @negzero_check_on_constant_for_si_fmul (i1 %c , i1 %.b , ptr %g_2345 ) {
1041
+ ; CHECK-LABEL: @negzero_check_on_constant_for_si_fmul(
1042
+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 53264
1043
+ ; CHECK-NEXT: [[CONV_I:%.*]] = trunc i32 [[SEL]] to i16
1044
+ ; CHECK-NEXT: [[CONV1_I:%.*]] = sitofp i16 [[CONV_I]] to float
1045
+ ; CHECK-NEXT: [[MUL3_I_I:%.*]] = fmul float [[CONV1_I]], -0.000000e+00
1046
+ ; CHECK-NEXT: store i32 [[SEL]], ptr [[G_2345:%.*]], align 4
1047
+ ; CHECK-NEXT: ret float [[MUL3_I_I]]
1048
+ ;
1049
+ %sel = select i1 %c , i32 65529 , i32 53264
1050
+ %conv.i = trunc i32 %sel to i16
1051
+ %conv1.i = sitofp i16 %conv.i to float
1052
+ %mul3.i.i = fmul float %conv1.i , -0 .000000e+00
1053
+ store i32 %sel , ptr %g_2345 , align 4
1054
+ ret float %mul3.i.i
1055
+ }
1056
+
1057
+ define <2 x float > @nonzero_check_on_constant_for_si_fmul_vec_w_undef (i1 %c , i1 %.b , ptr %g_2345 ) {
1058
+ ; CHECK-LABEL: @nonzero_check_on_constant_for_si_fmul_vec_w_undef(
1059
+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 53264
1060
+ ; CHECK-NEXT: [[CONV_I_S:%.*]] = trunc i32 [[SEL]] to i16
1061
+ ; CHECK-NEXT: [[CONV_I_V:%.*]] = insertelement <2 x i16> poison, i16 [[CONV_I_S]], i64 0
1062
+ ; CHECK-NEXT: [[CONV_I:%.*]] = shufflevector <2 x i16> [[CONV_I_V]], <2 x i16> poison, <2 x i32> zeroinitializer
1063
+ ; CHECK-NEXT: [[CONV1_I:%.*]] = sitofp <2 x i16> [[CONV_I]] to <2 x float>
1064
+ ; CHECK-NEXT: [[MUL3_I_I:%.*]] = fmul <2 x float> [[CONV1_I]], <float undef, float 0.000000e+00>
1065
+ ; CHECK-NEXT: store i32 [[SEL]], ptr [[G_2345:%.*]], align 4
1066
+ ; CHECK-NEXT: ret <2 x float> [[MUL3_I_I]]
1067
+ ;
1068
+ %sel = select i1 %c , i32 65529 , i32 53264
1069
+ %conv.i.s = trunc i32 %sel to i16
1070
+ %conv.i.v = insertelement <2 x i16 > poison, i16 %conv.i.s , i64 0
1071
+ %conv.i = insertelement <2 x i16 > %conv.i.v , i16 %conv.i.s , i64 1
1072
+ %conv1.i = sitofp <2 x i16 > %conv.i to <2 x float >
1073
+ %mul3.i.i = fmul <2 x float > %conv1.i , <float undef , float 0 .000000e+00 >
1074
+ store i32 %sel , ptr %g_2345 , align 4
1075
+ ret <2 x float > %mul3.i.i
1076
+ }
1077
+
1078
+ define <2 x float > @nonzero_check_on_constant_for_si_fmul_nz_vec_w_undef (i1 %c , i1 %.b , ptr %g_2345 ) {
1079
+ ; CHECK-LABEL: @nonzero_check_on_constant_for_si_fmul_nz_vec_w_undef(
1080
+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 53264
1081
+ ; CHECK-NEXT: [[CONV_I_S:%.*]] = trunc i32 [[SEL]] to i16
1082
+ ; CHECK-NEXT: [[CONV_I_V:%.*]] = insertelement <2 x i16> poison, i16 [[CONV_I_S]], i64 0
1083
+ ; CHECK-NEXT: [[CONV_I:%.*]] = shufflevector <2 x i16> [[CONV_I_V]], <2 x i16> poison, <2 x i32> zeroinitializer
1084
+ ; CHECK-NEXT: [[CONV1_I:%.*]] = sitofp <2 x i16> [[CONV_I]] to <2 x float>
1085
+ ; CHECK-NEXT: [[MUL3_I_I:%.*]] = fmul <2 x float> [[CONV1_I]], <float undef, float 1.000000e+00>
1086
+ ; CHECK-NEXT: store i32 [[SEL]], ptr [[G_2345:%.*]], align 4
1087
+ ; CHECK-NEXT: ret <2 x float> [[MUL3_I_I]]
1088
+ ;
1089
+ %sel = select i1 %c , i32 65529 , i32 53264
1090
+ %conv.i.s = trunc i32 %sel to i16
1091
+ %conv.i.v = insertelement <2 x i16 > poison, i16 %conv.i.s , i64 0
1092
+ %conv.i = insertelement <2 x i16 > %conv.i.v , i16 %conv.i.s , i64 1
1093
+ %conv1.i = sitofp <2 x i16 > %conv.i to <2 x float >
1094
+ %mul3.i.i = fmul <2 x float > %conv1.i , <float undef , float 1 .000000e+00 >
1095
+ store i32 %sel , ptr %g_2345 , align 4
1096
+ ret <2 x float > %mul3.i.i
1097
+ }
1098
+
1099
+ define <2 x float > @nonzero_check_on_constant_for_si_fmul_negz_vec_w_undef (i1 %c , i1 %.b , ptr %g_2345 ) {
1100
+ ; CHECK-LABEL: @nonzero_check_on_constant_for_si_fmul_negz_vec_w_undef(
1101
+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[C:%.*]], i32 65529, i32 53264
1102
+ ; CHECK-NEXT: [[CONV_I_S:%.*]] = trunc i32 [[SEL]] to i16
1103
+ ; CHECK-NEXT: [[CONV_I_V:%.*]] = insertelement <2 x i16> poison, i16 [[CONV_I_S]], i64 0
1104
+ ; CHECK-NEXT: [[CONV_I:%.*]] = shufflevector <2 x i16> [[CONV_I_V]], <2 x i16> poison, <2 x i32> zeroinitializer
1105
+ ; CHECK-NEXT: [[CONV1_I:%.*]] = sitofp <2 x i16> [[CONV_I]] to <2 x float>
1106
+ ; CHECK-NEXT: [[MUL3_I_I:%.*]] = fmul <2 x float> [[CONV1_I]], <float undef, float -0.000000e+00>
1107
+ ; CHECK-NEXT: store i32 [[SEL]], ptr [[G_2345:%.*]], align 4
1108
+ ; CHECK-NEXT: ret <2 x float> [[MUL3_I_I]]
1109
+ ;
1110
+ %sel = select i1 %c , i32 65529 , i32 53264
1111
+ %conv.i.s = trunc i32 %sel to i16
1112
+ %conv.i.v = insertelement <2 x i16 > poison, i16 %conv.i.s , i64 0
1113
+ %conv.i = insertelement <2 x i16 > %conv.i.v , i16 %conv.i.s , i64 1
1114
+ %conv1.i = sitofp <2 x i16 > %conv.i to <2 x float >
1115
+ %mul3.i.i = fmul <2 x float > %conv1.i , <float undef , float -0 .000000e+00 >
1116
+ store i32 %sel , ptr %g_2345 , align 4
1117
+ ret <2 x float > %mul3.i.i
1118
+ }
0 commit comments