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