[InstCombine] Add additional test for icmp of two ranges (NFC)

This commit is contained in:
Nikita Popov 2022-04-29 11:13:50 +02:00
parent 41ac245c10
commit cf90233a67
1 changed files with 18 additions and 0 deletions

View File

@ -813,6 +813,24 @@ define <2 x i1> @test46_undef(<2 x i8> %c) {
ret <2 x i1> %or
}
; This is the variant of the above pattern where one of the ranges is
; represented with an add.
define i1 @two_ranges_to_mask_and_range_degenerate(i16 %x) {
; CHECK-LABEL: @two_ranges_to_mask_and_range_degenerate(
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i16 [[X:%.*]], 12
; CHECK-NEXT: [[TMP1:%.*]] = add i16 [[X]], -16
; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i16 [[TMP1]], 12
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[TMP2]]
; CHECK-NEXT: ret i1 [[OR]]
;
%cmp1 = icmp ult i16 %x, 12
%cmp2 = icmp uge i16 %x, 16
%cmp3 = icmp ult i16 %x, 28
%and = and i1 %cmp2, %cmp3
%or = or i1 %cmp1, %and
ret i1 %or
}
define i1 @test47(i8 signext %c) {
; CHECK-LABEL: @test47(
; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[C:%.*]], -33