Add a thumb2 pass to insert IT blocks.
[oota-llvm.git] / test / CodeGen / Thumb2 / thumb2-mov2.ll
1 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep movt | grep #1234
2 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep movt | grep #1234
3 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep movt | grep #1234
4 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep movt | grep #1234
5 ; RUN: llvm-as < %s | llc -march=thumb -mattr=+thumb2 | grep mov  | grep movt
6
7 define i32 @t2MOVTi16_ok_1(i32 %a) {
8     %1 = and i32 %a, 65535
9     %2 = shl i32 1234, 16
10     %3 = or  i32 %1, %2
11
12     ret i32 %3
13 }
14
15 define i32 @t2MOVTi16_test_1(i32 %a) {
16     %1 = shl i32  255,   8
17     %2 = shl i32 1234,   8
18     %3 = or  i32   %1, 255  ; This give us 0xFFFF in %3
19     %4 = shl i32   %2,   8  ; This gives us (1234 << 16) in %4
20     %5 = and i32   %a,  %3
21     %6 = or  i32   %4,  %5
22
23     ret i32 %6
24 }
25
26 define i32 @t2MOVTi16_test_2(i32 %a) {
27     %1 = shl i32  255,   8
28     %2 = shl i32 1234,   8
29     %3 = or  i32   %1, 255  ; This give us 0xFFFF in %3
30     %4 = shl i32   %2,   6
31     %5 = and i32   %a,  %3
32     %6 = shl i32   %4,   2  ; This gives us (1234 << 16) in %6
33     %7 = or  i32   %5,  %6
34
35     ret i32 %7
36 }
37
38 define i32 @t2MOVTi16_test_3(i32 %a) {
39     %1 = shl i32  255,   8
40     %2 = shl i32 1234,   8
41     %3 = or  i32   %1, 255  ; This give us 0xFFFF in %3
42     %4 = shl i32   %2,   6
43     %5 = and i32   %a,  %3
44     %6 = shl i32   %4,   2  ; This gives us (1234 << 16) in %6
45     %7 = lshr i32  %6,   6
46     %8 = shl i32   %7,   6
47     %9 = or  i32   %5,  %8
48
49     ret i32 %9
50 }
51
52 define i32 @t2MOVTi16_test_nomatch_1(i32 %a) {
53     %1 = shl i32  255,   8
54     %2 = shl i32 1234,   8
55     %3 = or  i32   %1, 255  ; This give us 0xFFFF in %3
56     %4 = shl i32   %2,   6
57     %5 = and i32   %a,  %3
58     %6 = shl i32   %4,   2  ; This gives us (1234 << 16) in %6
59     %7 = lshr i32  %6,   3
60     %8 = or  i32   %5,  %7
61
62     ret i32 %8
63 }
64
65