1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv6m-none-eabi < %s | FileCheck %s --check-prefix=CHECKV6M
3 ; RUN: llc -mtriple=thumbv7m-none-eabi < %s | FileCheck %s --check-prefix=CHECKV7M
4 ; RUN: llc -mtriple=thumbv7a-none-eabi < %s | FileCheck %s --check-prefix=CHECKV7A
6 define void @small(i32 %a, i32 %b, ptr %c, ptr %d) {
7 ; CHECKV6M-LABEL: small:
8 ; CHECKV6M: @ %bb.0: @ %entry
9 ; CHECKV6M-NEXT: str r1, [r3, #120]
10 ; CHECKV6M-NEXT: str r0, [r3, #80]
11 ; CHECKV6M-NEXT: str r0, [r2, #80]
12 ; CHECKV6M-NEXT: bx lr
14 ; CHECKV7M-LABEL: small:
15 ; CHECKV7M: @ %bb.0: @ %entry
16 ; CHECKV7M-NEXT: str r1, [r3, #120]
17 ; CHECKV7M-NEXT: str r0, [r3, #80]
18 ; CHECKV7M-NEXT: str r0, [r2, #80]
19 ; CHECKV7M-NEXT: bx lr
21 ; CHECKV7A-LABEL: small:
22 ; CHECKV7A: @ %bb.0: @ %entry
23 ; CHECKV7A-NEXT: str r1, [r3, #120]
24 ; CHECKV7A-NEXT: str r0, [r3, #80]
25 ; CHECKV7A-NEXT: str r0, [r2, #80]
26 ; CHECKV7A-NEXT: bx lr
28 %arrayidx = getelementptr inbounds i32, ptr %d, i32 20
29 store i32 %a, ptr %arrayidx, align 4
30 %arrayidx1 = getelementptr inbounds i32, ptr %d, i32 30
31 store i32 %b, ptr %arrayidx1, align 4
32 %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 20
33 store i32 %a, ptr %arrayidx2, align 4
37 define void @large(i32 %a, i32 %b, ptr %c, ptr %d) {
38 ; CHECKV6M-LABEL: large:
39 ; CHECKV6M: @ %bb.0: @ %entry
40 ; CHECKV6M-NEXT: .save {r4, lr}
41 ; CHECKV6M-NEXT: push {r4, lr}
42 ; CHECKV6M-NEXT: ldr r4, .LCPI1_0
43 ; CHECKV6M-NEXT: str r1, [r3, r4]
44 ; CHECKV6M-NEXT: movs r1, #125
45 ; CHECKV6M-NEXT: lsls r1, r1, #6
46 ; CHECKV6M-NEXT: str r0, [r3, r1]
47 ; CHECKV6M-NEXT: str r0, [r2, r1]
48 ; CHECKV6M-NEXT: pop {r4, pc}
49 ; CHECKV6M-NEXT: .p2align 2
50 ; CHECKV6M-NEXT: @ %bb.1:
51 ; CHECKV6M-NEXT: .LCPI1_0:
52 ; CHECKV6M-NEXT: .long 12000 @ 0x2ee0
54 ; CHECKV7M-LABEL: large:
55 ; CHECKV7M: @ %bb.0: @ %entry
56 ; CHECKV7M-NEXT: mov.w r12, #8000
57 ; CHECKV7M-NEXT: str.w r0, [r3, r12]
58 ; CHECKV7M-NEXT: add.w r3, r3, #8000
59 ; CHECKV7M-NEXT: str.w r1, [r3, #4000]
60 ; CHECKV7M-NEXT: str.w r0, [r2, r12]
61 ; CHECKV7M-NEXT: bx lr
63 ; CHECKV7A-LABEL: large:
64 ; CHECKV7A: @ %bb.0: @ %entry
65 ; CHECKV7A-NEXT: mov.w r12, #8000
66 ; CHECKV7A-NEXT: str.w r0, [r3, r12]
67 ; CHECKV7A-NEXT: add.w r3, r3, #8000
68 ; CHECKV7A-NEXT: str.w r1, [r3, #4000]
69 ; CHECKV7A-NEXT: str.w r0, [r2, r12]
70 ; CHECKV7A-NEXT: bx lr
72 %arrayidx = getelementptr inbounds i32, ptr %d, i32 2000
73 store i32 %a, ptr %arrayidx, align 4
74 %arrayidx1 = getelementptr inbounds i32, ptr %d, i32 3000
75 store i32 %b, ptr %arrayidx1, align 4
76 %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 2000
77 store i32 %a, ptr %arrayidx2, align 4
81 define void @huge(i32 %a, i32 %b, ptr %c, ptr %d) {
82 ; CHECKV6M-LABEL: huge:
83 ; CHECKV6M: @ %bb.0: @ %entry
84 ; CHECKV6M-NEXT: .save {r4, lr}
85 ; CHECKV6M-NEXT: push {r4, lr}
86 ; CHECKV6M-NEXT: ldr r4, .LCPI2_0
87 ; CHECKV6M-NEXT: str r1, [r3, r4]
88 ; CHECKV6M-NEXT: ldr r1, .LCPI2_1
89 ; CHECKV6M-NEXT: str r0, [r3, r1]
90 ; CHECKV6M-NEXT: str r0, [r2, r1]
91 ; CHECKV6M-NEXT: pop {r4, pc}
92 ; CHECKV6M-NEXT: .p2align 2
93 ; CHECKV6M-NEXT: @ %bb.1:
94 ; CHECKV6M-NEXT: .LCPI2_0:
95 ; CHECKV6M-NEXT: .long 1200000 @ 0x124f80
96 ; CHECKV6M-NEXT: .LCPI2_1:
97 ; CHECKV6M-NEXT: .long 800000 @ 0xc3500
99 ; CHECKV7M-LABEL: huge:
100 ; CHECKV7M: @ %bb.0: @ %entry
101 ; CHECKV7M-NEXT: movw r12, #20352
102 ; CHECKV7M-NEXT: movt r12, #18
103 ; CHECKV7M-NEXT: str.w r1, [r3, r12]
104 ; CHECKV7M-NEXT: movw r1, #13568
105 ; CHECKV7M-NEXT: movt r1, #12
106 ; CHECKV7M-NEXT: str r0, [r3, r1]
107 ; CHECKV7M-NEXT: str r0, [r2, r1]
108 ; CHECKV7M-NEXT: bx lr
110 ; CHECKV7A-LABEL: huge:
111 ; CHECKV7A: @ %bb.0: @ %entry
112 ; CHECKV7A-NEXT: movw r12, #20352
113 ; CHECKV7A-NEXT: movt r12, #18
114 ; CHECKV7A-NEXT: str.w r1, [r3, r12]
115 ; CHECKV7A-NEXT: movw r1, #13568
116 ; CHECKV7A-NEXT: movt r1, #12
117 ; CHECKV7A-NEXT: str r0, [r3, r1]
118 ; CHECKV7A-NEXT: str r0, [r2, r1]
119 ; CHECKV7A-NEXT: bx lr
121 %arrayidx = getelementptr inbounds i32, ptr %d, i32 200000
122 store i32 %a, ptr %arrayidx, align 4
123 %arrayidx1 = getelementptr inbounds i32, ptr %d, i32 300000
124 store i32 %b, ptr %arrayidx1, align 4
125 %arrayidx2 = getelementptr inbounds i32, ptr %c, i32 200000
126 store i32 %a, ptr %arrayidx2, align 4