Skip to content

Commit c816f9c

Browse files
nikicakiramenai
authored andcommitted
[InstCombine] Add i128 test for select of lshr/ashr transform (NFC)
1 parent 4889b9e commit c816f9c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/test/Transforms/InstCombine/ashr-lshr.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ define i32 @ashr_lshr2(i32 %x, i32 %y) {
6161
ret i32 %ret
6262
}
6363

64+
define i128 @ashr_lshr2_i128(i128 %x, i128 %y) {
65+
; CHECK-LABEL: @ashr_lshr2_i128(
66+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i128 [[X:%.*]], 5
67+
; CHECK-NEXT: [[L:%.*]] = lshr i128 [[X]], [[Y:%.*]]
68+
; CHECK-NEXT: [[R:%.*]] = ashr exact i128 [[X]], [[Y]]
69+
; CHECK-NEXT: [[RET:%.*]] = select i1 [[CMP]], i128 [[L]], i128 [[R]]
70+
; CHECK-NEXT: ret i128 [[RET]]
71+
;
72+
%cmp = icmp sgt i128 %x, 5
73+
%l = lshr i128 %x, %y
74+
%r = ashr exact i128 %x, %y
75+
%ret = select i1 %cmp, i128 %l, i128 %r
76+
ret i128 %ret
77+
}
78+
6479
define <2 x i32> @ashr_lshr_splat_vec(<2 x i32> %x, <2 x i32> %y) {
6580
; CHECK-LABEL: @ashr_lshr_splat_vec(
6681
; CHECK-NEXT: [[CMP12:%.*]] = ashr <2 x i32> [[X:%.*]], [[Y:%.*]]

0 commit comments

Comments
 (0)