mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-01 04:29:57 +00:00
This update was done with the following bash script: find test/Transforms -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc" $NAME; then TEMP=`mktemp -t temp` cp $NAME $TEMP sed -n "s/^define [^@]*@\([A-Za-z0-9_]*\)(.*$/\1/p" < $NAME | \ while read FUNC; do sed -i '' "s/;\(.*\)\([A-Za-z0-9_]*\):\( *\)@$FUNC\([( ]*\)\$/;\1\2-LABEL:\3@$FUNC(/g" $TEMP done mv $TEMP $NAME fi done git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186268 91177308-0d34-0410-b5e6-96231b3b80d8
180 lines
3.6 KiB
LLVM
180 lines
3.6 KiB
LLVM
; RUN: opt -S -instcombine < %s | FileCheck %s
|
|
|
|
declare void @foo()
|
|
|
|
define void @test1(i32 %a, i32 %b) nounwind {
|
|
%1 = icmp slt i32 %a, 0
|
|
%2 = icmp slt i32 %b, 0
|
|
%or.cond = or i1 %1, %2
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
; CHECK-LABEL: @test1(
|
|
; CHECK-NEXT: %1 = or i32 %a, %b
|
|
; CHECK-NEXT: %2 = icmp slt i32 %1, 0
|
|
; CHECK-NEXT: br
|
|
|
|
if.then:
|
|
tail call void @foo() nounwind
|
|
ret void
|
|
|
|
if.end:
|
|
ret void
|
|
}
|
|
|
|
define void @test2(i32 %a, i32 %b) nounwind {
|
|
%1 = icmp sgt i32 %a, -1
|
|
%2 = icmp sgt i32 %b, -1
|
|
%or.cond = or i1 %1, %2
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
; CHECK-LABEL: @test2(
|
|
; CHECK-NEXT: %1 = and i32 %a, %b
|
|
; CHECK-NEXT: %2 = icmp sgt i32 %1, -1
|
|
; CHECK-NEXT: br
|
|
|
|
if.then:
|
|
tail call void @foo() nounwind
|
|
ret void
|
|
|
|
if.end:
|
|
ret void
|
|
}
|
|
|
|
define void @test3(i32 %a, i32 %b) nounwind {
|
|
%1 = icmp slt i32 %a, 0
|
|
%2 = icmp slt i32 %b, 0
|
|
%or.cond = and i1 %1, %2
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
; CHECK-LABEL: @test3(
|
|
; CHECK-NEXT: %1 = and i32 %a, %b
|
|
; CHECK-NEXT: %2 = icmp slt i32 %1, 0
|
|
; CHECK-NEXT: br
|
|
|
|
if.then:
|
|
tail call void @foo() nounwind
|
|
ret void
|
|
|
|
if.end:
|
|
ret void
|
|
}
|
|
|
|
define void @test4(i32 %a, i32 %b) nounwind {
|
|
%1 = icmp sgt i32 %a, -1
|
|
%2 = icmp sgt i32 %b, -1
|
|
%or.cond = and i1 %1, %2
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
; CHECK-LABEL: @test4(
|
|
; CHECK-NEXT: %1 = or i32 %a, %b
|
|
; CHECK-NEXT: %2 = icmp sgt i32 %1, -1
|
|
; CHECK-NEXT: br
|
|
|
|
if.then:
|
|
tail call void @foo() nounwind
|
|
ret void
|
|
|
|
if.end:
|
|
ret void
|
|
}
|
|
|
|
define void @test5(i32 %a) nounwind {
|
|
%and = and i32 %a, 134217728
|
|
%1 = icmp eq i32 %and, 0
|
|
%2 = icmp sgt i32 %a, -1
|
|
%or.cond = and i1 %1, %2
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
; CHECK-LABEL: @test5(
|
|
; CHECK-NEXT: %1 = and i32 %a, -2013265920
|
|
; CHECK-NEXT: %2 = icmp eq i32 %1, 0
|
|
; CHECK-NEXT: br i1 %2, label %if.then, label %if.end
|
|
|
|
if.then:
|
|
tail call void @foo() nounwind
|
|
ret void
|
|
|
|
if.end:
|
|
ret void
|
|
}
|
|
|
|
define void @test6(i32 %a) nounwind {
|
|
%1 = icmp sgt i32 %a, -1
|
|
%and = and i32 %a, 134217728
|
|
%2 = icmp eq i32 %and, 0
|
|
%or.cond = and i1 %1, %2
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
; CHECK-LABEL: @test6(
|
|
; CHECK-NEXT: %1 = and i32 %a, -2013265920
|
|
; CHECK-NEXT: %2 = icmp eq i32 %1, 0
|
|
; CHECK-NEXT: br i1 %2, label %if.then, label %if.end
|
|
|
|
if.then:
|
|
tail call void @foo() nounwind
|
|
ret void
|
|
|
|
if.end:
|
|
ret void
|
|
}
|
|
|
|
define void @test7(i32 %a) nounwind {
|
|
%and = and i32 %a, 134217728
|
|
%1 = icmp ne i32 %and, 0
|
|
%2 = icmp slt i32 %a, 0
|
|
%or.cond = or i1 %1, %2
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
; CHECK-LABEL: @test7(
|
|
; CHECK-NEXT: %1 = and i32 %a, -2013265920
|
|
; CHECK-NEXT: %2 = icmp eq i32 %1, 0
|
|
; CHECK-NEXT: br i1 %2, label %if.end, label %if.the
|
|
|
|
if.then:
|
|
tail call void @foo() nounwind
|
|
ret void
|
|
|
|
if.end:
|
|
ret void
|
|
}
|
|
|
|
define void @test8(i32 %a) nounwind {
|
|
%1 = icmp slt i32 %a, 0
|
|
%and = and i32 %a, 134217728
|
|
%2 = icmp ne i32 %and, 0
|
|
%or.cond = or i1 %1, %2
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
; CHECK-LABEL: @test8(
|
|
; CHECK-NEXT: %1 = and i32 %a, -2013265920
|
|
; CHECK-NEXT: %2 = icmp eq i32 %1, 0
|
|
; CHECK-NEXT: br i1 %2, label %if.end, label %if.the
|
|
|
|
if.then:
|
|
tail call void @foo() nounwind
|
|
ret void
|
|
|
|
if.end:
|
|
ret void
|
|
}
|
|
|
|
define void @test9(i32 %a) nounwind {
|
|
%1 = and i32 %a, 1073741824
|
|
%2 = icmp ne i32 %1, 0
|
|
%3 = icmp sgt i32 %a, -1
|
|
%or.cond = and i1 %2, %3
|
|
br i1 %or.cond, label %if.then, label %if.end
|
|
|
|
; CHECK-LABEL: @test9(
|
|
; CHECK-NEXT: %1 = and i32 %a, -1073741824
|
|
; CHECK-NEXT: %2 = icmp eq i32 %1, 1073741824
|
|
; CHECK-NEXT: br i1 %2, label %if.then, label %if.end
|
|
|
|
if.then:
|
|
tail call void @foo() nounwind
|
|
ret void
|
|
|
|
if.end:
|
|
ret void
|
|
}
|