1; RUN: llc -march=mips < %s | FileCheck --check-prefixes=ALL,O32 %s
2; RUN: llc -march=mipsel < %s | FileCheck --check-prefixes=ALL,O32 %s
3
4; RUN-TODO: llc -march=mips64 -target-abi o32 < %s | FileCheck --check-prefixes=ALL,O32 %s
5; RUN-TODO: llc -march=mips64el -target-abi o32 < %s | FileCheck --check-prefixes=ALL,O32 %s
6
7; RUN: llc -march=mips64 -target-abi n32 < %s | FileCheck --check-prefixes=ALL,N32 %s
8; RUN: llc -march=mips64el -target-abi n32 < %s | FileCheck --check-prefixes=ALL,N32 %s
9
10; RUN: llc -march=mips64 -target-abi n64 < %s | FileCheck --check-prefixes=ALL,N64 %s
11; RUN: llc -march=mips64el -target-abi n64 < %s | FileCheck --check-prefixes=ALL,N64 %s
12
13; Test that O32 correctly reserved space for the four arguments, even when
14; there aren't any as per section 5 of MD00305 (MIPS ABIs Described).
15
16declare void @foo() nounwind;
17
18define void @reserved_space() nounwind {
19entry:
20        call void @foo()
21        ret void
22}
23
24; ALL-LABEL: reserved_space:
25; O32:           addiu $sp, $sp, -24
26; O32:           sw $ra, 20($sp)
27; O32:           lw $ra, 20($sp)
28; O32:           addiu $sp, $sp, 24
29; Despite pointers being 32-bit wide on N32, the return pointer is saved as a
30; 64-bit pointer. I've yet to find a documentation reference for this quirk but
31; this behaviour matches GCC so I have considered it to be correct.
32; N32:           addiu $sp, $sp, -16
33; N32:           sd $ra, 8($sp)
34; N32:           ld $ra, 8($sp)
35; N32:           addiu $sp, $sp, 16
36; N64:           daddiu $sp, $sp, -16
37; N64:           sd $ra, 8($sp)
38; N64:           ld $ra, 8($sp)
39; N64:           daddiu $sp, $sp, 16
40