Add some more Thumb2 multiplication instructions.
[oota-llvm.git] / test / CodeGen / Thumb2 / thumb2-shifter.ll
1 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsl
2 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep lsr
3 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep asr
4 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep ror
5 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | not grep mov
6
7 define i32 @t2ADDrs_lsl(i32 %X, i32 %Y) {
8         %A = shl i32 %Y, 16
9         %B = add i32 %X, %A
10         ret i32 %B
11 }
12
13 define i32 @t2ADDrs_lsr(i32 %X, i32 %Y) {
14         %A = lshr i32 %Y, 16
15         %B = add i32 %X, %A
16         ret i32 %B
17 }
18
19 define i32 @t2ADDrs_asr(i32 %X, i32 %Y) {
20         %A = ashr i32 %Y, 16
21         %B = add i32 %X, %A
22         ret i32 %B
23 }
24
25 ; i32 ror(n) = (x >> n) | (x << (32 - n))
26 define i32 @t2ADDrs_ror(i32 %X, i32 %Y) {
27         %A = lshr i32 %Y, 16
28         %B = shl  i32 %Y, 16
29         %C = or   i32 %B, %A
30         %R = add  i32 %X, %C
31         ret i32 %R
32 }
33
34 define i32 @t2ADDrs_noRegShift(i32 %X, i32 %Y, i8 %sh) {
35         %shift.upgrd.1 = zext i8 %sh to i32
36         %A = shl i32 %Y, %shift.upgrd.1
37         %B = add i32 %X, %A
38         ret i32 %B
39 }
40