mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-03 02:30:00 +00:00
This update was done with the following bash script: find test/CodeGen -name "*.ll" | \ while read NAME; do echo "$NAME" if ! grep -q "^; *RUN: *llc.*debug" $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 sed -i '' "s/;\(.*\)-LABEL-LABEL:/;\1-LABEL:/" $TEMP sed -i '' "s/;\(.*\)-NEXT-LABEL:/;\1-NEXT:/" $TEMP sed -i '' "s/;\(.*\)-NOT-LABEL:/;\1-NOT:/" $TEMP sed -i '' "s/;\(.*\)-DAG-LABEL:/;\1-DAG:/" $TEMP mv $TEMP $NAME fi done git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186280 91177308-0d34-0410-b5e6-96231b3b80d8
87 lines
2.0 KiB
LLVM
87 lines
2.0 KiB
LLVM
; RUN: llc < %s -mtriple=arm-apple-darwin | FileCheck %s
|
|
|
|
define i32 @f(i32 %a, i32 %b) nounwind ssp {
|
|
entry:
|
|
; CHECK-LABEL: f:
|
|
; CHECK: subs
|
|
; CHECK-NOT: cmp
|
|
%cmp = icmp sgt i32 %a, %b
|
|
%sub = sub nsw i32 %a, %b
|
|
%sub. = select i1 %cmp, i32 %sub, i32 0
|
|
ret i32 %sub.
|
|
}
|
|
|
|
define i32 @g(i32 %a, i32 %b) nounwind ssp {
|
|
entry:
|
|
; CHECK-LABEL: g:
|
|
; CHECK: subs
|
|
; CHECK-NOT: cmp
|
|
%cmp = icmp slt i32 %a, %b
|
|
%sub = sub nsw i32 %b, %a
|
|
%sub. = select i1 %cmp, i32 %sub, i32 0
|
|
ret i32 %sub.
|
|
}
|
|
|
|
define i32 @h(i32 %a, i32 %b) nounwind ssp {
|
|
entry:
|
|
; CHECK-LABEL: h:
|
|
; CHECK: subs
|
|
; CHECK-NOT: cmp
|
|
%cmp = icmp sgt i32 %a, 3
|
|
%sub = sub nsw i32 %a, 3
|
|
%sub. = select i1 %cmp, i32 %sub, i32 %b
|
|
ret i32 %sub.
|
|
}
|
|
|
|
; rdar://11725965
|
|
define i32 @i(i32 %a, i32 %b) nounwind readnone ssp {
|
|
entry:
|
|
; CHECK-LABEL: i:
|
|
; CHECK: subs
|
|
; CHECK-NOT: cmp
|
|
%cmp = icmp ult i32 %a, %b
|
|
%sub = sub i32 %b, %a
|
|
%sub. = select i1 %cmp, i32 %sub, i32 0
|
|
ret i32 %sub.
|
|
}
|
|
; If CPSR is live-out, we can't remove cmp if there exists
|
|
; a swapped sub.
|
|
define i32 @j(i32 %a, i32 %b) nounwind {
|
|
entry:
|
|
; CHECK-LABEL: j:
|
|
; CHECK: sub
|
|
; CHECK: cmp
|
|
%cmp = icmp eq i32 %b, %a
|
|
%sub = sub nsw i32 %a, %b
|
|
br i1 %cmp, label %if.then, label %if.else
|
|
|
|
if.then:
|
|
%cmp2 = icmp sgt i32 %b, %a
|
|
%sel = select i1 %cmp2, i32 %sub, i32 %a
|
|
ret i32 %sel
|
|
|
|
if.else:
|
|
ret i32 %sub
|
|
}
|
|
|
|
; If the sub/rsb instruction is predicated, we can't use the flags.
|
|
; <rdar://problem/12263428>
|
|
; Test case from MultiSource/Benchmarks/Ptrdist/bc/number.s
|
|
; CHECK: bc_raise
|
|
; CHECK: rsbeq
|
|
; CHECK: cmp
|
|
define i32 @bc_raise() nounwind ssp {
|
|
entry:
|
|
%val.2.i = select i1 undef, i32 0, i32 undef
|
|
%sub.i = sub nsw i32 0, %val.2.i
|
|
%retval.0.i = select i1 undef, i32 %val.2.i, i32 %sub.i
|
|
%cmp1 = icmp eq i32 %retval.0.i, 0
|
|
br i1 %cmp1, label %land.lhs.true, label %if.end11
|
|
|
|
land.lhs.true: ; preds = %num2long.exit
|
|
ret i32 17
|
|
|
|
if.end11: ; preds = %num2long.exit
|
|
ret i32 23
|
|
}
|