@@ -3409,3 +3409,31 @@ define i1 @and_ugt_to_mask_off_by_one(i8 %x) {
3409
3409
%and2 = and i1 %cmp , %cmp2
3410
3410
ret i1 %and2
3411
3411
}
3412
+
3413
+ ; TODO: shall fold to trunc nuw i8 (and %x, %y) to i1.
3414
+ define i1 @and_icmp_ne_with_binary_range_operands (i8 range(i8 0 , 2 ) %x , i8 range(i8 0 , 2 ) %y ) {
3415
+ ; CHECK-LABEL: @and_icmp_ne_with_binary_range_operands(
3416
+ ; CHECK-NEXT: [[ICMP1:%.*]] = icmp ne i8 [[X:%.*]], 0
3417
+ ; CHECK-NEXT: [[ICMP2:%.*]] = icmp ne i8 [[Y:%.*]], 0
3418
+ ; CHECK-NEXT: [[RET:%.*]] = and i1 [[ICMP1]], [[ICMP2]]
3419
+ ; CHECK-NEXT: ret i1 [[RET]]
3420
+ ;
3421
+ %icmp1 = icmp ne i8 %x , 0
3422
+ %icmp2 = icmp ne i8 %y , 0
3423
+ %ret = and i1 %icmp1 , %icmp2
3424
+ ret i1 %ret
3425
+ }
3426
+
3427
+ ; TODO: shall fold to trunc nuw i8 (and %x, %y) to i1.
3428
+ define i1 @and_icmp_eq_with_binary_range_operands (i8 range(i8 0 , 2 ) %x , i8 range(i8 0 , 2 ) %y ) {
3429
+ ; CHECK-LABEL: @and_icmp_eq_with_binary_range_operands(
3430
+ ; CHECK-NEXT: [[ICMP1:%.*]] = icmp ne i8 [[X:%.*]], 0
3431
+ ; CHECK-NEXT: [[ICMP2:%.*]] = icmp ne i8 [[Y:%.*]], 0
3432
+ ; CHECK-NEXT: [[RET:%.*]] = and i1 [[ICMP1]], [[ICMP2]]
3433
+ ; CHECK-NEXT: ret i1 [[RET]]
3434
+ ;
3435
+ %icmp1 = icmp eq i8 %x , 1
3436
+ %icmp2 = icmp eq i8 %y , 1
3437
+ %ret = and i1 %icmp1 , %icmp2
3438
+ ret i1 %ret
3439
+ }
0 commit comments