1 ; RUN: llc < %s -mtriple=armv7-apple-ios6.0 | FileCheck %s
2 ; RUN: llc < %s -mtriple=thumbv7-apple-ios6.0 | FileCheck %s -check-prefix=THUMB
5 %struct.SmallStruct = type { i32, [8 x i32], [37 x i8] }
6 %struct.LargeStruct = type { i32, [1001 x i8], [300 x i32] }
8 define i32 @f() nounwind ssp {
18 %st = alloca %struct.SmallStruct, align 4
19 %call = call i32 @e1(%struct.SmallStruct* byval %st)
23 ; Generate a loop for large struct byval
24 define i32 @g() nounwind ssp {
36 %st = alloca %struct.LargeStruct, align 4
37 %call = call i32 @e2(%struct.LargeStruct* byval %st)
41 ; Generate a loop using NEON instructions
42 define i32 @h() nounwind ssp {
54 %st = alloca %struct.LargeStruct, align 16
55 %call = call i32 @e3(%struct.LargeStruct* byval align 16 %st)
59 declare i32 @e1(%struct.SmallStruct* nocapture byval %in) nounwind
60 declare i32 @e2(%struct.LargeStruct* nocapture byval %in) nounwind
61 declare i32 @e3(%struct.LargeStruct* nocapture byval align 16 %in) nounwind
64 ; We can't do tail call since address of s is passed to the callee and part of
65 ; s is in caller's local frame.
66 define void @f3(%struct.SmallStruct* nocapture byval %s) nounwind optsize {
68 ; CHECK: bl _consumestruct
70 ; THUMB: blx _consumestruct
72 %0 = bitcast %struct.SmallStruct* %s to i8*
73 tail call void @consumestruct(i8* %0, i32 80) optsize
77 define void @f4(%struct.SmallStruct* nocapture byval %s) nounwind optsize {
79 ; CHECK: bl _consumestruct
81 ; THUMB: blx _consumestruct
83 %addr = getelementptr inbounds %struct.SmallStruct* %s, i32 0, i32 0
84 %0 = bitcast i32* %addr to i8*
85 tail call void @consumestruct(i8* %0, i32 80) optsize
89 ; We can do tail call here since s is in the incoming argument area.
90 define void @f5(i32 %a, i32 %b, i32 %c, i32 %d, %struct.SmallStruct* nocapture byval %s) nounwind optsize {
92 ; CHECK: b _consumestruct
94 ; THUMB: b.w _consumestruct
96 %0 = bitcast %struct.SmallStruct* %s to i8*
97 tail call void @consumestruct(i8* %0, i32 80) optsize
101 define void @f6(i32 %a, i32 %b, i32 %c, i32 %d, %struct.SmallStruct* nocapture byval %s) nounwind optsize {
103 ; CHECK: b _consumestruct
105 ; THUMB: b.w _consumestruct
107 %addr = getelementptr inbounds %struct.SmallStruct* %s, i32 0, i32 0
108 %0 = bitcast i32* %addr to i8*
109 tail call void @consumestruct(i8* %0, i32 80) optsize
113 declare void @consumestruct(i8* nocapture %structp, i32 %structsize) nounwind
116 %struct.I.8 = type { [10 x i32], [3 x i8] }
118 declare void @use_I(%struct.I.8* byval)
119 define void @test_I_16() {
120 ; CHECK-LABEL: test_I_16
123 ; THUMB-LABEL: test_I_16
127 call void @use_I(%struct.I.8* byval align 16 undef)