1; RUN: llc -mtriple=arm-linux-gnueabihf < %s | FileCheck %s 2 3%struct4bytes = type { i32 } 4%struct8bytes8align = type { i64 } 5%struct12bytes = type { i32, i32, i32 } 6 7declare void @useIntPtr(%struct4bytes*) 8declare void @useLong(i64) 9declare void @usePtr(%struct8bytes8align*) 10 11; a -> r0 12; b -> r1..r3 13; c -> sp+0..sp+7 14define void @foo1(i32 %a, %struct12bytes* byval %b, i64 %c) { 15; CHECK-LABEL: foo1 16; CHECK: sub sp, sp, #12 17; CHECK: push {r11, lr} 18; CHECK: sub sp, sp, #4 19; CHECK: add [[SCRATCH:r[0-9]+]], sp, #12 20; CHECK: stm [[SCRATCH]], {r1, r2, r3} 21; CHECK: ldr r0, [sp, #24] 22; CHECK: ldr r1, [sp, #28] 23; CHECK: bl useLong 24; CHECK: pop {r11, lr} 25; CHECK: add sp, sp, #12 26 27 call void @useLong(i64 %c) 28 ret void 29} 30 31; a -> r0 32; b -> r2..r3 33define void @foo2(i32 %a, %struct8bytes8align* byval %b) { 34; CHECK-LABEL: foo2 35; CHECK: sub sp, sp, #8 36; CHECK: push {r11, lr} 37; CHECK: add r0, sp, #8 38; CHECK: str r3, [sp, #12] 39; CHECK: str r2, [sp, #8] 40; CHECK: bl usePtr 41; CHECK: pop {r11, lr} 42; CHECK: add sp, sp, #8 43 44 call void @usePtr(%struct8bytes8align* %b) 45 ret void 46} 47 48; a -> r0..r1 49; b -> r2 50define void @foo3(%struct8bytes8align* byval %a, %struct4bytes* byval %b) { 51; CHECK-LABEL: foo3 52; CHECK: sub sp, sp, #16 53; CHECK: push {r11, lr} 54; CHECK: add [[SCRATCH:r[0-9]+]], sp, #8 55; CHECK: stm [[SCRATCH]], {r0, r1, r2} 56; CHECK: add r0, sp, #8 57; CHECK: bl usePtr 58; CHECK: pop {r11, lr} 59; CHECK: add sp, sp, #16 60 61 call void @usePtr(%struct8bytes8align* %a) 62 ret void 63} 64 65; a -> r0 66; b -> r2..r3 67define void @foo4(%struct4bytes* byval %a, %struct8bytes8align* byval %b) { 68; CHECK-LABEL: foo4 69; CHECK: sub sp, sp, #16 70; CHECK: push {r11, lr} 71; CHECK: str r0, [sp, #8] 72; CHECK: add r0, sp, #16 73; CHECK: str r3, [sp, #20] 74; CHECK: str r2, [sp, #16] 75; CHECK: bl usePtr 76; CHECK: pop {r11, lr} 77; CHECK: add sp, sp, #16 78; CHECK: mov pc, lr 79 80 call void @usePtr(%struct8bytes8align* %b) 81 ret void 82} 83 84; a -> r0..r1 85; b -> r2 86; c -> r3 87define void @foo5(%struct8bytes8align* byval %a, %struct4bytes* byval %b, %struct4bytes* byval %c) { 88; CHECK-LABEL: foo5 89; CHECK: sub sp, sp, #16 90; CHECK: push {r11, lr} 91; CHECK: add [[SCRATCH:r[0-9]+]], sp, #8 92; CHECK: stm [[SCRATCH]], {r0, r1, r2, r3} 93; CHECK: add r0, sp, #8 94; CHECK: bl usePtr 95; CHECK: pop {r11, lr} 96; CHECK: add sp, sp, #16 97; CHECK: mov pc, lr 98 99 call void @usePtr(%struct8bytes8align* %a) 100 ret void 101} 102 103; a..c -> r0..r2 104; d -> sp+0..sp+7 105define void @foo6(i32 %a, i32 %b, i32 %c, %struct8bytes8align* byval %d) { 106; CHECK-LABEL: foo6 107; CHECK: push {r11, lr} 108; CHECK: add r0, sp, #8 109; CHECK: bl usePtr 110; CHECK: pop {r11, lr} 111; CHECK: mov pc, lr 112 113 call void @usePtr(%struct8bytes8align* %d) 114 ret void 115} 116