[InstCombine] add negtive tests for (%x & C) == 0 -> %x u< (-C). nfc

This commit is contained in:
Chenbing Zheng 2022-07-05 16:48:49 +08:00
parent 77b13a57a9
commit 00cb1c33ee
1 changed files with 15 additions and 0 deletions

View File

@ -234,3 +234,18 @@ define i1 @scalar_i32_lshr_and_negC_eq_nonzero(i32 %x, i32 %y) {
%r = icmp eq i32 %and, 1 ; should be comparing with 0
ret i1 %r
}
; Not NegatedPowerOf2
define i1 @scalar_i8_lshr_and_negC_eq_not_negatedPowerOf2(i8 %x, i8 %y) {
; CHECK-LABEL: @scalar_i8_lshr_and_negC_eq_not_negatedPowerOf2(
; CHECK-NEXT: [[TMP1:%.*]] = shl i8 -3, [[Y:%.*]]
; CHECK-NEXT: [[TMP2:%.*]] = and i8 [[TMP1]], [[X:%.*]]
; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[TMP2]], 0
; CHECK-NEXT: ret i1 [[R]]
;
%lshr = lshr i8 %x, %y
%and = and i8 %lshr, 253 ; -3
%r = icmp eq i8 %and, 0
ret i1 %r
}