Skip to content

Commit cf90233

Browse files
committed
[InstCombine] Add additional test for icmp of two ranges (NFC)
1 parent 41ac245 commit cf90233

File tree

1 file changed

+18
-0
lines changed
  • llvm/test/Transforms/InstCombine

1 file changed

+18
-0
lines changed

llvm/test/Transforms/InstCombine/or.ll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,24 @@ define <2 x i1> @test46_undef(<2 x i8> %c) {
813813
ret <2 x i1> %or
814814
}
815815

816+
; This is the variant of the above pattern where one of the ranges is
817+
; represented with an add.
818+
define i1 @two_ranges_to_mask_and_range_degenerate(i16 %x) {
819+
; CHECK-LABEL: @two_ranges_to_mask_and_range_degenerate(
820+
; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i16 [[X:%.*]], 12
821+
; CHECK-NEXT: [[TMP1:%.*]] = add i16 [[X]], -16
822+
; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i16 [[TMP1]], 12
823+
; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[TMP2]]
824+
; CHECK-NEXT: ret i1 [[OR]]
825+
;
826+
%cmp1 = icmp ult i16 %x, 12
827+
%cmp2 = icmp uge i16 %x, 16
828+
%cmp3 = icmp ult i16 %x, 28
829+
%and = and i1 %cmp2, %cmp3
830+
%or = or i1 %cmp1, %and
831+
ret i1 %or
832+
}
833+
816834
define i1 @test47(i8 signext %c) {
817835
; CHECK-LABEL: @test47(
818836
; CHECK-NEXT: [[TMP1:%.*]] = and i8 [[C:%.*]], -33

0 commit comments

Comments
 (0)