[InstCombine] Add additional test with signed range check (NFC)

This commit is contained in:
Nikita Popov 2021-11-10 17:57:14 +01:00
parent fcf2ae9923
commit fb1a203e45
1 changed files with 17 additions and 0 deletions

View File

@ -1187,3 +1187,20 @@ define i1 @and_ranges_no_overlap(i8 %x) {
%c7 = and i1 %c3, %c6 %c7 = and i1 %c3, %c6
ret i1 %c7 ret i1 %c7
} }
define i1 @and_ranges_signed_pred(i64 %x) {
; CHECK-LABEL: @and_ranges_signed_pred(
; CHECK-NEXT: [[T1:%.*]] = add i64 [[X:%.*]], 127
; CHECK-NEXT: [[T2:%.*]] = icmp slt i64 [[T1]], 1024
; CHECK-NEXT: [[T3:%.*]] = add i64 [[X]], 128
; CHECK-NEXT: [[T4:%.*]] = icmp slt i64 [[T3]], 256
; CHECK-NEXT: [[T5:%.*]] = and i1 [[T2]], [[T4]]
; CHECK-NEXT: ret i1 [[T5]]
;
%t1 = add i64 %x, 127
%t2 = icmp slt i64 %t1, 1024
%t3 = add i64 %x, 128
%t4 = icmp slt i64 %t3, 256
%t5 = and i1 %t2, %t4
ret i1 %t5
}