1; RUN: llc -mtriple=arm-eabi -pre-RA-sched=source -mattr=+strict-align %s -o - \
2; RUN:	| FileCheck %s -check-prefix=EXPANDED
3
4; RUN: llc -mtriple=armv6-apple-darwin -mcpu=cortex-a8 -mattr=-neon,+strict-align -pre-RA-sched=source %s -o - \
5; RUN:	| FileCheck %s -check-prefix=EXPANDED
6
7; RUN: llc -mtriple=armv6-apple-darwin -mcpu=cortex-a8 %s -o - \
8; RUN:	| FileCheck %s -check-prefix=UNALIGNED
9
10; rdar://7113725
11; rdar://12091029
12
13define void @t(i8* nocapture %a, i8* nocapture %b) nounwind {
14entry:
15; EXPANDED-LABEL: t:
16; EXPANDED: ldrb [[R2:r[0-9]+]]
17; EXPANDED: ldrb [[R3:r[0-9]+]]
18; EXPANDED: ldrb [[R12:r[0-9]+]]
19; EXPANDED: ldrb [[R1:r[0-9]+]]
20; EXPANDED: strb [[R1]]
21; EXPANDED: strb [[R12]]
22; EXPANDED: strb [[R3]]
23; EXPANDED: strb [[R2]]
24
25; UNALIGNED-LABEL: t:
26; UNALIGNED: ldr r1
27; UNALIGNED: str r1
28
29  %__src1.i = bitcast i8* %b to i32*              ; <i32*> [#uses=1]
30  %__dest2.i = bitcast i8* %a to i32*             ; <i32*> [#uses=1]
31  %tmp.i = load i32, i32* %__src1.i, align 1           ; <i32> [#uses=1]
32  store i32 %tmp.i, i32* %__dest2.i, align 1
33  ret void
34}
35
36define void @hword(double* %a, double* %b) nounwind {
37entry:
38; EXPANDED-LABEL: hword:
39; EXPANDED-NOT: vld1
40; EXPANDED: ldrh
41; EXPANDED-NOT: str1
42; EXPANDED: strh
43
44; UNALIGNED-LABEL: hword:
45; UNALIGNED: vld1.16
46; UNALIGNED: vst1.16
47  %tmp = load double, double* %a, align 2
48  store double %tmp, double* %b, align 2
49  ret void
50}
51
52define void @byte(double* %a, double* %b) nounwind {
53entry:
54; EXPANDED-LABEL: byte:
55; EXPANDED-NOT: vld1
56; EXPANDED: ldrb
57; EXPANDED-NOT: str1
58; EXPANDED: strb
59
60; UNALIGNED-LABEL: byte:
61; UNALIGNED: vld1.8
62; UNALIGNED: vst1.8
63  %tmp = load double, double* %a, align 1
64  store double %tmp, double* %b, align 1
65  ret void
66}
67
68define void @byte_word_ops(i32* %a, i32* %b) nounwind {
69entry:
70; EXPANDED-LABEL: byte_word_ops:
71; EXPANDED: ldrb
72; EXPANDED: strb
73
74; UNALIGNED-LABEL: byte_word_ops:
75; UNALIGNED-NOT: ldrb
76; UNALIGNED: ldr
77; UNALIGNED-NOT: strb
78; UNALIGNED: str
79  %tmp = load i32, i32* %a, align 1
80  store i32 %tmp, i32* %b, align 1
81  ret void
82}
83