1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s --check-prefix=ARM
3 ; RUN: llc -mtriple=thumbv6t2-eabi %s -o - | FileCheck %s --check-prefix=THUMB2
4 ; RUN: llc -mtriple=thumb-eabi %s -o - | FileCheck %s --check-prefix=THUMB
6 define i32 @t9(i32 %v) nounwind readnone {
8 ; ARM: @ %bb.0: @ %entry
9 ; ARM-NEXT: add r0, r0, r0, lsl #3
10 ; ARM-NEXT: mov pc, lr
13 ; THUMB2: @ %bb.0: @ %entry
14 ; THUMB2-NEXT: add.w r0, r0, r0, lsl #3
18 ; THUMB: @ %bb.0: @ %entry
19 ; THUMB-NEXT: movs r1, #9
20 ; THUMB-NEXT: muls r0, r1, r0
27 define i32 @t7(i32 %v) nounwind readnone {
29 ; ARM: @ %bb.0: @ %entry
30 ; ARM-NEXT: rsb r0, r0, r0, lsl #3
31 ; ARM-NEXT: mov pc, lr
34 ; THUMB2: @ %bb.0: @ %entry
35 ; THUMB2-NEXT: rsb r0, r0, r0, lsl #3
39 ; THUMB: @ %bb.0: @ %entry
40 ; THUMB-NEXT: movs r1, #7
41 ; THUMB-NEXT: muls r0, r1, r0
48 define i32 @t5(i32 %v) nounwind readnone {
50 ; ARM: @ %bb.0: @ %entry
51 ; ARM-NEXT: add r0, r0, r0, lsl #2
52 ; ARM-NEXT: mov pc, lr
55 ; THUMB2: @ %bb.0: @ %entry
56 ; THUMB2-NEXT: add.w r0, r0, r0, lsl #2
60 ; THUMB: @ %bb.0: @ %entry
61 ; THUMB-NEXT: movs r1, #5
62 ; THUMB-NEXT: muls r0, r1, r0
69 define i32 @t3(i32 %v) nounwind readnone {
71 ; ARM: @ %bb.0: @ %entry
72 ; ARM-NEXT: add r0, r0, r0, lsl #1
73 ; ARM-NEXT: mov pc, lr
76 ; THUMB2: @ %bb.0: @ %entry
77 ; THUMB2-NEXT: add.w r0, r0, r0, lsl #1
81 ; THUMB: @ %bb.0: @ %entry
82 ; THUMB-NEXT: movs r1, #3
83 ; THUMB-NEXT: muls r0, r1, r0
90 define i32 @t12288(i32 %v) nounwind readnone {
92 ; ARM: @ %bb.0: @ %entry
93 ; ARM-NEXT: add r0, r0, r0, lsl #1
94 ; ARM-NEXT: lsl r0, r0, #12
95 ; ARM-NEXT: mov pc, lr
97 ; THUMB2-LABEL: t12288:
98 ; THUMB2: @ %bb.0: @ %entry
99 ; THUMB2-NEXT: add.w r0, r0, r0, lsl #1
100 ; THUMB2-NEXT: lsls r0, r0, #12
103 ; THUMB-LABEL: t12288:
104 ; THUMB: @ %bb.0: @ %entry
105 ; THUMB-NEXT: movs r1, #3
106 ; THUMB-NEXT: lsls r1, r1, #12
107 ; THUMB-NEXT: muls r0, r1, r0
110 %0 = mul i32 %v, 12288
114 define i32 @tn9(i32 %v) nounwind readnone {
116 ; ARM: @ %bb.0: @ %entry
117 ; ARM-NEXT: add r0, r0, r0, lsl #3
118 ; ARM-NEXT: rsb r0, r0, #0
119 ; ARM-NEXT: mov pc, lr
122 ; THUMB2: @ %bb.0: @ %entry
123 ; THUMB2-NEXT: add.w r0, r0, r0, lsl #3
124 ; THUMB2-NEXT: rsbs r0, r0, #0
128 ; THUMB: @ %bb.0: @ %entry
129 ; THUMB-NEXT: movs r1, #8
130 ; THUMB-NEXT: mvns r1, r1
131 ; THUMB-NEXT: muls r0, r1, r0
138 define i32 @tn7(i32 %v) nounwind readnone {
140 ; ARM: @ %bb.0: @ %entry
141 ; ARM-NEXT: sub r0, r0, r0, lsl #3
142 ; ARM-NEXT: mov pc, lr
145 ; THUMB2: @ %bb.0: @ %entry
146 ; THUMB2-NEXT: sub.w r0, r0, r0, lsl #3
150 ; THUMB: @ %bb.0: @ %entry
151 ; THUMB-NEXT: movs r1, #6
152 ; THUMB-NEXT: mvns r1, r1
153 ; THUMB-NEXT: muls r0, r1, r0
160 define i32 @tn5(i32 %v) nounwind readnone {
162 ; ARM: @ %bb.0: @ %entry
163 ; ARM-NEXT: add r0, r0, r0, lsl #2
164 ; ARM-NEXT: rsb r0, r0, #0
165 ; ARM-NEXT: mov pc, lr
168 ; THUMB2: @ %bb.0: @ %entry
169 ; THUMB2-NEXT: add.w r0, r0, r0, lsl #2
170 ; THUMB2-NEXT: rsbs r0, r0, #0
174 ; THUMB: @ %bb.0: @ %entry
175 ; THUMB-NEXT: movs r1, #4
176 ; THUMB-NEXT: mvns r1, r1
177 ; THUMB-NEXT: muls r0, r1, r0
184 define i32 @tn3(i32 %v) nounwind readnone {
186 ; ARM: @ %bb.0: @ %entry
187 ; ARM-NEXT: sub r0, r0, r0, lsl #2
188 ; ARM-NEXT: mov pc, lr
191 ; THUMB2: @ %bb.0: @ %entry
192 ; THUMB2-NEXT: sub.w r0, r0, r0, lsl #2
196 ; THUMB: @ %bb.0: @ %entry
197 ; THUMB-NEXT: movs r1, #2
198 ; THUMB-NEXT: mvns r1, r1
199 ; THUMB-NEXT: muls r0, r1, r0
203 ; CHECK: sub r0, r0, r0, lsl #2
208 define i32 @tn12288(i32 %v) nounwind readnone {
209 ; ARM-LABEL: tn12288:
210 ; ARM: @ %bb.0: @ %entry
211 ; ARM-NEXT: sub r0, r0, r0, lsl #2
212 ; ARM-NEXT: lsl r0, r0, #12
213 ; ARM-NEXT: mov pc, lr
215 ; THUMB2-LABEL: tn12288:
216 ; THUMB2: @ %bb.0: @ %entry
217 ; THUMB2-NEXT: sub.w r0, r0, r0, lsl #2
218 ; THUMB2-NEXT: lsls r0, r0, #12
221 ; THUMB-LABEL: tn12288:
222 ; THUMB: @ %bb.0: @ %entry
223 ; THUMB-NEXT: ldr r1, .LCPI9_0
224 ; THUMB-NEXT: muls r0, r1, r0
226 ; THUMB-NEXT: .p2align 2
227 ; THUMB-NEXT: @ %bb.1:
228 ; THUMB-NEXT: .LCPI9_0:
229 ; THUMB-NEXT: .long 4294955008 @ 0xffffd000
231 ; CHECK-LABEL: tn12288:
232 ; CHECK: sub r0, r0, r0, lsl #2
233 ; CHECK: lsl{{.*}}#12
234 %0 = mul i32 %v, -12288