@@ -6054,3 +6054,289 @@ define i1 @icmp_samesign_logical_or(i32 %In) {
6054
6054
%V = select i1 %c1 , i1 true , i1 %c2
6055
6055
ret i1 %V
6056
6056
}
6057
+
6058
+ ; https://alive2.llvm.org/ce/z/XtQS6H
6059
+ define i1 @float_to_int_comparing_constant1_positive1 (float %arg0 ) {
6060
+ ; CHECK-LABEL: define i1 @float_to_int_comparing_constant1_positive1(
6061
+ ; CHECK-SAME: float [[ARG0:%.*]]) {
6062
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi float [[ARG0]] to i32
6063
+ ; CHECK-NEXT: [[V1:%.*]] = icmp sgt i32 [[V0]], -1
6064
+ ; CHECK-NEXT: ret i1 [[V1]]
6065
+ ;
6066
+ %v0 = fptosi float %arg0 to i32
6067
+ %v1 = icmp sgt i32 %v0 , -1
6068
+ ret i1 %v1
6069
+ }
6070
+
6071
+ ; https://alive2.llvm.org/ce/z/ZycBgc
6072
+ define i1 @float_to_int_comparing_constant1_positive2 (float %arg0 ) {
6073
+ ; CHECK-LABEL: define i1 @float_to_int_comparing_constant1_positive2(
6074
+ ; CHECK-SAME: float [[ARG0:%.*]]) {
6075
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi float [[ARG0]] to i32
6076
+ ; CHECK-NEXT: [[V1:%.*]] = icmp sgt i32 [[V0]], 1
6077
+ ; CHECK-NEXT: ret i1 [[V1]]
6078
+ ;
6079
+ %v0 = fptosi float %arg0 to i32
6080
+ %v1 = icmp sgt i32 %v0 , 1
6081
+ ret i1 %v1
6082
+ }
6083
+
6084
+ ; https://alive2.llvm.org/ce/z/5VRWXi
6085
+ define i1 @float_to_int_comparing_constant2_positive1 (float %arg0 ) {
6086
+ ; CHECK-LABEL: define i1 @float_to_int_comparing_constant2_positive1(
6087
+ ; CHECK-SAME: float [[ARG0:%.*]]) {
6088
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi float [[ARG0]] to i32
6089
+ ; CHECK-NEXT: [[V1:%.*]] = icmp slt i32 [[V0]], 1
6090
+ ; CHECK-NEXT: ret i1 [[V1]]
6091
+ ;
6092
+ %v0 = fptosi float %arg0 to i32
6093
+ %v1 = icmp slt i32 %v0 , 1
6094
+ ret i1 %v1
6095
+ }
6096
+
6097
+ ; https://alive2.llvm.org/ce/z/9bejWa
6098
+ define i1 @float_to_int_comparing_constant2_positive2 (float %arg0 ) {
6099
+ ; CHECK-LABEL: define i1 @float_to_int_comparing_constant2_positive2(
6100
+ ; CHECK-SAME: float [[ARG0:%.*]]) {
6101
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi float [[ARG0]] to i32
6102
+ ; CHECK-NEXT: [[V1:%.*]] = icmp slt i32 [[V0]], 0
6103
+ ; CHECK-NEXT: ret i1 [[V1]]
6104
+ ;
6105
+ %v0 = fptosi float %arg0 to i32
6106
+ %v1 = icmp slt i32 %v0 , 0
6107
+ ret i1 %v1
6108
+ }
6109
+
6110
+ define i1 @double_to_int_comparing_constant1_positive1 (double %arg0 ) {
6111
+ ; CHECK-LABEL: define i1 @double_to_int_comparing_constant1_positive1(
6112
+ ; CHECK-SAME: double [[ARG0:%.*]]) {
6113
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi double [[ARG0]] to i32
6114
+ ; CHECK-NEXT: [[V1:%.*]] = icmp sgt i32 [[V0]], -1
6115
+ ; CHECK-NEXT: ret i1 [[V1]]
6116
+ ;
6117
+ %v0 = fptosi double %arg0 to i32
6118
+ %v1 = icmp sgt i32 %v0 , -1
6119
+ ret i1 %v1
6120
+ }
6121
+
6122
+ define i1 @double_to_int_comparing_constant1_positive2 (double %arg0 ) {
6123
+ ; CHECK-LABEL: define i1 @double_to_int_comparing_constant1_positive2(
6124
+ ; CHECK-SAME: double [[ARG0:%.*]]) {
6125
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi double [[ARG0]] to i32
6126
+ ; CHECK-NEXT: [[V1:%.*]] = icmp sgt i32 [[V0]], 1
6127
+ ; CHECK-NEXT: ret i1 [[V1]]
6128
+ ;
6129
+ %v0 = fptosi double %arg0 to i32
6130
+ %v1 = icmp sgt i32 %v0 , 1
6131
+ ret i1 %v1
6132
+ }
6133
+
6134
+ define i1 @fp16_to_int_comparing_constant2_positive1 (half %arg0 ) {
6135
+ ; CHECK-LABEL: define i1 @fp16_to_int_comparing_constant2_positive1(
6136
+ ; CHECK-SAME: half [[ARG0:%.*]]) {
6137
+ ; CHECK-NEXT: [[V1:%.*]] = fptosi half [[ARG0]] to i32
6138
+ ; CHECK-NEXT: [[V2:%.*]] = icmp slt i32 [[V1]], 1
6139
+ ; CHECK-NEXT: ret i1 [[V2]]
6140
+ ;
6141
+ %v0 = fptosi half %arg0 to i32
6142
+ %v1 = icmp slt i32 %v0 , 1
6143
+ ret i1 %v1
6144
+ }
6145
+
6146
+ define i1 @fp16_to_int_comparing_constant2_positive2 (half %arg0 ) {
6147
+ ; CHECK-LABEL: define i1 @fp16_to_int_comparing_constant2_positive2(
6148
+ ; CHECK-SAME: half [[ARG0:%.*]]) {
6149
+ ; CHECK-NEXT: [[V1:%.*]] = fptosi half [[ARG0]] to i32
6150
+ ; CHECK-NEXT: [[V2:%.*]] = icmp slt i32 [[V1]], 0
6151
+ ; CHECK-NEXT: ret i1 [[V2]]
6152
+ ;
6153
+ %v0 = fptosi half %arg0 to i32
6154
+ %v1 = icmp slt i32 %v0 , 0
6155
+ ret i1 %v1
6156
+ }
6157
+
6158
+ define i1 @float_to_int_comparing_constant1_negative1 (float %arg0 ) {
6159
+ ; CHECK-LABEL: define i1 @float_to_int_comparing_constant1_negative1(
6160
+ ; CHECK-SAME: float [[ARG0:%.*]]) {
6161
+ ; CHECK-NEXT: ret i1 false
6162
+ ;
6163
+ %v0 = fptosi float %arg0 to i8
6164
+ %v1 = icmp sgt i8 %v0 , 127
6165
+ ret i1 %v1
6166
+ }
6167
+
6168
+ define i1 @float_to_int_comparing_constant1_negative2 (float %arg0 ) {
6169
+ ; CHECK-LABEL: define i1 @float_to_int_comparing_constant1_negative2(
6170
+ ; CHECK-SAME: float [[ARG0:%.*]]) {
6171
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi float [[ARG0]] to i8
6172
+ ; CHECK-NEXT: [[V1:%.*]] = icmp eq i8 [[V0]], 127
6173
+ ; CHECK-NEXT: ret i1 [[V1]]
6174
+ ;
6175
+ %v0 = fptosi float %arg0 to i8
6176
+ %v1 = icmp sge i8 %v0 , 127
6177
+ ret i1 %v1
6178
+ }
6179
+
6180
+ define i1 @float_to_int_comparing_constant2_negative1 (float %arg0 ) {
6181
+ ; CHECK-LABEL: define i1 @float_to_int_comparing_constant2_negative1(
6182
+ ; CHECK-SAME: float [[ARG0:%.*]]) {
6183
+ ; CHECK-NEXT: ret i1 false
6184
+ ;
6185
+ %v0 = fptosi float %arg0 to i8
6186
+ %v1 = icmp slt i8 %v0 , -128
6187
+ ret i1 %v1
6188
+ }
6189
+
6190
+ define i1 @float_to_int_comparing_constant2_negative2 (float %arg0 ) {
6191
+ ; CHECK-LABEL: define i1 @float_to_int_comparing_constant2_negative2(
6192
+ ; CHECK-SAME: float [[ARG0:%.*]]) {
6193
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi float [[ARG0]] to i8
6194
+ ; CHECK-NEXT: [[V1:%.*]] = icmp eq i8 [[V0]], -128
6195
+ ; CHECK-NEXT: ret i1 [[V1]]
6196
+ ;
6197
+ %v0 = fptosi float %arg0 to i8
6198
+ %v1 = icmp sle i8 %v0 , -128
6199
+ ret i1 %v1
6200
+ }
6201
+
6202
+ define <2 x i1 > @float_to_int_comparing_constant_vec_positive1 (<2 x float > %arg0 ) {
6203
+ ; CHECK-LABEL: define <2 x i1> @float_to_int_comparing_constant_vec_positive1(
6204
+ ; CHECK-SAME: <2 x float> [[ARG0:%.*]]) {
6205
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x float> [[ARG0]] to <2 x i32>
6206
+ ; CHECK-NEXT: [[V1:%.*]] = icmp sgt <2 x i32> [[V0]], splat (i32 -1)
6207
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6208
+ ;
6209
+ %v0 = fptosi <2 x float > %arg0 to <2 x i32 >
6210
+ %v1 = icmp sgt <2 x i32 > %v0 , <i32 -1 , i32 -1 >
6211
+ ret <2 x i1 > %v1
6212
+ }
6213
+
6214
+ define <2 x i1 > @float_to_int_comparing_constant_vec_positive2 (<2 x float > %arg0 ) {
6215
+ ; CHECK-LABEL: define <2 x i1> @float_to_int_comparing_constant_vec_positive2(
6216
+ ; CHECK-SAME: <2 x float> [[ARG0:%.*]]) {
6217
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x float> [[ARG0]] to <2 x i32>
6218
+ ; CHECK-NEXT: [[V1:%.*]] = icmp sgt <2 x i32> [[V0]], <i32 0, i32 1>
6219
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6220
+ ;
6221
+ %v0 = fptosi <2 x float > %arg0 to <2 x i32 >
6222
+ %v1 = icmp sgt <2 x i32 > %v0 , <i32 0 , i32 1 >
6223
+ ret <2 x i1 > %v1
6224
+ }
6225
+
6226
+
6227
+ define <2 x i1 > @float_to_int_comparing_constant_vec_positive3 (<2 x float > %arg0 ) {
6228
+ ; CHECK-LABEL: define <2 x i1> @float_to_int_comparing_constant_vec_positive3(
6229
+ ; CHECK-SAME: <2 x float> [[ARG0:%.*]]) {
6230
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x float> [[ARG0]] to <2 x i32>
6231
+ ; CHECK-NEXT: [[V1:%.*]] = icmp slt <2 x i32> [[V0]], splat (i32 1)
6232
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6233
+ ;
6234
+ %v0 = fptosi <2 x float > %arg0 to <2 x i32 >
6235
+ %v1 = icmp slt <2 x i32 > %v0 , <i32 1 , i32 1 >
6236
+ ret <2 x i1 > %v1
6237
+ }
6238
+
6239
+ define <2 x i1 > @float_to_int_comparing_constant_vec_positive4 (<2 x float > %arg0 ) {
6240
+ ; CHECK-LABEL: define <2 x i1> @float_to_int_comparing_constant_vec_positive4(
6241
+ ; CHECK-SAME: <2 x float> [[ARG0:%.*]]) {
6242
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x float> [[ARG0]] to <2 x i32>
6243
+ ; CHECK-NEXT: [[V1:%.*]] = icmp slt <2 x i32> [[V0]], <i32 -1, i32 0>
6244
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6245
+ ;
6246
+ %v0 = fptosi <2 x float > %arg0 to <2 x i32 >
6247
+ %v1 = icmp slt <2 x i32 > %v0 , <i32 -1 , i32 0 >
6248
+ ret <2 x i1 > %v1
6249
+ }
6250
+
6251
+ define <2 x i1 > @half_to_int_comparing_constant_vec_positive1 (<2 x half > %arg0 ) {
6252
+ ; CHECK-LABEL: define <2 x i1> @half_to_int_comparing_constant_vec_positive1(
6253
+ ; CHECK-SAME: <2 x half> [[ARG0:%.*]]) {
6254
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x half> [[ARG0]] to <2 x i32>
6255
+ ; CHECK-NEXT: [[V1:%.*]] = icmp sgt <2 x i32> [[V0]], splat (i32 -1)
6256
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6257
+ ;
6258
+ %v0 = fptosi <2 x half > %arg0 to <2 x i32 >
6259
+ %v1 = icmp sgt <2 x i32 > %v0 , <i32 -1 , i32 -1 >
6260
+ ret <2 x i1 > %v1
6261
+ }
6262
+
6263
+ define <2 x i1 > @half_to_int_comparing_constant_vec_positive2 (<2 x half > %arg0 ) {
6264
+ ; CHECK-LABEL: define <2 x i1> @half_to_int_comparing_constant_vec_positive2(
6265
+ ; CHECK-SAME: <2 x half> [[ARG0:%.*]]) {
6266
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x half> [[ARG0]] to <2 x i32>
6267
+ ; CHECK-NEXT: [[V1:%.*]] = icmp sgt <2 x i32> [[V0]], <i32 0, i32 1>
6268
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6269
+ ;
6270
+ %v0 = fptosi <2 x half > %arg0 to <2 x i32 >
6271
+ %v1 = icmp sgt <2 x i32 > %v0 , <i32 0 , i32 1 >
6272
+ ret <2 x i1 > %v1
6273
+ }
6274
+
6275
+ define <2 x i1 > @double_to_int_comparing_constant_vec_positive3 (<2 x double > %arg0 ) {
6276
+ ; CHECK-LABEL: define <2 x i1> @double_to_int_comparing_constant_vec_positive3(
6277
+ ; CHECK-SAME: <2 x double> [[ARG0:%.*]]) {
6278
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x double> [[ARG0]] to <2 x i32>
6279
+ ; CHECK-NEXT: [[V1:%.*]] = icmp slt <2 x i32> [[V0]], splat (i32 1)
6280
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6281
+ ;
6282
+ %v0 = fptosi <2 x double > %arg0 to <2 x i32 >
6283
+ %v1 = icmp slt <2 x i32 > %v0 , <i32 1 , i32 1 >
6284
+ ret <2 x i1 > %v1
6285
+ }
6286
+
6287
+ define <2 x i1 > @double_to_int_comparing_constant_vec_positive4 (<2 x double > %arg0 ) {
6288
+ ; CHECK-LABEL: define <2 x i1> @double_to_int_comparing_constant_vec_positive4(
6289
+ ; CHECK-SAME: <2 x double> [[ARG0:%.*]]) {
6290
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x double> [[ARG0]] to <2 x i32>
6291
+ ; CHECK-NEXT: [[V1:%.*]] = icmp slt <2 x i32> [[V0]], <i32 -1, i32 0>
6292
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6293
+ ;
6294
+ %v0 = fptosi <2 x double > %arg0 to <2 x i32 >
6295
+ %v1 = icmp slt <2 x i32 > %v0 , <i32 -1 , i32 0 >
6296
+ ret <2 x i1 > %v1
6297
+ }
6298
+
6299
+ define <2 x i1 > @float_to_int_comparing_constant_vec_negative1 (<2 x float > %arg0 ) {
6300
+ ; CHECK-LABEL: define <2 x i1> @float_to_int_comparing_constant_vec_negative1(
6301
+ ; CHECK-SAME: <2 x float> [[ARG0:%.*]]) {
6302
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x float> [[ARG0]] to <2 x i32>
6303
+ ; CHECK-NEXT: [[V1:%.*]] = icmp sgt <2 x i32> [[V0]], <i32 -1, i32 1>
6304
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6305
+ ;
6306
+ %v0 = fptosi <2 x float > %arg0 to <2 x i32 >
6307
+ %v1 = icmp sgt <2 x i32 > %v0 , <i32 -1 , i32 1 >
6308
+ ret <2 x i1 > %v1
6309
+ }
6310
+
6311
+ define <2 x i1 > @float_to_int_comparing_constant_vec_negative2 (<2 x float > %arg0 ) {
6312
+ ; CHECK-LABEL: define <2 x i1> @float_to_int_comparing_constant_vec_negative2(
6313
+ ; CHECK-SAME: <2 x float> [[ARG0:%.*]]) {
6314
+ ; CHECK-NEXT: [[V0:%.*]] = fptosi <2 x float> [[ARG0]] to <2 x i32>
6315
+ ; CHECK-NEXT: [[V1:%.*]] = icmp slt <2 x i32> [[V0]], <i32 -1, i32 1>
6316
+ ; CHECK-NEXT: ret <2 x i1> [[V1]]
6317
+ ;
6318
+ %v0 = fptosi <2 x float > %arg0 to <2 x i32 >
6319
+ %v1 = icmp slt <2 x i32 > %v0 , <i32 -1 , i32 1 >
6320
+ ret <2 x i1 > %v1
6321
+ }
6322
+
6323
+
6324
+ define <2 x i1 > @float_to_int_comparing_constant_vec_negative3 (<2 x float > %arg0 ) {
6325
+ ; CHECK-LABEL: define <2 x i1> @float_to_int_comparing_constant_vec_negative3(
6326
+ ; CHECK-SAME: <2 x float> [[ARG0:%.*]]) {
6327
+ ; CHECK-NEXT: ret <2 x i1> zeroinitializer
6328
+ ;
6329
+ %v0 = fptosi <2 x float > %arg0 to <2 x i8 >
6330
+ %v1 = icmp sgt <2 x i8 > %v0 , <i8 127 , i8 127 >
6331
+ ret <2 x i1 > %v1
6332
+ }
6333
+
6334
+ define <2 x i1 > @float_to_int_comparing_constant_vec_negative4 (<2 x float > %arg0 ) {
6335
+ ; CHECK-LABEL: define <2 x i1> @float_to_int_comparing_constant_vec_negative4(
6336
+ ; CHECK-SAME: <2 x float> [[ARG0:%.*]]) {
6337
+ ; CHECK-NEXT: ret <2 x i1> zeroinitializer
6338
+ ;
6339
+ %v0 = fptosi <2 x float > %arg0 to <2 x i8 >
6340
+ %v1 = icmp slt <2 x i8 > %v0 , <i8 -128 , i8 -128 >
6341
+ ret <2 x i1 > %v1
6342
+ }
0 commit comments