[TwoAddressInstructionPass] When looking for a 3 addr conversion after commuting...
[oota-llvm.git] / test / CodeGen / MSP430 / AddrMode-bis-xr.ll
1 ; RUN: llc < %s -march=msp430 | FileCheck %s
2 target datalayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:16:16"
3 target triple = "msp430-generic-generic"
4
5 define void @am1(i16* %a, i16 %x) nounwind {
6         %1 = load i16, i16* %a
7         %2 = or i16 %x, %1
8         store i16 %2, i16* %a
9         ret void
10 }
11 ; CHECK-LABEL: am1:
12 ; CHECK:                bis.w   r14, 0(r15)
13
14 @foo = external global i16
15
16 define void @am2(i16 %x) nounwind {
17         %1 = load i16, i16* @foo
18         %2 = or i16 %x, %1
19         store i16 %2, i16* @foo
20         ret void
21 }
22 ; CHECK-LABEL: am2:
23 ; CHECK:                bis.w   r15, &foo
24
25 @bar = external global [2 x i8]
26
27 define void @am3(i16 %i, i8 %x) nounwind {
28         %1 = getelementptr [2 x i8], [2 x i8]* @bar, i16 0, i16 %i
29         %2 = load i8, i8* %1
30         %3 = or i8 %x, %2
31         store i8 %3, i8* %1
32         ret void
33 }
34 ; CHECK-LABEL: am3:
35 ; CHECK:                bis.b   r14, bar(r15)
36
37 define void @am4(i16 %x) nounwind {
38         %1 = load volatile i16, i16* inttoptr(i16 32 to i16*)
39         %2 = or i16 %x, %1
40         store volatile i16 %2, i16* inttoptr(i16 32 to i16*)
41         ret void
42 }
43 ; CHECK-LABEL: am4:
44 ; CHECK:                bis.w   r15, &32
45
46 define void @am5(i16* %a, i16 %x) readonly {
47         %1 = getelementptr inbounds i16, i16* %a, i16 2
48         %2 = load i16, i16* %1
49         %3 = or i16 %x, %2
50         store i16 %3, i16* %1
51         ret void
52 }
53 ; CHECK-LABEL: am5:
54 ; CHECK:                bis.w   r14, 4(r15)
55
56 %S = type { i16, i16 }
57 @baz = common global %S zeroinitializer
58
59 define void @am6(i16 %x) nounwind {
60         %1 = load i16, i16* getelementptr (%S, %S* @baz, i32 0, i32 1)
61         %2 = or i16 %x, %1
62         store i16 %2, i16* getelementptr (%S, %S* @baz, i32 0, i32 1)
63         ret void
64 }
65 ; CHECK-LABEL: am6:
66 ; CHECK:                bis.w   r15, &baz+2
67
68 %T = type { i16, [2 x i8] }
69 @duh = external global %T
70
71 define void @am7(i16 %n, i8 %x) nounwind {
72         %1 = getelementptr %T, %T* @duh, i32 0, i32 1
73         %2 = getelementptr [2 x i8], [2 x i8]* %1, i16 0, i16 %n
74         %3 = load i8, i8* %2
75         %4 = or i8 %x, %3
76         store i8 %4, i8* %2
77         ret void
78 }
79 ; CHECK-LABEL: am7:
80 ; CHECK:                bis.b   r14, duh+2(r15)
81