xref: /llvm-project/llvm/test/CodeGen/Mips/cconv/return-hard-float.ll (revision 8663926a544602932d299dda435ed1ef70a05f48)
1; RUN: llc -mtriple=mips-linux-gnu -relocation-model=static < %s \
2; RUN:   | FileCheck --check-prefixes=ALL,O32 %s
3; RUN: llc -mtriple=mipsel-linux-gnu -relocation-model=static < %s \
4; RUN:   | FileCheck --check-prefixes=ALL,O32 %s
5
6; RUN-TODO: llc -mtriple=mips64-linux-gnu -relocation-model=static -target-abi o32 < %s \
7; RUN-TODO:   | FileCheck --check-prefixes=ALL,O32 %s
8; RUN-TODO: llc -mtriple=mips64el-linux-gnu -relocation-model=static -target-abi o32 < %s \
9; RUN-TODO:   | FileCheck --check-prefixes=ALL,O32 %s
10
11; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=static -target-abi n32 < %s \
12; RUN:   | FileCheck --check-prefixes=ALL,N32 %s
13; RUN: llc -mtriple=mips64el-linux-gnu -relocation-model=static -target-abi n32 < %s \
14; RUN:   | FileCheck --check-prefixes=ALL,N32 %s
15
16; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=static -target-abi n64 < %s \
17; RUN:   | FileCheck --check-prefixes=ALL,N64 %s
18; RUN: llc -mtriple=mips64el-linux-gnu -relocation-model=static -target-abi n64 < %s \
19; RUN:   | FileCheck --check-prefixes=ALL,N64 %s
20
21; RUN: llc -mtriple=mips-linux-gnu -relocation-model=static -mattr=+o32,+fp64,+mips32r2 < %s \
22; RUN:   | FileCheck --check-prefixes=ALL,032FP64 %s
23; RUN: llc -mtriple=mipsel-linux-gnu -relocation-model=static -mattr=+o32,+fp64,+mips32r2 < %s \
24; RUN:   | FileCheck --check-prefixes=ALL,032FP64 %s
25
26; Test the float returns for all ABI's and byte orders as specified by
27; section 5 of MD00305 (MIPS ABIs Described).
28
29; We only test Linux because other OS's use different relocations and I don't
30; know if this is correct.
31
32@float = global float zeroinitializer
33@double = global double zeroinitializer
34
35define float @retfloat() nounwind {
36entry:
37        %0 = load volatile float, ptr @float
38        ret float %0
39}
40
41; ALL-LABEL: retfloat:
42; O32-DAG:           lui [[R1:\$[0-9]+]], %hi(float)
43; O32-DAG:           lwc1 $f0, %lo(float)([[R1]])
44; N32-DAG:           lui [[R1:\$[0-9]+]], %hi(float)
45; N32-DAG:           lwc1 $f0, %lo(float)([[R1]])
46; N64-DAG:           lwc1 $f0, %lo(float)([[R1:\$[0-9+]]])
47
48define double @retdouble() nounwind {
49entry:
50        %0 = load volatile double, ptr @double
51        ret double %0
52}
53
54; ALL-LABEL: retdouble:
55; O32-DAG:           ldc1 $f0, %lo(double)([[R1:\$[0-9]+]])
56; N32-DAG:           ldc1 $f0, %lo(double)([[R1:\$[0-9]+]])
57; N64-DAG:           ldc1 $f0, %lo(double)([[R1:\$[0-9]+]])
58
59define { double, double } @retComplexDouble() #0 {
60  %retval = alloca { double, double }, align 8
61  %1 = load { double, double }, ptr %retval
62  ret { double, double } %1
63}
64
65; ALL-LABEL: retComplexDouble:
66; 032FP64-DAG:      ldc1     $f0, 0($sp)
67; 032FP64-DAG:      ldc1     $f2, 8($sp)
68