[InstCombine] Add pre-commit tests for PR66733. NFC.

This commit is contained in:
Yingwei Zheng
2023-09-21 16:21:53 +08:00
parent 3d51b40c4a
commit 1a73a6b80b

View File

@@ -2539,3 +2539,21 @@ define i32 @and_zext_eq_odd_commuted(i32 %a) {
%r = and i32 %not, %a
ret i32 %r
}
; Tests from PR66733
define i32 @and_zext_eq_zero(i32 %A, i32 %C) {
; CHECK-LABEL: @and_zext_eq_zero(
; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[A:%.*]], 0
; CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP1]] to i32
; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[A]], [[C:%.*]]
; CHECK-NEXT: [[TMP4:%.*]] = xor i32 [[TMP3]], -1
; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP2]], [[TMP4]]
; CHECK-NEXT: ret i32 [[TMP5]]
;
%1 = icmp eq i32 %A, 0
%2 = zext i1 %1 to i32
%3 = lshr i32 %A, %C
%4 = xor i32 %3, -1
%5 = and i32 %2, %4
ret i32 %5
}