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