mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
8b2b8a1835
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
267 lines
8.6 KiB
LLVM
267 lines
8.6 KiB
LLVM
; Test some of the calling convention lowering done by the MBlaze backend.
|
|
; We test that integer values are passed in the correct registers and
|
|
; returned in the correct registers. Additionally, we test that the stack
|
|
; is used as appropriate for passing arguments that cannot be placed into
|
|
; registers.
|
|
;
|
|
; RUN: llc < %s -march=mblaze | FileCheck %s
|
|
|
|
declare i32 @printf(i8*, ...)
|
|
@MSG = internal constant [13 x i8] c"Message: %d\0A\00"
|
|
|
|
define void @params0_noret() {
|
|
; CHECK-LABEL: params0_noret:
|
|
ret void
|
|
; CHECK-NOT: {{.* r3, .*, .*}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
}
|
|
|
|
define i8 @params0_8bitret() {
|
|
; CHECK-LABEL: params0_8bitret:
|
|
ret i8 1
|
|
; CHECK-NOT: {{.* r3, .*, .*}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r3, r0, 1}}
|
|
}
|
|
|
|
define i16 @params0_16bitret() {
|
|
; CHECK-LABEL: params0_16bitret:
|
|
ret i16 1
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r3, r0, 1}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
}
|
|
|
|
define i32 @params0_32bitret() {
|
|
; CHECK-LABEL: params0_32bitret:
|
|
ret i32 1
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r3, r0, 1}}
|
|
}
|
|
|
|
define i64 @params0_64bitret() {
|
|
; CHECK-LABEL: params0_64bitret:
|
|
ret i64 1
|
|
; CHECK: {{.* r3, r0, .*}}
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r4, r0, 1}}
|
|
}
|
|
|
|
define i32 @params1_32bitret(i32 %a) {
|
|
; CHECK-LABEL: params1_32bitret:
|
|
ret i32 %a
|
|
; CHECK-NOT: {{.* r3, .*, .*}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r3, r5, r0}}
|
|
}
|
|
|
|
define i32 @params2_32bitret(i32 %a, i32 %b) {
|
|
; CHECK-LABEL: params2_32bitret:
|
|
ret i32 %b
|
|
; CHECK-NOT: {{.* r3, .*, .*}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r3, r6, r0}}
|
|
}
|
|
|
|
define i32 @params3_32bitret(i32 %a, i32 %b, i32 %c) {
|
|
; CHECK-LABEL: params3_32bitret:
|
|
ret i32 %c
|
|
; CHECK-NOT: {{.* r3, .*, .*}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r3, r7, r0}}
|
|
}
|
|
|
|
define i32 @params4_32bitret(i32 %a, i32 %b, i32 %c, i32 %d) {
|
|
; CHECK-LABEL: params4_32bitret:
|
|
ret i32 %d
|
|
; CHECK-NOT: {{.* r3, .*, .*}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r3, r8, r0}}
|
|
}
|
|
|
|
define i32 @params5_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) {
|
|
; CHECK-LABEL: params5_32bitret:
|
|
ret i32 %e
|
|
; CHECK-NOT: {{.* r3, .*, .*}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r3, r9, r0}}
|
|
}
|
|
|
|
define i32 @params6_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f) {
|
|
; CHECK-LABEL: params6_32bitret:
|
|
ret i32 %f
|
|
; CHECK-NOT: {{.* r3, .*, .*}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
; CHECK: {{.* r3, r10, r0}}
|
|
}
|
|
|
|
define i32 @params7_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f,
|
|
i32 %g) {
|
|
; CHECK-LABEL: params7_32bitret:
|
|
ret i32 %g
|
|
; CHECK: {{lwi? r3, r1, 32}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
}
|
|
|
|
define i32 @params8_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f,
|
|
i32 %g, i32 %h) {
|
|
; CHECK-LABEL: params8_32bitret:
|
|
ret i32 %h
|
|
; CHECK: {{lwi? r3, r1, 36}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
}
|
|
|
|
define i32 @params9_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f,
|
|
i32 %g, i32 %h, i32 %i) {
|
|
; CHECK-LABEL: params9_32bitret:
|
|
ret i32 %i
|
|
; CHECK: {{lwi? r3, r1, 40}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
}
|
|
|
|
define i32 @params10_32bitret(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f,
|
|
i32 %g, i32 %h, i32 %i, i32 %j) {
|
|
; CHECK-LABEL: params10_32bitret:
|
|
ret i32 %j
|
|
; CHECK: {{lwi? r3, r1, 44}}
|
|
; CHECK-NOT: {{.* r4, .*, .*}}
|
|
; CHECK: rtsd
|
|
}
|
|
|
|
define void @testing() {
|
|
%MSG.1 = getelementptr [13 x i8]* @MSG, i32 0, i32 0
|
|
|
|
call void @params0_noret()
|
|
; CHECK: brlid
|
|
|
|
%tmp.1 = call i8 @params0_8bitret()
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i8 %tmp.1)
|
|
|
|
%tmp.2 = call i16 @params0_16bitret()
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i16 %tmp.2)
|
|
|
|
%tmp.3 = call i32 @params0_32bitret()
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.3)
|
|
|
|
%tmp.4 = call i64 @params0_64bitret()
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i64 %tmp.4)
|
|
|
|
%tmp.5 = call i32 @params1_32bitret(i32 1)
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.5)
|
|
|
|
%tmp.6 = call i32 @params2_32bitret(i32 1, i32 2)
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: {{.* r6, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.6)
|
|
|
|
%tmp.7 = call i32 @params3_32bitret(i32 1, i32 2, i32 3)
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: {{.* r6, .*, .*}}
|
|
; CHECK: {{.* r7, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.7)
|
|
|
|
%tmp.8 = call i32 @params4_32bitret(i32 1, i32 2, i32 3, i32 4)
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: {{.* r6, .*, .*}}
|
|
; CHECK: {{.* r7, .*, .*}}
|
|
; CHECK: {{.* r8, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.8)
|
|
|
|
%tmp.9 = call i32 @params5_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5)
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: {{.* r6, .*, .*}}
|
|
; CHECK: {{.* r7, .*, .*}}
|
|
; CHECK: {{.* r8, .*, .*}}
|
|
; CHECK: {{.* r9, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.9)
|
|
|
|
%tmp.10 = call i32 @params6_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
|
|
i32 6)
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: {{.* r6, .*, .*}}
|
|
; CHECK: {{.* r7, .*, .*}}
|
|
; CHECK: {{.* r8, .*, .*}}
|
|
; CHECK: {{.* r9, .*, .*}}
|
|
; CHECK: {{.* r10, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.10)
|
|
|
|
%tmp.11 = call i32 @params7_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
|
|
i32 6, i32 7)
|
|
; CHECK: {{swi? .*, r1, 28}}
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: {{.* r6, .*, .*}}
|
|
; CHECK: {{.* r7, .*, .*}}
|
|
; CHECK: {{.* r8, .*, .*}}
|
|
; CHECK: {{.* r9, .*, .*}}
|
|
; CHECK: {{.* r10, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.11)
|
|
|
|
%tmp.12 = call i32 @params8_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
|
|
i32 6, i32 7, i32 8)
|
|
; CHECK: {{swi? .*, r1, 32}}
|
|
; CHECK: {{swi? .*, r1, 28}}
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: {{.* r6, .*, .*}}
|
|
; CHECK: {{.* r7, .*, .*}}
|
|
; CHECK: {{.* r8, .*, .*}}
|
|
; CHECK: {{.* r9, .*, .*}}
|
|
; CHECK: {{.* r10, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.12)
|
|
|
|
%tmp.13 = call i32 @params9_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
|
|
i32 6, i32 7, i32 8, i32 9)
|
|
; CHECK: {{swi? .*, r1, 36}}
|
|
; CHECK: {{swi? .*, r1, 32}}
|
|
; CHECK: {{swi? .*, r1, 28}}
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: {{.* r6, .*, .*}}
|
|
; CHECK: {{.* r7, .*, .*}}
|
|
; CHECK: {{.* r8, .*, .*}}
|
|
; CHECK: {{.* r9, .*, .*}}
|
|
; CHECK: {{.* r10, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.13)
|
|
|
|
%tmp.14 = call i32 @params10_32bitret(i32 1, i32 2, i32 3, i32 4, i32 5,
|
|
i32 6, i32 7, i32 8, i32 9, i32 10)
|
|
; CHECK: {{swi? .*, r1, 40}}
|
|
; CHECK: {{swi? .*, r1, 36}}
|
|
; CHECK: {{swi? .*, r1, 32}}
|
|
; CHECK: {{swi? .*, r1, 28}}
|
|
; CHECK: {{.* r5, .*, .*}}
|
|
; CHECK: {{.* r6, .*, .*}}
|
|
; CHECK: {{.* r7, .*, .*}}
|
|
; CHECK: {{.* r8, .*, .*}}
|
|
; CHECK: {{.* r9, .*, .*}}
|
|
; CHECK: {{.* r10, .*, .*}}
|
|
; CHECK: brlid
|
|
call i32 (i8*,...)* @printf(i8* %MSG.1, i32 %tmp.14)
|
|
|
|
ret void
|
|
}
|