1f4a2713aSLionel Sambuc;Check AAPCS, 5.5 Parameters Passing, C4 and C5 rules.
2f4a2713aSLionel Sambuc;Check case when NSAA != 0, and NCRN < R4, NCRN+ParamSize < R4
3f4a2713aSLionel Sambuc;RUN: llc -mtriple=thumbv7-linux-gnueabihf -float-abi=hard < %s | FileCheck %s
4f4a2713aSLionel Sambuc
5f4a2713aSLionel Sambuc%st_t = type { i32, i32 }
6f4a2713aSLionel Sambuc@static_val = constant %st_t { i32 777, i32 888}
7f4a2713aSLionel Sambuc
8f4a2713aSLionel Sambucdeclare void @fooUseStruct(%st_t*)
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambucdefine void @foo(double %vfp0,     ; --> D0,     NSAA=SP
11f4a2713aSLionel Sambuc                 double %vfp1,     ; --> D1,     NSAA=SP
12f4a2713aSLionel Sambuc		 double %vfp2,     ; --> D2,     NSAA=SP
13f4a2713aSLionel Sambuc		 double %vfp3,     ; --> D3,     NSAA=SP
14f4a2713aSLionel Sambuc		 double %vfp4,     ; --> D4,     NSAA=SP
15f4a2713aSLionel Sambuc		 double %vfp5,     ; --> D5,     NSAA=SP
16f4a2713aSLionel Sambuc		 double %vfp6,     ; --> D6,     NSAA=SP
17f4a2713aSLionel Sambuc		 double %vfp7,     ; --> D7,     NSAA=SP
18f4a2713aSLionel Sambuc		 double %vfp8,     ; --> SP,     NSAA=SP+8 (!)
19f4a2713aSLionel Sambuc                 i32 %p0,          ; --> R0,     NSAA=SP+8
20f4a2713aSLionel Sambuc		 %st_t* byval %p1, ; --> R1, R2, NSAA=SP+8
21f4a2713aSLionel Sambuc		 i32 %p2,          ; --> R3,     NSAA=SP+8
22f4a2713aSLionel Sambuc                 i32 %p3) #0 {     ; --> SP+4,   NSAA=SP+12
23f4a2713aSLionel Sambucentry:
24f4a2713aSLionel Sambuc  ;CHECK: sub sp, #8
25f4a2713aSLionel Sambuc  ;CHECK: push.w {r11, lr}
26*0a6a1f1dSLionel Sambuc  ;CHECK: add r0, sp, #8
27*0a6a1f1dSLionel Sambuc  ;CHECK: str r2, [sp, #12]
28*0a6a1f1dSLionel Sambuc  ;CHECK: str r1, [sp, #8]
29f4a2713aSLionel Sambuc  ;CHECK: bl  fooUseStruct
30f4a2713aSLionel Sambuc  call void @fooUseStruct(%st_t* %p1)
31f4a2713aSLionel Sambuc  ret void
32f4a2713aSLionel Sambuc}
33f4a2713aSLionel Sambuc
34f4a2713aSLionel Sambucdefine void @doFoo() {
35f4a2713aSLionel Sambucentry:
36f4a2713aSLionel Sambuc  call void @foo(double 23.0,
37f4a2713aSLionel Sambuc                 double 23.1,
38f4a2713aSLionel Sambuc                 double 23.2,
39f4a2713aSLionel Sambuc                 double 23.3,
40f4a2713aSLionel Sambuc                 double 23.4,
41f4a2713aSLionel Sambuc                 double 23.5,
42f4a2713aSLionel Sambuc                 double 23.6,
43f4a2713aSLionel Sambuc                 double 23.7,
44f4a2713aSLionel Sambuc                 double 23.8,
45f4a2713aSLionel Sambuc                 i32 0, %st_t* byval @static_val, i32 1, i32 2)
46f4a2713aSLionel Sambuc  ret void
47f4a2713aSLionel Sambuc}
48f4a2713aSLionel Sambuc
49