blob: 5545dfdcd4c89c5a79f2f98e3b6aa55047c65586 [file] [log] [blame]
Tim Northover4f1909f2014-05-27 10:43:38 +00001; RUN: llc < %s -mtriple=armv7-linux-gnueabihf -o - | FileCheck %s
2; RUN: llc < %s -mtriple=thumbv7em-none-eabi -mcpu=cortex-m4 | FileCheck %s --check-prefix=CHECK-M4F
3
4target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
5
6define arm_aapcs_vfpcc void @test_1float({ float } %a) {
7 call arm_aapcs_vfpcc void @test_1float({ float } { float 1.0 })
8 ret void
9
10; CHECK-LABEL: test_1float:
11; CHECK-DAG: vmov.f32 s0, #1.{{0+}}e+00
12; CHECK: bl test_1float
13
14; CHECK-M4F-LABEL: test_1float:
15; CHECK-M4F-DAG: vmov.f32 s0, #1.{{0+}}e+00
16; CHECK-M4F: bl test_1float
17}
18
19define arm_aapcs_vfpcc void @test_2float({ float, float } %a) {
20 call arm_aapcs_vfpcc void @test_2float({ float, float } { float 1.0, float 2.0 })
21 ret void
22
23; CHECK-LABEL: test_2float:
24; CHECK-DAG: vmov.f32 s0, #1.{{0+}}e+00
25; CHECK-DAG: vmov.f32 s1, #2.{{0+}}e+00
26; CHECK: bl test_2float
27
28; CHECK-M4F-LABEL: test_2float:
29; CHECK-M4F-DAG: vmov.f32 s0, #1.{{0+}}e+00
30; CHECK-M4F-DAG: vmov.f32 s1, #2.{{0+}}e+00
31; CHECK-M4F: bl test_2float
32}
33
34define arm_aapcs_vfpcc void @test_3float({ float, float, float } %a) {
35 call arm_aapcs_vfpcc void @test_3float({ float, float, float } { float 1.0, float 2.0, float 3.0 })
36 ret void
37
38; CHECK-LABEL: test_3float:
39; CHECK-DAG: vmov.f32 s0, #1.{{0+}}e+00
40; CHECK-DAG: vmov.f32 s1, #2.{{0+}}e+00
41; CHECK-DAG: vmov.f32 s2, #3.{{0+}}e+00
42; CHECK: bl test_3float
43
44; CHECK-M4F-LABEL: test_3float:
45; CHECK-M4F-DAG: vmov.f32 s0, #1.{{0+}}e+00
46; CHECK-M4F-DAG: vmov.f32 s1, #2.{{0+}}e+00
47; CHECK-M4F-DAG: vmov.f32 s2, #3.{{0+}}e+00
48; CHECK-M4F: bl test_3float
49}
50
51define arm_aapcs_vfpcc void @test_1double({ double } %a) {
52; CHECK-LABEL: test_1double:
53; CHECK-DAG: vmov.f64 d0, #1.{{0+}}e+00
54; CHECK: bl test_1double
55
56; CHECK-M4F-LABEL: test_1double:
Oliver Stannard51b1d462014-08-21 12:50:31 +000057; CHECK-M4F: vldr d0, [[CP_LABEL:.*]]
Tim Northover4f1909f2014-05-27 10:43:38 +000058; CHECK-M4F: bl test_1double
Oliver Stannard51b1d462014-08-21 12:50:31 +000059; CHECK-M4F: [[CP_LABEL]]
60; CHECK-M4F-NEXT: .long 0
61; CHECK-M4F-NEXT: .long 1072693248
Tim Northover4f1909f2014-05-27 10:43:38 +000062
63 call arm_aapcs_vfpcc void @test_1double({ double } { double 1.0 })
64 ret void
65}
66
67; Final double argument might be put in s15 & [sp] if we're careless. It should
68; go all on the stack.
69define arm_aapcs_vfpcc void @test_1double_nosplit([4 x float], [4 x double], [3 x float], double %a) {
70; CHECK-LABEL: test_1double_nosplit:
71; CHECK-DAG: mov [[ONELO:r[0-9]+]], #0
72; CHECK-DAG: movw [[ONEHI:r[0-9]+]], #0
73; CHECK-DAG: movt [[ONEHI]], #16368
74; CHECK: strd [[ONELO]], [[ONEHI]], [sp]
75; CHECK: bl test_1double_nosplit
76
77; CHECK-M4F-LABEL: test_1double_nosplit:
Tim Northover4f1909f2014-05-27 10:43:38 +000078; CHECK-M4F: movs [[ONEHI:r[0-9]+]], #0
Oliver Stannard51b1d462014-08-21 12:50:31 +000079; CHECK-M4F: movs [[ONELO:r[0-9]+]], #0
Tim Northover4f1909f2014-05-27 10:43:38 +000080; CHECK-M4F: movt [[ONEHI]], #16368
Oliver Stannard51b1d462014-08-21 12:50:31 +000081; CHECK-M4F: strd [[ONELO]], [[ONEHI]], [sp]
Tim Northover4f1909f2014-05-27 10:43:38 +000082; CHECK-M4F: bl test_1double_nosplit
83 call arm_aapcs_vfpcc void @test_1double_nosplit([4 x float] undef, [4 x double] undef, [3 x float] undef, double 1.0)
84 ret void
85}
86
87; Final double argument might go at [sp, #4] if we're careless. Should go at
88; [sp, #8] to preserve alignment.
89define arm_aapcs_vfpcc void @test_1double_misaligned([4 x double], [4 x double], float, double) {
90 call arm_aapcs_vfpcc void @test_1double_misaligned([4 x double] undef, [4 x double] undef, float undef, double 1.0)
91
92; CHECK-LABEL: test_1double_misaligned:
Tim Northover4f1909f2014-05-27 10:43:38 +000093; CHECK-DAG: movw [[ONEHI:r[0-9]+]], #0
Chandler Carruth9f4530b2014-07-24 22:15:28 +000094; CHECK-DAG: mov [[ONELO:r[0-9]+]], #0
Tim Northover4f1909f2014-05-27 10:43:38 +000095; CHECK-DAG: movt [[ONEHI]], #16368
Chandler Carruth9f4530b2014-07-24 22:15:28 +000096; CHECK-DAG: strd [[ONELO]], [[ONEHI]], [sp, #8]
Tim Northover4f1909f2014-05-27 10:43:38 +000097
98; CHECK-M4F-LABEL: test_1double_misaligned:
Tim Northover4f1909f2014-05-27 10:43:38 +000099; CHECK-M4F: movs [[ONEHI:r[0-9]+]], #0
Oliver Stannard51b1d462014-08-21 12:50:31 +0000100; CHECK-M4F: movs [[ONELO:r[0-9]+]], #0
Tim Northover4f1909f2014-05-27 10:43:38 +0000101; CHECK-M4F: movt [[ONEHI]], #16368
Oliver Stannard51b1d462014-08-21 12:50:31 +0000102; CHECK-M4F: strd [[ONELO]], [[ONEHI]], [sp, #8]
Tim Northover4f1909f2014-05-27 10:43:38 +0000103; CHECK-M4F: bl test_1double_misaligned
104
105 ret void
106}