• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-mc -triple msp430 -show-encoding %s \
2; RUN:     | FileCheck -check-prefixes=CHECK,CHECK-INST %s
3
4; RUN: llvm-mc -triple msp430 -filetype=obj %s \
5; RUN:     | llvm-objdump -d - | FileCheck --check-prefix=CHECK-INST %s
6
7  ;; IForm8 instructions
8  mov.b  r7, r8 ; CHECK-INST: mov.b  r7, r8
9                ; CHECK: encoding: [0x48,0x47]
10  add.b  r7, r8 ; CHECK-INST: add.b  r7, r8
11                ; CHECK: encoding: [0x48,0x57]
12  addc.b r7, r8 ; CHECK-INST: addc.b r7, r8
13                ; CHECK: encoding: [0x48,0x67]
14  subc.b r7, r8 ; CHECK-INST: subc.b r7, r8
15                ; CHECK: encoding: [0x48,0x77]
16  sub.b  r7, r8 ; CHECK-INST: sub.b  r7, r8
17                ; CHECK: encoding: [0x48,0x87]
18  cmp.b  r7, r8 ; CHECK-INST: cmp.b  r7, r8
19                ; CHECK: encoding: [0x48,0x97]
20  dadd.b r7, r8 ; CHECK-INST: dadd.b r7, r8
21                ; CHECK: encoding: [0x48,0xa7]
22  bit.b  r7, r8 ; CHECK-INST: bit.b  r7, r8
23                ; CHECK: encoding: [0x48,0xb7]
24  bic.b  r7, r8 ; CHECK-INST: bic.b  r7, r8
25                ; CHECK: encoding: [0x48,0xc7]
26  bis.b  r7, r8 ; CHECK-INST: bis.b  r7, r8
27                ; CHECK: encoding: [0x48,0xd7]
28  xor.b  r7, r8 ; CHECK-INST: xor.b  r7, r8
29                ; CHECK: encoding: [0x48,0xe7]
30  and.b  r7, r8 ; CHECK-INST: and.b  r7, r8
31                ; CHECK: encoding: [0x48,0xf7]
32
33  ;; IForm16 instructions
34  mov    r7, r8 ; CHECK-INST: mov    r7, r8
35                ; CHECK: encoding: [0x08,0x47]
36  add    r7, r8 ; CHECK-INST: add    r7, r8
37                ; CHECK: encoding: [0x08,0x57]
38  addc   r7, r8 ; CHECK-INST: addc   r7, r8
39                ; CHECK: encoding: [0x08,0x67]
40  subc   r7, r8 ; CHECK-INST: subc   r7, r8
41                ; CHECK: encoding: [0x08,0x77]
42  sub    r7, r8 ; CHECK-INST: sub    r7, r8
43                ; CHECK: encoding: [0x08,0x87]
44  cmp    r7, r8 ; CHECK-INST: cmp    r7, r8
45                ; CHECK: encoding: [0x08,0x97]
46  dadd   r7, r8 ; CHECK-INST: dadd   r7, r8
47                ; CHECK: encoding: [0x08,0xa7]
48  bit    r7, r8 ; CHECK-INST: bit    r7, r8
49                ; CHECK: encoding: [0x08,0xb7]
50  bic    r7, r8 ; CHECK-INST: bic    r7, r8
51                ; CHECK: encoding: [0x08,0xc7]
52  bis    r7, r8 ; CHECK-INST: bis    r7, r8
53                ; CHECK: encoding: [0x08,0xd7]
54  xor    r7, r8 ; CHECK-INST: xor    r7, r8
55                ; CHECK: encoding: [0x08,0xe7]
56  and    r7, r8 ; CHECK-INST: and    r7, r8
57                ; CHECK: encoding: [0x08,0xf7]
58
59  ;; IIForm8 instructions
60  rrc.b  r7     ; CHECK-INST: rrc.b  r7
61                ; CHECK: encoding: [0x47,0x10]
62  rra.b  r7     ; CHECK-INST: rra.b  r7
63                ; CHECK: encoding: [0x47,0x11]
64  push.b r7     ; CHECK-INST: push.b r7
65                ; CHECK: encoding: [0x47,0x12]
66
67  ;; IIForm16 instructions
68  rrc    r7     ; CHECK-INST: rrc    r7
69                ; CHECK: encoding: [0x07,0x10]
70  swpb   r7     ; CHECK-INST: swpb   r7
71                ; CHECK: encoding: [0x87,0x10]
72  rra    r7     ; CHECK-INST: rra    r7
73                ; CHECK: encoding: [0x07,0x11]
74  sxt    r7     ; CHECK-INST: sxt    r7
75                ; CHECK: encoding: [0x87,0x11]
76  push   r7     ; CHECK-INST: push   r7
77                ; CHECK: encoding: [0x07,0x12]
78  call   r7     ; CHECK-INST: call   r7
79                ; CHECK: encoding: [0x87,0x12]
80  reti          ; CHECK-INST: reti
81                ; CHECK: encoding: [0x00,0x13]
82
83  ;; CJForm instructions
84  jnz    -2     ; CHECK-INST: jne    $-2
85                ; CHECK: encoding: [0xfe,0x23]
86  jne    -2     ; CHECK-INST: jne    $-2
87                ; CHECK: encoding: [0xfe,0x23]
88  jeq    -2     ; CHECK-INST: jeq    $-2
89                ; CHECK: encoding: [0xfe,0x27]
90  jz     -2     ; CHECK-INST: jeq    $-2
91                ; CHECK: encoding: [0xfe,0x27]
92  jnc    -2     ; CHECK-INST: jlo    $-2
93                ; CHECK: encoding: [0xfe,0x2b]
94  jlo    -2     ; CHECK-INST: jlo    $-2
95                ; CHECK: encoding: [0xfe,0x2b]
96  jc     -2     ; CHECK-INST: jhs    $-2
97                ; CHECK: encoding: [0xfe,0x2f]
98  jhs    -2     ; CHECK-INST: jhs    $-2
99                ; CHECK: encoding: [0xfe,0x2f]
100  jn     -2     ; CHECK-INST: jn     $-2
101                ; CHECK: encoding: [0xfe,0x33]
102  jge    -2     ; CHECK-INST: jge    $-2
103                ; CHECK: encoding: [0xfe,0x37]
104  jl     -2     ; CHECK-INST: jl     $-2
105                ; CHECK: encoding: [0xfe,0x3b]
106  jmp    $-2    ; CHECK-INST: jmp    $-2
107                ; CHECK: encoding: [0xfe,0x3f]
108
109  ;; Emulated arithmetic instructions
110  adc    r7     ; CHECK-INST: adc    r7
111                ; CHECK: encoding: [0x07,0x63]
112  dadc   r7     ; CHECK-INST: dadc   r7
113                ; CHECK: encoding: [0x07,0xa3]
114  dec    r7     ; CHECK-INST: dec    r7
115                ; CHECK: encoding: [0x17,0x83]
116  decd   r7     ; CHECK-INST: decd   r7
117                ; CHECK: encoding: [0x27,0x83]
118  inc    r7     ; CHECK-INST: inc    r7
119                ; CHECK: encoding: [0x17,0x53]
120  incd   r7     ; CHECK-INST: incd   r7
121                ; CHECK: encoding: [0x27,0x53]
122  sbc    r7     ; CHECK-INST: sbc    r7
123                ; CHECK: encoding: [0x07,0x73]
124
125  ;; Emulated logical instructions
126  inv    r7     ; CHECK-INST: inv    r7
127                ; CHECK: encoding: [0x37,0xe3]
128  rla    r7     ; CHECK-INST: add    r7, r7
129                ; CHECK: encoding: [0x07,0x57]
130  rlc    r7     ; CHECK-INST: addc   r7, r7
131                ; CHECK: encoding: [0x07,0x67]
132
133  ;; Emulated program flow control instructions
134  br     r7     ; CHECK-INST: br     r7
135                ; CHECK: encoding: [0x00,0x47]
136  dint          ; CHECK-INST: dint
137                ; CHECK: encoding: [0x32,0xc2]
138  eint          ; CHECK-INST: eint
139                ; CHECK: encoding: [0x32,0xd2]
140  nop           ; CHECK-INST: nop
141                ; CHECK: encoding: [0x03,0x43]
142  ret           ; CHECK-INST: ret
143                ; CHECK: encoding: [0x30,0x41]
144
145  ;; Emulated data instruction
146  clr    r7     ; CHECK-INST: clr    r7
147                ; CHECK: encoding: [0x07,0x43]
148  clrc          ; CHECK-INST: clrc
149                ; CHECK: encoding: [0x12,0xc3]
150  clrn          ; CHECK-INST: clrn
151                ; CHECK: encoding: [0x22,0xc2]
152  clrz          ; CHECK-INST: clrz
153                ; CHECK: encoding: [0x22,0xc3]
154  pop    r7     ; CHECK-INST: pop    r7
155                ; CHECK: encoding: [0x37,0x41]
156  setc          ; CHECK-INST: setc
157                ; CHECK: encoding: [0x12,0xd3]
158  setn          ; CHECK-INST: setn
159                ; CHECK: encoding: [0x22,0xd2]
160  setz          ; CHECK-INST: setz
161                ; CHECK: encoding: [0x22,0xd3]
162  tst    r7     ; CHECK-INST: tst    r7
163                ; CHECK: encoding: [0x07,0x93]
164