mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
c90bd4a882
Summary: I had difficulty finding tests for the N32 and N64 ABI so I've added a collection of calling convention tests based on the document MIPS ABIs Described (MD00305), the MIPSpro N32 Handbook, and the SYSV ABI. Where the documents/implementations disagree, I've used GCC to resolve the conflict. A few interesting details: * For N32, LLVM uses 64-bit pointers when saving $ra despite pointers being 32-bit. I've yet to find a supporting statement in the ABI documentation but the current behaviour matches GCC. * For O32, the non-variable portion of a varargs argument list is also subject to the rule that floating-point is passed via GPR's (on N32/N64 only the variable portion is subject to this rule). This agrees with GCC's behaviour and the SYSV ABI but contradicts part of the MIPSpro N32 Handbook which talks about O32's behaviour. * The N32 implementation has the wrong callee-saved register list. (I already have a fix for this but will commit it as a follow-up). I've left RUN-TODO lines in for O32 on MIPS64. I don't plan to support this case for now but we should revisit it. Reviewers: matheusalmeida, vmedic Reviewed By: matheusalmeida Differential Revision: http://reviews.llvm.org/D3339 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206370 91177308-0d34-0410-b5e6-96231b3b80d8
52 lines
2.4 KiB
LLVM
52 lines
2.4 KiB
LLVM
; RUN: llc -march=mips64 -relocation-model=static -soft-float -mattr=-n64,+n32 < %s | FileCheck --check-prefix=ALL --check-prefix=SYM32 %s
|
|
; RUN: llc -march=mips64el -relocation-model=static -soft-float -mattr=-n64,+n32 < %s | FileCheck --check-prefix=ALL --check-prefix=SYM32 %s
|
|
|
|
; RUN: llc -march=mips64 -relocation-model=static -soft-float -mattr=-n64,+n64 < %s | FileCheck --check-prefix=ALL --check-prefix=SYM64 %s
|
|
; RUN: llc -march=mips64el -relocation-model=static -soft-float -mattr=-n64,+n64 < %s | FileCheck --check-prefix=ALL --check-prefix=SYM64 %s
|
|
|
|
; Test the fp128 arguments for all ABI's and byte orders as specified
|
|
; by section 2 of the MIPSpro N32 Handbook.
|
|
;
|
|
; O32 is not tested because long double is the same as double on O32.
|
|
|
|
@ldoubles = global [11 x fp128] zeroinitializer
|
|
|
|
define void @ldouble_args(fp128 %a, fp128 %b, fp128 %c, fp128 %d, fp128 %e) nounwind {
|
|
entry:
|
|
%0 = getelementptr [11 x fp128]* @ldoubles, i32 0, i32 1
|
|
store volatile fp128 %a, fp128* %0
|
|
%1 = getelementptr [11 x fp128]* @ldoubles, i32 0, i32 2
|
|
store volatile fp128 %b, fp128* %1
|
|
%2 = getelementptr [11 x fp128]* @ldoubles, i32 0, i32 3
|
|
store volatile fp128 %c, fp128* %2
|
|
%3 = getelementptr [11 x fp128]* @ldoubles, i32 0, i32 4
|
|
store volatile fp128 %d, fp128* %3
|
|
%4 = getelementptr [11 x fp128]* @ldoubles, i32 0, i32 5
|
|
store volatile fp128 %e, fp128* %4
|
|
ret void
|
|
}
|
|
|
|
; ALL-LABEL: ldouble_args:
|
|
; We won't test the way the global address is calculated in this test. This is
|
|
; just to get the register number for the other checks.
|
|
; SYM32-DAG: addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(ldoubles)
|
|
; SYM64-DAG: ld [[R2:\$[0-9]]], %got_disp(ldoubles)(
|
|
|
|
; The first four arguments are the same in N32/N64.
|
|
; The first argument is floating point but soft-float is enabled so floating
|
|
; point registers are not used.
|
|
; ALL-DAG: sd $4, 16([[R2]])
|
|
; ALL-DAG: sd $5, 24([[R2]])
|
|
; ALL-DAG: sd $6, 32([[R2]])
|
|
; ALL-DAG: sd $7, 40([[R2]])
|
|
; ALL-DAG: sd $8, 48([[R2]])
|
|
; ALL-DAG: sd $9, 56([[R2]])
|
|
; ALL-DAG: sd $10, 64([[R2]])
|
|
; ALL-DAG: sd $11, 72([[R2]])
|
|
|
|
; N32/N64 have run out of registers and starts using the stack too
|
|
; ALL-DAG: ld [[R3:\$[0-9]+]], 0($sp)
|
|
; ALL-DAG: ld [[R4:\$[0-9]+]], 8($sp)
|
|
; ALL-DAG: sd [[R3]], 80([[R2]])
|
|
; ALL-DAG: sd [[R4]], 88([[R2]])
|