xref: /llvm-project/llvm/test/CodeGen/Mips/cconv/return-float.ll (revision 8663926a544602932d299dda435ed1ef70a05f48)
1; RUN: llc -mtriple=mips-linux-gnu -mattr=+soft-float -relocation-model=static < %s | FileCheck --check-prefixes=ALL,O32 %s
2; RUN: llc -mtriple=mipsel-linux-gnu -mattr=+soft-float -relocation-model=static < %s | FileCheck --check-prefixes=ALL,O32 %s
3
4; RUN-TODO: llc -mtriple=mips64-linux-gnu -mattr=+soft-float -relocation-model=static -target-abi o32 < %s | FileCheck --check-prefixes=ALL,O32 %s
5; RUN-TODO: llc -mtriple=mips64el-linux-gnu -mattr=+soft-float -relocation-model=static -target-abi o32 < %s | FileCheck --check-prefixes=ALL,O32 %s
6
7; RUN: llc -mtriple=mips64-linux-gnu -mattr=+soft-float -relocation-model=static -target-abi n32 < %s | FileCheck --check-prefixes=ALL,N32 %s
8; RUN: llc -mtriple=mips64el-linux-gnu -mattr=+soft-float -relocation-model=static -target-abi n32 < %s | FileCheck --check-prefixes=ALL,N32 %s
9
10; RUN: llc -mtriple=mips64-linux-gnu -mattr=+soft-float -relocation-model=static -target-abi n64 < %s | FileCheck --check-prefixes=ALL,N64 %s
11; RUN: llc -mtriple=mips64el-linux-gnu -mattr=+soft-float -relocation-model=static -target-abi n64 < %s | FileCheck --check-prefixes=ALL,N64 %s
12
13; Test the float returns for all ABI's and byte orders as specified by
14; section 5 of MD00305 (MIPS ABIs Described).
15
16; We only test Linux because other OS's use different relocations and I don't
17; know if this is correct.
18
19@float = global float zeroinitializer
20@double = global double zeroinitializer
21
22define float @retfloat() nounwind {
23entry:
24        %0 = load volatile float, ptr @float
25        ret float %0
26}
27
28; ALL-LABEL: retfloat:
29; O32-DAG:           lui [[R1:\$[0-9]+]], %hi(float)
30; O32-DAG:           lw $2, %lo(float)([[R1]])
31; N32-DAG:           lui [[R1:\$[0-9]+]], %hi(float)
32; N32-DAG:           lw $2, %lo(float)([[R1]])
33; N64-DAG:           lw $2, %lo(float)([[R1:\$[0-9+]]])
34
35define double @retdouble() nounwind {
36entry:
37        %0 = load volatile double, ptr @double
38        ret double %0
39}
40
41; ALL-LABEL: retdouble:
42; O32-DAG:           lw $2, %lo(double)([[R1:\$[0-9]+]])
43; O32-DAG:           addiu [[R2:\$[0-9]+]], [[R1]], %lo(double)
44; O32-DAG:           lw $3, 4([[R2]])
45; N32-DAG:           ld $2, %lo(double)([[R1:\$[0-9]+]])
46; N64-DAG:           ld $2, %lo(double)([[R1:\$[0-9]+]])
47