Skip to content

Commit feed257

Browse files
committed
[InstCombine] Add pre-commit tests. NFC.
1 parent 31bd82c commit feed257

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

llvm/test/Transforms/InstCombine/sign-test-and-or.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,29 @@ define i1 @test9_logical(i32 %a) {
349349
ret i1 %or.cond
350350
}
351351

352+
define i1 @test9_logical_samesign(i32 %a) {
353+
; CHECK-LABEL: @test9_logical_samesign(
354+
; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign sgt i32 [[A:%.*]], -1
355+
; CHECK-NEXT: ret i1 [[CMP2]]
356+
;
357+
%masked = and i32 %a, -1073741825
358+
%cmp1 = icmp eq i32 %masked, 0
359+
%cmp2 = icmp samesign sgt i32 %a, -1
360+
%or.cond = select i1 %cmp1, i1 true, i1 %cmp2
361+
ret i1 %or.cond
362+
}
363+
364+
define i1 @test_logical_or_icmp_icmp_samesign(i32 %a) {
365+
; CHECK-LABEL: @test_logical_or_icmp_icmp_samesign(
366+
; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign sgt i32 [[A:%.*]], -1
367+
; CHECK-NEXT: ret i1 [[CMP2]]
368+
;
369+
%cmp1 = icmp eq i32 %a, 0
370+
%cmp2 = icmp samesign sgt i32 %a, -1
371+
%or = select i1 %cmp1, i1 true, i1 %cmp2
372+
ret i1 %or
373+
}
374+
352375
define i1 @test10(i32 %a) {
353376
; CHECK-LABEL: @test10(
354377
; CHECK-NEXT: [[OR_COND:%.*]] = icmp ult i32 [[A:%.*]], 2

0 commit comments

Comments
 (0)