Skip to content

Commit aa5e48a

Browse files
committed
[InstCombine] Add pre-commit tests. NFC.
1 parent 05bd7d2 commit aa5e48a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

llvm/test/Transforms/InstCombine/compare-signs.ll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,23 @@ define i1 @test4a(i32 %a) {
152152
ret i1 %c
153153
}
154154

155+
define i1 @test4a_commuted(i32 %a) {
156+
; CHECK-LABEL: @test4a_commuted(
157+
; CHECK-NEXT: [[L:%.*]] = ashr i32 [[A:%.*]], 31
158+
; CHECK-NEXT: [[NA:%.*]] = sub i32 0, [[A]]
159+
; CHECK-NEXT: [[R:%.*]] = lshr i32 [[NA]], 31
160+
; CHECK-NEXT: [[SIGNUM:%.*]] = or i32 [[R]], [[L]]
161+
; CHECK-NEXT: [[C:%.*]] = icmp slt i32 [[SIGNUM]], 1
162+
; CHECK-NEXT: ret i1 [[C]]
163+
;
164+
%l = ashr i32 %a, 31
165+
%na = sub i32 0, %a
166+
%r = lshr i32 %na, 31
167+
%signum = or i32 %r, %l
168+
%c = icmp slt i32 %signum, 1
169+
ret i1 %c
170+
}
171+
155172
define <2 x i1> @test4a_vec(<2 x i32> %a) {
156173
; CHECK-LABEL: @test4a_vec(
157174
; CHECK-NEXT: [[C:%.*]] = icmp slt <2 x i32> [[A:%.*]], splat (i32 1)

0 commit comments

Comments
 (0)