Skip to content

Commit 1f580a6

Browse files
committed
[InstComb] Pre-commit ashr-xor test
1 parent 2108c62 commit 1f580a6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

llvm/test/Transforms/InstCombine/shift-logic.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ define i32 @ashr_xor(i32 %x, i32 %py) {
186186
ret i32 %sh1
187187
}
188188

189+
189190
define i32 @shr_mismatch_xor(i32 %x, i32 %y) {
190191
; CHECK-LABEL: @shr_mismatch_xor(
191192
; CHECK-NEXT: [[SH0:%.*]] = ashr i32 [[X:%.*]], 5
@@ -225,6 +226,28 @@ define <2 x i32> @ashr_poison_poison_xor(<2 x i32> %x, <2 x i32> %y) {
225226
ret <2 x i32> %sh1
226227
}
227228

229+
define i32 @ashr_xor_operand_match(i32 %x, i32 %y) {
230+
; CHECK-LABEL: @ashr_xor_operand_match(
231+
; CHECK-NEXT: [[SH1:%.*]] = xor i32 [[TMP1:%.*]], [[TMP2:%.*]]
232+
; CHECK-NEXT: [[RET:%.*]] = ashr i32 [[SH1]], [[TMP1]]
233+
; CHECK-NEXT: ret i32 [[RET]]
234+
;
235+
%r = xor i32 %x, %y
236+
%ret = ashr i32 %r, %x
237+
ret i32 %ret
238+
}
239+
240+
define i32 @ashr_xor_operand_mismtach(i32 %x, i32 %y) {
241+
; CHECK-LABEL: @ashr_xor_operand_mismtach(
242+
; CHECK-NEXT: [[R:%.*]] = xor i32 [[X:%.*]], [[Y:%.*]]
243+
; CHECK-NEXT: [[RET:%.*]] = ashr i32 [[R]], [[Y]]
244+
; CHECK-NEXT: ret i32 [[RET]]
245+
;
246+
%r = xor i32 %x, %y
247+
%ret = ashr i32 %r, %y
248+
ret i32 %ret
249+
}
250+
228251
define i32 @lshr_or_extra_use(i32 %x, i32 %y, ptr %p) {
229252
; CHECK-LABEL: @lshr_or_extra_use(
230253
; CHECK-NEXT: [[SH0:%.*]] = lshr i32 [[X:%.*]], 5

0 commit comments

Comments
 (0)