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
3 ; RUN: llc < %s -mtriple=armv7-unknown-nacl-gnueabi | FileCheck %s -check-prefix=NACL
4 ; RUN: llc < %s -mtriple=armv5-none-linux-gnueabi | FileCheck %s -check-prefix=NOMOVT
9 %struct.SmallStruct = type { i32, [8 x i32], [37 x i8] }
10 %struct.LargeStruct = type { i32, [1001 x i8], [300 x i32] }
12 define i32 @f() nounwind ssp {
22 %st = alloca %struct.SmallStruct, align 4
23 %call = call i32 @e1(%struct.SmallStruct* byval %st)
27 ; Generate a loop for large struct byval
28 define i32 @g() nounwind ssp {
41 ; Ensure that use movw instead of constpool for the loop trip count. But don't
42 ; match the __stack_chk_guard movw
43 ; NACL: movw r{{[1-9]}}, #
48 %st = alloca %struct.LargeStruct, align 4
49 %call = call i32 @e2(%struct.LargeStruct* byval %st)
53 ; Generate a loop using NEON instructions
54 define i32 @h() nounwind ssp {
66 ; NACL: movw r{{[1-9]}}, #
71 %st = alloca %struct.LargeStruct, align 16
72 %call = call i32 @e3(%struct.LargeStruct* byval align 16 %st)
76 declare i32 @e1(%struct.SmallStruct* nocapture byval %in) nounwind
77 declare i32 @e2(%struct.LargeStruct* nocapture byval %in) nounwind
78 declare i32 @e3(%struct.LargeStruct* nocapture byval align 16 %in) nounwind
81 ; We can't do tail call since address of s is passed to the callee and part of
82 ; s is in caller's local frame.
83 define void @f3(%struct.SmallStruct* nocapture byval %s) nounwind optsize {
85 ; CHECK: bl _consumestruct
87 ; THUMB: blx _consumestruct
89 %0 = bitcast %struct.SmallStruct* %s to i8*
90 tail call void @consumestruct(i8* %0, i32 80) optsize
94 define void @f4(%struct.SmallStruct* nocapture byval %s) nounwind optsize {
96 ; CHECK: bl _consumestruct
98 ; THUMB: blx _consumestruct
100 %addr = getelementptr inbounds %struct.SmallStruct, %struct.SmallStruct* %s, i32 0, i32 0
101 %0 = bitcast i32* %addr to i8*
102 tail call void @consumestruct(i8* %0, i32 80) optsize
106 ; We can do tail call here since s is in the incoming argument area.
107 define void @f5(i32 %a, i32 %b, i32 %c, i32 %d, %struct.SmallStruct* nocapture byval %s) nounwind optsize {
109 ; CHECK: b _consumestruct
111 ; THUMB: b.w _consumestruct
113 %0 = bitcast %struct.SmallStruct* %s to i8*
114 tail call void @consumestruct(i8* %0, i32 80) optsize
118 define void @f6(i32 %a, i32 %b, i32 %c, i32 %d, %struct.SmallStruct* nocapture byval %s) nounwind optsize {
120 ; CHECK: b _consumestruct
122 ; THUMB: b.w _consumestruct
124 %addr = getelementptr inbounds %struct.SmallStruct, %struct.SmallStruct* %s, i32 0, i32 0
125 %0 = bitcast i32* %addr to i8*
126 tail call void @consumestruct(i8* %0, i32 80) optsize
130 declare void @consumestruct(i8* nocapture %structp, i32 %structsize) nounwind
133 %struct.I.8 = type { [10 x i32], [3 x i8] }
135 declare void @use_I(%struct.I.8* byval)
136 define void @test_I_16() {
137 ; CHECK-LABEL: test_I_16
140 ; THUMB-LABEL: test_I_16
144 call void @use_I(%struct.I.8* byval align 16 undef)