4b0327bde37264af8462a5ae0ceca798b80f7541
[oota-llvm.git] / test / CodeGen / Mips / cconv / return-float.ll
1 ; RUN: llc -march=mips -soft-float -relocation-model=static < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s
2 ; RUN: llc -march=mipsel -soft-float -relocation-model=static < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s
3
4 ; RUN-TODO: llc -march=mips64 -soft-float -relocation-model=static -mattr=-n64,+o32 < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s
5 ; RUN-TODO: llc -march=mips64el -soft-float -relocation-model=static -mattr=-n64,+o32 < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s
6
7 ; RUN: llc -march=mips64 -soft-float -relocation-model=static -mattr=-n64,+n32 < %s | FileCheck --check-prefix=ALL --check-prefix=N32 %s
8 ; RUN: llc -march=mips64el -soft-float -relocation-model=static -mattr=-n64,+n32 < %s | FileCheck --check-prefix=ALL --check-prefix=N32 %s
9
10 ; RUN: llc -march=mips64 -soft-float -relocation-model=static -mattr=-n64,+n64 < %s | FileCheck --check-prefix=ALL --check-prefix=N64 %s
11 ; RUN: llc -march=mips64el -soft-float -relocation-model=static -mattr=-n64,+n64 < %s | FileCheck --check-prefix=ALL --check-prefix=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 @float = global float zeroinitializer
17 @double = global double zeroinitializer
18
19 define float @retfloat() nounwind {
20 entry:
21         %0 = load volatile float* @float
22         ret float %0
23 }
24
25 ; ALL-LABEL: retfloat:
26 ; O32-DAG:           lui [[R1:\$[0-9]+]], %hi(float)
27 ; O32-DAG:           lw $2, %lo(float)([[R1]])
28 ; N32-DAG:           lui [[R1:\$[0-9]+]], %hi(float)
29 ; N32-DAG:           lw $2, %lo(float)([[R1]])
30 ; N64-DAG:           ld  [[R1:\$[0-9]+]], %got_disp(float)($1)
31 ; N64-DAG:           lw $2, 0([[R1]])
32
33 define double @retdouble() nounwind {
34 entry:
35         %0 = load volatile double* @double
36         ret double %0
37 }
38
39 ; ALL-LABEL: retdouble:
40 ; O32-DAG:           lw $2, %lo(double)([[R1:\$[0-9]+]])
41 ; O32-DAG:           addiu [[R2:\$[0-9]+]], [[R1]], %lo(double)
42 ; O32-DAG:           lw $3, 4([[R2]])
43 ; N32-DAG:           ld $2, %lo(double)([[R1:\$[0-9]+]])
44 ; N64-DAG:           ld  [[R1:\$[0-9]+]], %got_disp(double)($1)
45 ; N64-DAG:           ld $2, 0([[R1]])