1 ; RUN: llc < %s -mtriple=thumbv7-apple-ios -mcpu=cortex-a8 -pre-RA-sched=source -disable-post-ra | FileCheck %s
2 ; RUN: llc < %s -mtriple=thumbv6m-apple-ios -mcpu=cortex-m0 -pre-RA-sched=source -disable-post-ra -mattr=+strict-align | FileCheck %s -check-prefix=CHECK-T1
3 %struct.x = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
5 @src = external global %struct.x
6 @dst = external global %struct.x
8 @.str1 = private unnamed_addr constant [31 x i8] c"DHRYSTONE PROGRAM, SOME STRING\00", align 1
9 @.str2 = private unnamed_addr constant [36 x i8] c"DHRYSTONE PROGRAM, SOME STRING BLAH\00", align 1
10 @.str3 = private unnamed_addr constant [24 x i8] c"DHRYSTONE PROGRAM, SOME\00", align 1
11 @.str4 = private unnamed_addr constant [18 x i8] c"DHRYSTONE PROGR \00", align 1
12 @.str5 = private unnamed_addr constant [7 x i8] c"DHRYST\00", align 1
13 @.str6 = private unnamed_addr constant [14 x i8] c"/tmp/rmXXXXXX\00", align 1
14 @spool.splbuf = internal global [512 x i8] zeroinitializer, align 16
19 ; CHECK: vldr [[REG1:d[0-9]+]],
20 ; CHECK: vstr [[REG1]],
22 ; CHECK-T1: ldrb [[TREG1:r[0-9]]],
23 ; CHECK-T1: strb [[TREG1]],
24 ; CHECK-T1: ldrh [[TREG2:r[0-9]]],
25 ; CHECK-T1: strh [[TREG2]]
26 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 getelementptr inbounds (%struct.x, %struct.x* @dst, i32 0, i32 0), i8* align 8 getelementptr inbounds (%struct.x, %struct.x* @src, i32 0, i32 0), i32 11, i1 false)
30 define void @t1(i8* nocapture %C) nounwind {
33 ; CHECK: movs [[INC:r[0-9]+]], #15
34 ; CHECK: vld1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r1], [[INC]]
35 ; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0], [[INC]]
36 ; CHECK: vld1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r1]
37 ; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0]
39 ; CHECK-T1: bl _memcpy
40 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str1, i64 0, i64 0), i64 31, i1 false)
44 define void @t2(i8* nocapture %C) nounwind {
47 ; CHECK: vld1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r2]!
48 ; CHECK: vld1.64 {d{{[0-9]+}}, d{{[0-9]+}}}, [r2]
49 ; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r1]
50 ; CHECK: movs [[INC:r[0-9]+]], #32
51 ; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0], [[INC]]
52 ; CHECK: movw [[REG2:r[0-9]+]], #16716
53 ; CHECK: movt [[REG2:r[0-9]+]], #72
54 ; CHECK: str [[REG2]], [r0]
56 ; CHECK-T1: bl _memcpy
57 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str2, i64 0, i64 0), i64 36, i1 false)
61 define void @t3(i8* nocapture %C) nounwind {
64 ; CHECK: vld1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r1]!
65 ; CHECK: vst1.8 {d{{[0-9]+}}, d{{[0-9]+}}}, [r0]!
66 ; CHECK: vldr d{{[0-9]+}}, [r1]
67 ; CHECK: vst1.8 {d{{[0-9]+}}}, [r0]
69 ; CHECK-T1: bl _memcpy
70 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str3, i64 0, i64 0), i64 24, i1 false)
74 define void @t4(i8* nocapture %C) nounwind {
77 ; CHECK: vld1.64 {[[REG3:d[0-9]+]], [[REG4:d[0-9]+]]}, [r1]
78 ; CHECK: vst1.8 {[[REG3]], [[REG4]]}, [r0]!
79 ; CHECK: strh [[REG5:r[0-9]+]], [r0]
81 ; CHECK-T1: bl _memcpy
82 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str4, i64 0, i64 0), i64 18, i1 false)
86 define void @t5(i8* nocapture %C) nounwind {
89 ; CHECK: movw [[REG5:r[0-9]+]], #21337
90 ; CHECK: movt [[REG5]], #84
91 ; CHECK: str.w [[REG5]], [r0, #3]
92 ; CHECK: movw [[REG7:r[0-9]+]], #18500
93 ; CHECK: movt [[REG7:r[0-9]+]], #22866
96 ; CHECK-T1: bl _memcpy
97 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str5, i64 0, i64 0), i64 7, i1 false)
101 define void @t6() nounwind {
104 ; CHECK: vldr [[REG9:d[0-9]+]], [r0]
105 ; CHECK: vstr [[REG9]], [r1]
110 ; CHECK-T1-LABEL: t6:
111 ; CHECK-T1: movs [[TREG5:r[0-9]]],
112 ; CHECK-T1: strh [[TREG5]],
113 ; CHECK-T1: ldr [[TREG6:r[0-9]]],
114 ; CHECK-T1: str [[TREG6]]
115 call void @llvm.memcpy.p0i8.p0i8.i64(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @spool.splbuf, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str6, i64 0, i64 0), i64 14, i1 false)
119 %struct.Foo = type { i32, i32, i32, i32 }
121 define void @t7(%struct.Foo* nocapture %a, %struct.Foo* nocapture %b) nounwind {
126 ; CHECK-T1-LABEL: t7:
129 %0 = bitcast %struct.Foo* %a to i8*
130 %1 = bitcast %struct.Foo* %b to i8*
131 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %0, i8* align 4 %1, i32 16, i1 false)
135 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
136 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind