Skip to content

Commit 2a38d83

Browse files
committed
[InstSimplify] Add pre-commits for PR#66606. NFC.
1 parent 47025af commit 2a38d83

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

llvm/test/Transforms/InstSimplify/and-or-icmp-zero.ll

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,29 @@ define i1 @and_cmps_ptr_eq_zero_with_mask_commute4(ptr %p, i64 %y) {
262262
ret i1 %r
263263
}
264264

265+
; tests from PR66606
266+
define i32 @and_zext_eq_zero(i32 %a) {
267+
; CHECK-LABEL: @and_zext_eq_zero(
268+
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[A:%.*]], 0
269+
; CHECK-NEXT: [[NOT:%.*]] = zext i1 [[COND]] to i32
270+
; CHECK-NEXT: [[R:%.*]] = and i32 [[A]], [[NOT]]
271+
; CHECK-NEXT: ret i32 [[R]]
272+
;
273+
%cond = icmp eq i32 %a, 0
274+
%not = zext i1 %cond to i32
275+
%r = and i32 %a, %not
276+
ret i32 %r
277+
}
278+
279+
define i32 @and_zext_eq_zero_commuted(i32 %a) {
280+
; CHECK-LABEL: @and_zext_eq_zero_commuted(
281+
; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[A:%.*]], 0
282+
; CHECK-NEXT: [[NOT:%.*]] = zext i1 [[COND]] to i32
283+
; CHECK-NEXT: [[R:%.*]] = and i32 [[NOT]], [[A]]
284+
; CHECK-NEXT: ret i32 [[R]]
285+
;
286+
%cond = icmp eq i32 %a, 0
287+
%not = zext i1 %cond to i32
288+
%r = and i32 %not, %a
289+
ret i32 %r
290+
}

0 commit comments

Comments
 (0)