• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-mc -triple msp430 -show-encoding < %s | FileCheck %s
2
3foo:
4  mov r8, r15
5  mov disp+2(r8), r15
6  mov disp+2, r15
7  mov &disp+2, r15
8  mov @r8, r15
9  mov @r8+, r15
10  mov #disp+2, r15
11
12; CHECK: mov r8, r15           ; encoding: [0x0f,0x48]
13; CHECK: mov disp+2(r8), r15   ; encoding: [0x1f,0x48,A,A]
14; CHECK: mov disp+2, r15       ; encoding: [0x1f,0x40,A,A]
15; CHECK: mov &disp+2, r15      ; encoding: [0x1f,0x42,A,A]
16; CHECK: mov @r8, r15          ; encoding: [0x2f,0x48]
17; CHECK: mov @r8+, r15         ; encoding: [0x3f,0x48]
18; CHECK: mov #disp+2, r15      ; encoding: [0x3f,0x40,A,A]
19
20  mov #42, r15
21  mov #42, 12(r15)
22  mov #42, &disp
23  mov disp, disp+2
24  mov r7, @r15
25
26; CHECK: mov #42, r15          ; encoding: [0x3f,0x40,0x2a,0x00]
27; CHECK: mov #42, 12(r15)      ; encoding: [0xbf,0x40,0x2a,0x00,0x0c,0x00]
28; CHECK: mov #42, &disp        ; encoding: [0xb2,0x40,0x2a,0x00,A,A]
29; CHECK: mov disp, disp+2      ; encoding: [0x90,0x40,A,A,B,B]
30; CHECK: mov r7, 0(r15)        ; encoding: [0x8f,0x47,0x00,0x00]
31
32  add r7, r8
33  add 6(r7), r8
34  add &disp, r8
35  add disp, r8
36  add @r9, r8
37  add @r9+, r8
38  add #42, r8
39
40; CHECK: add r7, r8            ; encoding: [0x08,0x57]
41; CHECK: add 6(r7), r8         ; encoding: [0x18,0x57,0x06,0x00]
42; CHECK: add &disp, r8         ; encoding: [0x18,0x52,A,A]
43; CHECK: add disp, r8          ; encoding: [0x18,0x50,A,A]
44; CHECK: add @r9, r8           ; encoding: [0x28,0x59]
45; CHECK: add @r9+, r8          ; encoding: [0x38,0x59]
46; CHECK: add #42, r8           ; encoding: [0x38,0x50,0x2a,0x00]
47
48  add r7, 6(r5)
49  add 6(r7), 6(r5)
50  add &disp, 6(r5)
51  add disp, 6(r5)
52  add @r9, 6(r5)
53  add @r9+, 6(r5)
54  add #42, 6(r5)
55
56; CHECK: add r7, 6(r5)         ; encoding: [0x85,0x57,0x06,0x00]
57; CHECK: add 6(r7), 6(r5)      ; encoding: [0x95,0x57,0x06,0x00,0x06,0x00]
58; CHECK: add &disp, 6(r5)      ; encoding: [0x95,0x52,A,A,0x06,0x00]
59; CHECK: add disp, 6(r5)       ; encoding: [0x95,0x50,A,A,0x06,0x00]
60; CHECK: add @r9, 6(r5)        ; encoding: [0xa5,0x59,0x06,0x00]
61; CHECK: add @r9+, 6(r5)       ; encoding: [0xb5,0x59,0x06,0x00]
62; CHECK: add #42, 6(r5)        ; encoding: [0xb5,0x50,0x2a,0x00,0x06,0x00]
63
64  add r7, &disp
65  add 6(r7), &disp
66  add &disp, &disp
67  add disp, &disp
68  add @r9, &disp
69  add @r9+, &disp
70  add #42, &disp
71
72; CHECK: add r7, &disp         ; encoding: [0x82,0x57,A,A]
73; CHECK: add 6(r7), &disp      ; encoding: [0x92,0x57,0x06,0x00,A,A]
74; CHECK: add &disp, &disp      ; encoding: [0x92,0x52,A,A,B,B]
75; CHECK: add disp, &disp       ; encoding: [0x92,0x50,A,A,B,B]
76; CHECK: add @r9, &disp        ; encoding: [0xa2,0x59,A,A]
77; CHECK: add @r9+, &disp       ; encoding: [0xb2,0x59,A,A]
78; CHECK: add #42, &disp        ; encoding: [0xb2,0x50,0x2a,0x00,A,A]
79
80  add r7, disp
81  add 6(r7), disp
82  add &disp, disp
83  add disp, disp
84  add @r9, disp
85  add @r9+, disp
86  add #42, disp
87
88; CHECK: add r7, disp          ; encoding: [0x80,0x57,A,A]
89; CHECK: add 6(r7), disp       ; encoding: [0x90,0x57,0x06,0x00,A,A]
90; CHECK: add &disp, disp       ; encoding: [0x90,0x52,A,A,B,B]
91; CHECK: add disp, disp        ; encoding: [0x90,0x50,A,A,B,B]
92; CHECK: add @r9, disp         ; encoding: [0xa0,0x59,A,A]
93; CHECK: add @r9+, disp        ; encoding: [0xb0,0x59,A,A]
94; CHECK: add #42, disp         ; encoding: [0xb0,0x50,0x2a,0x00,A,A]
95
96  call r7
97  call 6(r7)
98  call @r7
99  call @r7+
100  call disp+6(r7)
101  call &disp
102  call disp
103  call #disp
104
105; CHECK: call r7               ; encoding: [0x87,0x12]
106; CHECK: call 6(r7)            ; encoding: [0x97,0x12,0x06,0x00]
107; CHECK: call @r7              ; encoding: [0xa7,0x12]
108; CHECK: call @r7+             ; encoding: [0xb7,0x12]
109; CHECK: call disp+6(r7)       ; encoding: [0x97,0x12,A,A]
110; CHECK: call &disp            ; encoding: [0x92,0x12,A,A]
111; CHECK: call disp             ; encoding: [0x90,0x12,A,A]
112; CHECK: call #disp            ; encoding: [0xb0,0x12,A,A]
113
114  rra r7      ; CHECK: rra r7                ; encoding: [0x07,0x11]
115  rra 2(r7)   ; CHECK: rra 2(r7)             ; encoding: [0x17,0x11,0x02,0x00]
116  rra @r7     ; CHECK: rra @r7               ; encoding: [0x27,0x11]
117  rra @r7+    ; CHECK: rra @r7+              ; encoding: [0x37,0x11]
118
119  rrc r7      ; CHECK: rrc r7                ; encoding: [0x07,0x10]
120  rrc 2(r7)   ; CHECK: rrc 2(r7)             ; encoding: [0x17,0x10,0x02,0x00]
121  rrc @r7     ; CHECK: rrc @r7               ; encoding: [0x27,0x10]
122  rrc @r7+    ; CHECK: rrc @r7+              ; encoding: [0x37,0x10]
123
124  swpb r7     ; CHECK: swpb r7               ; encoding: [0x87,0x10]
125  swpb 2(r7)  ; CHECK: swpb 2(r7)            ; encoding: [0x97,0x10,0x02,0x00]
126  swpb @r7    ; CHECK: swpb @r7              ; encoding: [0xa7,0x10]
127  swpb @r7+   ; CHECK: swpb @r7+             ; encoding: [0xb7,0x10]
128
129  sxt r7      ; CHECK: sxt r7                ; encoding: [0x87,0x11]
130  sxt 2(r7)   ; CHECK: sxt 2(r7)             ; encoding: [0x97,0x11,0x02,0x00]
131  sxt @r7     ; CHECK: sxt @r7               ; encoding: [0xa7,0x11]
132  sxt @r7+    ; CHECK: sxt @r7+              ; encoding: [0xb7,0x11]
133
134  cmp r5, r7        ; CHECK: cmp r5, r7        ; encoding: [0x07,0x95]
135  cmp 2(r5), r7     ; CHECK: cmp 2(r5), r7     ; encoding: [0x17,0x95,0x02,0x00]
136  cmp #-1, r7       ; CHECK: cmp #-1, r7       ; encoding: [0x37,0x93]
137  cmp #42, r7       ; CHECK: cmp #42, r7       ; encoding: [0x37,0x90,0x2a,0x00]
138  cmp @r5, r7       ; CHECK: cmp @r5, r7       ; encoding: [0x27,0x95]
139  cmp @r5+, r7      ; CHECK: cmp @r5+, r7      ; encoding: [0x37,0x95]
140
141  cmp r5, 2(r7)     ; CHECK: cmp r5, 2(r7)     ; encoding: [0x87,0x95,0x02,0x00]
142  cmp 2(r7), 2(r7)  ; CHECK: cmp 2(r7), 2(r7)  ; encoding: [0x97,0x97,0x02,0x00,0x02,0x00]
143  cmp #-1, 2(r7)    ; CHECK: cmp #-1, 2(r7)    ; encoding: [0xb7,0x93,0x02,0x00]
144  cmp #42, 2(r7)    ; CHECK: cmp #42, 2(r7)    ; encoding: [0xb7,0x90,0x2a,0x00,0x02,0x00]
145  cmp @r5, 2(r7)    ; CHECK: cmp @r5, 2(r7)    ; encoding: [0xa7,0x95,0x02,0x00]
146  cmp @r5+, 2(r7)   ; CHECK: cmp @r5+, 2(r7)   ; encoding: [0xb7,0x95,0x02,0x00]
147
148  bit r5, r7        ; CHECK: bit r5, r7        ; encoding: [0x07,0xb5]
149  bit 2(r5), r7     ; CHECK: bit 2(r5), r7     ; encoding: [0x17,0xb5,0x02,0x00]
150  bit #-1, r7       ; CHECK: bit #-1, r7       ; encoding: [0x37,0xb3]
151  bit #42, r7       ; CHECK: bit #42, r7       ; encoding: [0x37,0xb0,0x2a,0x00]
152  bit @r5, r7       ; CHECK: bit @r5, r7       ; encoding: [0x27,0xb5]
153  bit @r5+, r7      ; CHECK: bit @r5+, r7      ; encoding: [0x37,0xb5]
154
155  bit r5, 2(r7)     ; CHECK: bit r5, 2(r7)     ; encoding: [0x87,0xb5,0x02,0x00]
156  bit 2(r7), 2(r7)  ; CHECK: bit 2(r7), 2(r7)  ; encoding: [0x97,0xb7,0x02,0x00,0x02,0x00]
157  bit #-1, 2(r7)    ; CHECK: bit #-1, 2(r7)    ; encoding: [0xb7,0xb3,0x02,0x00]
158  bit #42, 2(r7)    ; CHECK: bit #42, 2(r7)    ; encoding: [0xb7,0xb0,0x2a,0x00,0x02,0x00]
159  bit @r5, 2(r7)    ; CHECK: bit @r5, 2(r7)    ; encoding: [0xa7,0xb5,0x02,0x00]
160  bit @r5+, 2(r7)   ; CHECK: bit @r5+, 2(r7)   ; encoding: [0xb7,0xb5,0x02,0x00]
161
162disp:
163  .word 0xcafe
164  .word 0xbabe
165