1 ; RUN: llc < %s -mtriple=armv7-apple-ios6.0 | FileCheck %s
4 %struct.SmallStruct = type { i32, [8 x i32], [37 x i8] }
5 %struct.LargeStruct = type { i32, [1001 x i8], [300 x i32] }
7 define i32 @f() nounwind ssp {
13 %st = alloca %struct.SmallStruct, align 4
14 %call = call i32 @e1(%struct.SmallStruct* byval %st)
18 ; Generate a loop for large struct byval
19 define i32 @g() nounwind ssp {
26 %st = alloca %struct.LargeStruct, align 4
27 %call = call i32 @e2(%struct.LargeStruct* byval %st)
31 ; Generate a loop using NEON instructions
32 define i32 @h() nounwind ssp {
39 %st = alloca %struct.LargeStruct, align 16
40 %call = call i32 @e3(%struct.LargeStruct* byval align 16 %st)
44 declare i32 @e1(%struct.SmallStruct* nocapture byval %in) nounwind
45 declare i32 @e2(%struct.LargeStruct* nocapture byval %in) nounwind
46 declare i32 @e3(%struct.LargeStruct* nocapture byval align 16 %in) nounwind
49 ; We can't do tail call since address of s is passed to the callee and part of
50 ; s is in caller's local frame.
51 define void @f3(%struct.SmallStruct* nocapture byval %s) nounwind optsize {
53 ; CHECK: bl _consumestruct
55 %0 = bitcast %struct.SmallStruct* %s to i8*
56 tail call void @consumestruct(i8* %0, i32 80) optsize
60 define void @f4(%struct.SmallStruct* nocapture byval %s) nounwind optsize {
62 ; CHECK: bl _consumestruct
64 %addr = getelementptr inbounds %struct.SmallStruct* %s, i32 0, i32 0
65 %0 = bitcast i32* %addr to i8*
66 tail call void @consumestruct(i8* %0, i32 80) optsize
70 ; We can do tail call here since s is in the incoming argument area.
71 define void @f5(i32 %a, i32 %b, i32 %c, i32 %d, %struct.SmallStruct* nocapture byval %s) nounwind optsize {
73 ; CHECK: b _consumestruct
75 %0 = bitcast %struct.SmallStruct* %s to i8*
76 tail call void @consumestruct(i8* %0, i32 80) optsize
80 define void @f6(i32 %a, i32 %b, i32 %c, i32 %d, %struct.SmallStruct* nocapture byval %s) nounwind optsize {
82 ; CHECK: b _consumestruct
84 %addr = getelementptr inbounds %struct.SmallStruct* %s, i32 0, i32 0
85 %0 = bitcast i32* %addr to i8*
86 tail call void @consumestruct(i8* %0, i32 80) optsize
90 declare void @consumestruct(i8* nocapture %structp, i32 %structsize) nounwind