1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
| ; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s -check-prefix=CHECK --check-prefix=CHECK-LE
; RUN: llc -mtriple=armv7-eabi %s -o - | FileCheck %s -check-prefix=CHECK --check-prefix=CHECK-V7-LE
; RUN: llc -mtriple=armeb-eabi %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-BE
; RUN: llc -mtriple=armebv7-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V7-BE
; RUN: llc -mtriple=thumbv6-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V6-THUMB
; RUN: llc -mtriple=thumbv6t2-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-T2-DSP
; RUN: llc -mtriple=thumbv7-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-T2-DSP
; RUN: llc -mtriple=thumbebv7-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V7-THUMB-BE
; RUN: llc -mtriple=thumbv6m-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V6M-THUMB
; RUN: llc -mtriple=thumbv7m-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V7M-THUMB
; RUN: llc -mtriple=thumbv7em-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-T2-DSP
; RUN: llc -mtriple=armv5te-eabi %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-V5TE
; Check generated signed and unsigned multiply accumulate long.
define i64 @MACLongTest1(i32 %a, i32 %b, i64 %c) {
;CHECK-LABEL: MACLongTest1:
;CHECK-V6-THUMB-NOT: umlal
;CHECK-LE: umlal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-LE: mov r0, [[RDLO]]
;CHECK-LE: mov r1, [[RDHI]]
;CHECK-BE: umlal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-BE: mov r0, [[RDHI]]
;CHECK-BE: mov r1, [[RDLO]]
;CHECK-T2-DSP: umlal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-T2-DSP-NEXT: mov r0, [[RDLO]]
;CHECK-T2-DSP-NEXT: mov r1, [[RDHI]]
;CHECK-V7-THUMB-BE: umlal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-V7-THUMB-BE: mov r0, [[RDHI]]
;CHECK-V7-THUMB-BE: mov r1, [[RDLO]]
%conv = zext i32 %a to i64
%conv1 = zext i32 %b to i64
%mul = mul i64 %conv1, %conv
%add = add i64 %mul, %c
ret i64 %add
}
define i64 @MACLongTest2(i32 %a, i32 %b, i64 %c) {
;CHECK-LABEL: MACLongTest2:
;CHECK-LE: smlal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-LE: mov r0, [[RDLO]]
;CHECK-LE: mov r1, [[RDHI]]
;CHECK-BE: smlal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-BE: mov r0, [[RDHI]]
;CHECK-BE: mov r1, [[RDLO]]
;CHECK-T2-DSP: smlal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-T2-DSP-NEXT: mov r0, [[RDLO]]
;CHECK-T2-DSP-NEXT: mov r1, [[RDHI]]
;CHECK-V7-THUMB-BE: smlal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-V7-THUMB-BE: mov r0, [[RDHI]]
;CHECK-V7-THUMB-BE: mov r1, [[RDLO]]
%conv = sext i32 %a to i64
%conv1 = sext i32 %b to i64
%mul = mul nsw i64 %conv1, %conv
%add = add nsw i64 %mul, %c
ret i64 %add
}
; Two things to check here: the @earlyclobber constraint (on <= v5) and the "$Rd = $R" ones.
; + Without @earlyclobber the v7 code is natural. With it, the first two
; registers must be distinct from the third.
; + Without "$Rd = $R", this can be satisfied without a mov before the umlal
; by trying to use 6 different registers in the MachineInstr. The natural
; evolution of this attempt currently leaves only two movs in the final
; function, both after the umlal. With it, *some* move has to happen
; before the umlal.
define i64 @MACLongTest3(i32 %a, i32 %b, i32 %c) {
;CHECK-LABEL: MACLongTest3:
;CHECK-LE: mov [[RDHI:r[0-9]+]], #0
;CHECK-LE: umlal [[RDLO:r[0-9]+]], [[RDHI]], r1, r0
;CHECK-LE: mov r0, [[RDLO]]
;CHECK-LE: mov r1, [[RDHI]]
;CHECK-BE: mov [[RDHI:r[0-9]+]], #0
;CHECK-BE: umlal [[RDLO:r[0-9]+]], [[RDHI]], r1, r0
;CHECK-BE: mov r0, [[RDHI]]
;CHECK-BE: mov r1, [[RDLO]]
;CHECK-T2-DSP: umlal
;CHECK-V6-THUMB-NOT: umlal
%conv = zext i32 %b to i64
%conv1 = zext i32 %a to i64
%mul = mul i64 %conv, %conv1
%conv2 = zext i32 %c to i64
%add = add i64 %mul, %conv2
ret i64 %add
}
define i64 @MACLongTest4(i32 %a, i32 %b, i32 %c) {
;CHECK-LABEL: MACLongTest4:
;CHECK-V6-THUMB-NOT: smlal
;CHECK-T2-DSP: smlal
;CHECK-LE: asr [[RDHI:r[0-9]+]], [[RDLO:r[0-9]+]], #31
;CHECK-LE: smlal [[RDLO]], [[RDHI]], r1, r0
;CHECK-LE: mov r0, [[RDLO]]
;CHECK-LE: mov r1, [[RDHI]]
;CHECK-BE: asr [[RDHI:r[0-9]+]], [[RDLO:r[0-9]+]], #31
;CHECK-BE: smlal [[RDLO]], [[RDHI]], r1, r0
;CHECK-BE: mov r0, [[RDHI]]
;CHECK-BE: mov r1, [[RDLO]]
%conv = sext i32 %b to i64
%conv1 = sext i32 %a to i64
%mul = mul nsw i64 %conv, %conv1
%conv2 = sext i32 %c to i64
%add = add nsw i64 %mul, %conv2
ret i64 %add
}
define i64 @MACLongTest6(i32 %a, i32 %b, i32 %c, i32 %d) {
;CHECK-LABEL: MACLongTest6:
;CHECK-V6-THUMB-NOT: smull
;CHECK-V6-THUMB-NOT: smlal
;CHECK-LE: smull r12, lr, r1, r0
;CHECK-LE: smlal r12, lr, r3, r2
;CHECK-V7: smull [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], r1, r0
;CHECK-V7: smlal [[RDLO]], [[RDHI]], [[Rn:r[0-9]+]], [[Rm:r[0-9]+]]
;CHECK-T2-DSP: smull [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], r1, r0
;CHECK-T2-DSP: smlal [[RDLO]], [[RDHI]], [[Rn:r[0-9]+]], [[Rm:r[0-9]+]]
%conv = sext i32 %a to i64
%conv1 = sext i32 %b to i64
%mul = mul nsw i64 %conv1, %conv
%conv2 = sext i32 %c to i64
%conv3 = sext i32 %d to i64
%mul4 = mul nsw i64 %conv3, %conv2
%add = add nsw i64 %mul4, %mul
ret i64 %add
}
define i64 @MACLongTest7(i64 %acc, i32 %lhs, i32 %rhs) {
;CHECK-LABEL: MACLongTest7:
;CHECK-NOT: smlal
;CHECK-V6-THUMB2-NOT: smlal
;CHECK-V7-THUMB-NOT: smlal
;CHECK-V6-THUMB-NOT: smlal
%conv = sext i32 %lhs to i64
%conv1 = sext i32 %rhs to i64
%mul = mul nsw i64 %conv1, %conv
%shl = shl i64 %mul, 32
%shr = lshr i64 %mul, 32
%or = or i64 %shl, %shr
%add = add i64 %or, %acc
ret i64 %add
}
define i64 @MACLongTest8(i64 %acc, i32 %lhs, i32 %rhs) {
;CHECK-LABEL: MACLongTest8:
;CHECK-NOT: smlal
;CHECK-V6-THUMB2-NOT: smlal
;CHECK-V7-THUMB-NOT: smlal
;CHECK-V6-THUMB-NOT: smlal
%conv = zext i32 %lhs to i64
%conv1 = zext i32 %rhs to i64
%mul = mul nuw i64 %conv1, %conv
%and = and i64 %mul, 4294967295
%shl = shl i64 %mul, 32
%or = or i64 %and, %shl
%add = add i64 %or, %acc
ret i64 %add
}
define i64 @MACLongTest9(i32 %lhs, i32 %rhs, i32 %lo, i32 %hi) {
;CHECK-LABEL: MACLongTest9:
;CHECK-V7-LE: umaal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-V7-LE: mov r0, [[RDLO]]
;CHECK-V7-LE: mov r1, [[RDHI]]
;CHECK-V7-BE: umaal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-V7-BE: mov r0, [[RDHI]]
;CHECK-V7-BE: mov r1, [[RDLO]]
;CHECK-T2-DSP: umaal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-T2-DSP-NEXT: mov r0, [[RDLO]]
;CHECK-T2-DSP-NEXT: mov r1, [[RDHI]]
;CHECK-V7-THUMB-BE: umaal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-V7-THUMB-BE: mov r0, [[RDHI]]
;CHECK-V7-THUMB-BE: mov r1, [[RDLO]]
;CHECK-NOT:umaal
;CHECK-V6-THUMB-NOT: umaal
;CHECK-V6M-THUMB-NOT: umaal
;CHECK-V7M-THUMB-NOT: umaal
%conv = zext i32 %lhs to i64
%conv1 = zext i32 %rhs to i64
%mul = mul nuw i64 %conv1, %conv
%conv2 = zext i32 %lo to i64
%add = add i64 %mul, %conv2
%conv3 = zext i32 %hi to i64
%add2 = add i64 %add, %conv3
ret i64 %add2
}
define i64 @MACLongTest10(i32 %lhs, i32 %rhs, i32 %lo, i32 %hi) {
;CHECK-LABEL: MACLongTest10:
;CHECK-V7-LE: umaal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-V7-LE: mov r0, [[RDLO]]
;CHECK-V7-LE: mov r1, [[RDHI]]
;CHECK-V7-BE: umaal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-V7-BE: mov r0, [[RDHI]]
;CHECK-V7-BE: mov r1, [[RDLO]]
;CHECK-T2-DSP: umaal r2, r3, r1, r0
;CHECK-T2-DSP-NEXT: mov r0, r2
;CHECK-T2-DSP-NEXT: mov r1, r3
;CHECK-V7-THUMB-BE: umaal [[RDLO:r[0-9]+]], [[RDHI:r[0-9]+]], [[LHS:r[0-9]+]], [[RHS:r[0-9]+]]
;CHECK-V7-THUMB-BE: mov r0, [[RDHI]]
;CHECK-V7-THUMB-BE: mov r1, [[RDLO]]
;CHECK-NOT:umaal
;CHECK-V6-THUMB-NOT:umaal
;CHECK-V6M-THUMB-NOT: umaal
;CHECK-V7M-THUMB-NOT: umaal
%conv = zext i32 %lhs to i64
%conv1 = zext i32 %rhs to i64
%mul = mul nuw i64 %conv1, %conv
%conv2 = zext i32 %lo to i64
%conv3 = zext i32 %hi to i64
%add = add i64 %conv2, %conv3
%add2 = add i64 %add, %mul
ret i64 %add2
}
define i64 @MACLongTest11(i16 %a, i16 %b, i64 %c) {
;CHECK-LABEL: MACLongTest11:
;CHECK-T2-DSP-NOT: sxth
;CHECK-T2-DSP: smlalbb r2, r3
;CHECK-T2-DSP-NEXT: mov r0, r2
;CHECK-T2-DSP-NEXT: mov r1, r3
;CHECK-V5TE-NOT: sxth
;CHECK-V5TE: smlalbb r2, r3
;CHECK-V5TE-NEXT: mov r0, r2
;CHECK-V5TE-NEXT: mov r1, r3
;CHECK-V7-LE-NOT: sxth
;CHECK-V7-LE: smlalbb r2, r3
;CHECK-V7-LE-NEXT: mov r0, r2
;CHECK-V7-LE-NEXT: mov r1, r3
;CHECK-V7-THUMB-BE: smlalbb r3, r2
;CHECK-V7-THUMB-BE-NEXT: mov r0, r2
;CHECK-V7-THUMB-BE-NEXT: mov r1, r3
;CHECK-LE-NOT: smlalbb
;CHECK-BE-NOT: smlalbb
;CHECK-V6M-THUMB-NOT: smlalbb
;CHECK-V7M-THUMB-NOT: smlalbb
%conv = sext i16 %a to i32
%conv1 = sext i16 %b to i32
%mul = mul nsw i32 %conv1, %conv
%conv2 = sext i32 %mul to i64
%add = add nsw i64 %conv2, %c
ret i64 %add
}
define i64 @MACLongTest12(i16 %b, i32 %t, i64 %c) {
;CHECK-LABEL: MACLongTest12:
;CHECK-T2-DSP-NOT: sxth
;CHECK-T2-DSP-NOT: {{asr|lsr}}
;CHECK-T2-DSP: smlalbt r2, r3, r0, r1
;CHECK-T2-DSP-NEXT: mov r0, r2
;CHECK-T2-DSP-NEXT: mov r1, r3
;CHECK-T2-DSP-NOT: sxth
;CHECK-V5TE-NOT: sxth
;CHECK-V5TE-NOT: {{asr|lsr}}
;CHECK-V5TE: smlalbt r2, r3, r0, r1
;CHECK-V5TE-NEXT: mov r0, r2
;CHECK-V5TE-NEXT: mov r1, r3
;CHECK-V7-LE-NOT: sxth
;CHECK-V7-LE-NOT: {{asr|lsr}}
;CHECK-V7-LE: smlalbt r2, r3, r0, r1
;CHECK-V7-LE-NEXT: mov r0, r2
;CHECK-V7-LE-NEXT: mov r1, r3
;CHECK-V7-THUMB-BE: smlalbt r3, r2,
;CHECK-V7-THUMB-BE-NEXT: mov r0, r2
;CHECK-V7-THUMB-BE-NEXT: mov r1, r3
;CHECK-LE-NOT: smlalbt
;CHECK-BE-NOT: smlalbt
;CHECK-V6M-THUMB-NOT: smlalbt
;CHECK-V7M-THUMB-NOT: smlalbt
%conv0 = sext i16 %b to i32
%conv1 = ashr i32 %t, 16
%mul = mul nsw i32 %conv0, %conv1
%conv2 = sext i32 %mul to i64
%add = add nsw i64 %conv2, %c
ret i64 %add
}
define i64 @MACLongTest13(i32 %t, i16 %b, i64 %c) {
;CHECK-LABEL: MACLongTest13:
;CHECK-T2-DSP-NOT: sxth
;CHECK-T2-DSP-NOT: {{asr|lsr}}
;CHECK-T2-DSP: smlaltb r2, r3, r0, r1
;CHECK-T2-DSP-NEXT: mov r0, r2
;CHECK-T2-DSP-NEXT: mov r1, r3
;CHECK-V5TE-NOT: sxth
;CHECK-V5TE-NOT: {{asr|lsr}}
;CHECK-V5TE: smlaltb r2, r3, r0, r1
;CHECK-V5TE-NEXT: mov r0, r2
;CHECK-V5TE-NEXT: mov r1, r3
;CHECK-V7-LE-NOT: sxth
;CHECK-V7-LE-NOT: {{asr|lsr}}
;CHECK-V7-LE: smlaltb r2, r3, r0, r1
;CHECK-V7-LE-NEXT: mov r0, r2
;CHECK-V7-LE-NEXT: mov r1, r3
;CHECK-V7-THUMB-BE: smlaltb r3, r2, r0, r1
;CHECK-V7-THUMB-BE-NEXT: mov r0, r2
;CHECK-V7-THUMB-BE-NEXT: mov r1, r3
;CHECK-LE-NOT: smlaltb
;CHECK-BE-NOT: smlaltb
;CHECK-V6M-THUMB-NOT: smlaltb
;CHECK-V7M-THUMB-NOT: smlaltb
%conv0 = ashr i32 %t, 16
%conv1= sext i16 %b to i32
%mul = mul nsw i32 %conv0, %conv1
%conv2 = sext i32 %mul to i64
%add = add nsw i64 %conv2, %c
ret i64 %add
}
define i64 @MACLongTest14(i32 %a, i32 %b, i64 %c) {
;CHECK-LABEL: MACLongTest14:
;CHECK-T2-DSP-NOT: {{asr|lsr}}
;CHECK-T2-DSP: smlaltt r2, r3,
;CHECK-T2-DSP-NEXT: mov r0, r2
;CHECK-T2-DSP-NEXT: mov r1, r3
;CHECK-V5TE-NOT: {{asr|lsr}}
;CHECK-V5TE: smlaltt r2, r3,
;CHECK-V5TE-NEXT: mov r0, r2
;CHECK-V5TE-NEXT: mov r1, r3
;CHECK-V7-LE-NOT: {{asr|lsr}}
;CHECK-V7-LE: smlaltt r2, r3,
;CHECK-V7-LE-NEXT: mov r0, r2
;CHECK-V7-LE-NEXT: mov r1, r3
;CHECK-V7-THUMB-BE: smlaltt r3, r2,
;CHECK-V7-THUMB-BE-NEXT: mov r0, r2
;CHECK-V7-THUMB-BE-NEXT: mov r1, r3
;CHECK-LE-NOT: smlaltt
;CHECK-BE-NOT: smlaltt
;CHECK-V6M-THUMB-NOT: smlaltt
;CHECK-V7M-THUMB-NOT: smlaltt
%conv0 = ashr i32 %a, 16
%conv1 = ashr i32 %b, 16
%mul = mul nsw i32 %conv1, %conv0
%conv2 = sext i32 %mul to i64
%add = add nsw i64 %conv2, %c
ret i64 %add
}
@global_b = external global i16, align 2
;CHECK-LABEL: MACLongTest15
;CHECK-T2-DSP-NOT: {{asr|lsr}}
;CHECK-T2-DSP: mov r1, r3
;CHECK-T2-DSP: smlaltb r2, r1, r0, r3
;CHECK-T2-DSP-NEXT: mov r0, r2
;CHECK-V5TE-NOT: {{asr|lsr}}
;CHECK-V5TE: mov r1, r3
;CHECK-V5TE: smlaltb r2, r1, r0, r3
;CHECK-V5TE-NEXT: mov r0, r2
;CHECK-V7-LE-NOT: {{asr|lsr}}
;CHECK-V7-LE: mov r1, r3
;CHECK-V7-LE: smlaltb r2, r1, r0, r3
;CHECK-V7-LE-NEXT: mov r0, r2
;CHECK-V7-THUMB-BE: mov r1, r3
;CHECK-V7-THUMB-BE: smlaltb r1, r2, r0, r3
;CHECK-V7-THUMB-BE-NEXT: mov r0, r2
;CHECK-LE-NOT: smlaltb
;CHECK-BE-NOT: smlaltb
;CHECK-V6M-THUMB-NOT: smlaltb
;CHECK-V7M-THUMB-NOT: smlaltb
define i64 @MACLongTest15(i32 %t, i64 %acc) {
entry:
%0 = load i16, i16* @global_b, align 2
%conv = sext i16 %0 to i32
%shr = ashr i32 %t, 16
%mul = mul nsw i32 %shr, %conv
%conv1 = sext i32 %mul to i64
%add = add nsw i64 %conv1, %acc
ret i64 %add
}
;CHECK-LABEL: MACLongTest16
;CHECK-T2-DSP-NOT: {{asr|lsr}}
;CHECK-T2-DSP: mov r1, r3
;CHECK-T2-DSP: smlalbt r2, r1, r3, r0
;CHECK-T2-DSP-NEXT: mov r0, r2
;CHECK-V5TE-NOT: {{asr|lsr}}
;CHECK-V5TE: mov r1, r3
;CHECK-V5TE: smlalbt r2, r1, r3, r0
;CHECK-V5TE-NEXT: mov r0, r2
;CHECK-V7-LE: mov r1, r3
;CHECK-V7-LE: smlalbt r2, r1, r3, r0
;CHECK-V7-LE-NEXT: mov r0, r2
;CHECK-V7-THUMB-BE: mov r1, r3
;CHECK-V7-THUMB-BE: smlalbt r1, r2, r3, r0
;CHECK-V7-THUMB-BE-NEXT: mov r0, r2
;CHECK-LE-NOT: smlalbt
;CHECK-BE-NOT: smlalbt
;CHECK-V6M-THUMB-NOT: smlalbt
;CHECK-V7M-THUMB-NOT: smlalbt
define i64 @MACLongTest16(i32 %t, i64 %acc) {
entry:
%0 = load i16, i16* @global_b, align 2
%conv = sext i16 %0 to i32
%shr = ashr i32 %t, 16
%mul = mul nsw i32 %conv, %shr
%conv1 = sext i32 %mul to i64
%add = add nsw i64 %conv1, %acc
ret i64 %add
}
|