[InstSimplify] Add pre-commits for PR#66606. NFC.

This commit is contained in:
Yingwei Zheng 2023-09-19 00:59:52 +08:00
parent 47025af639
commit 2a38d83918
No known key found for this signature in database
GPG Key ID: C05527F42C59664F

View File

@ -262,3 +262,29 @@ define i1 @and_cmps_ptr_eq_zero_with_mask_commute4(ptr %p, i64 %y) {
ret i1 %r
}
; tests from PR66606
define i32 @and_zext_eq_zero(i32 %a) {
; CHECK-LABEL: @and_zext_eq_zero(
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[A:%.*]], 0
; CHECK-NEXT: [[NOT:%.*]] = zext i1 [[COND]] to i32
; CHECK-NEXT: [[R:%.*]] = and i32 [[A]], [[NOT]]
; CHECK-NEXT: ret i32 [[R]]
;
%cond = icmp eq i32 %a, 0
%not = zext i1 %cond to i32
%r = and i32 %a, %not
ret i32 %r
}
define i32 @and_zext_eq_zero_commuted(i32 %a) {
; CHECK-LABEL: @and_zext_eq_zero_commuted(
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[A:%.*]], 0
; CHECK-NEXT: [[NOT:%.*]] = zext i1 [[COND]] to i32
; CHECK-NEXT: [[R:%.*]] = and i32 [[NOT]], [[A]]
; CHECK-NEXT: ret i32 [[R]]
;
%cond = icmp eq i32 %a, 0
%not = zext i1 %cond to i32
%r = and i32 %not, %a
ret i32 %r
}