1# RUN: llvm-mc  %s -triple=mipsel-unknown-linux -mcpu=mips32r2 -show-encoding | FileCheck %s
2
3
4  .text
5text_label:
6
7  add $4, -0x80000000
8# CHECK: lui    $1, 32768               # encoding: [0x00,0x80,0x01,0x3c]
9# CHECK: add    $4, $4, $1              # encoding: [0x20,0x20,0x81,0x00]
10  add $4, -0x8001
11# CHECK: lui    $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
12# CHECK: ori    $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
13# CHECK: add    $4, $4, $1              # encoding: [0x20,0x20,0x81,0x00]
14  add $4, -0x8000
15# CHECK: addi   $4, $4, -32768          # encoding: [0x00,0x80,0x84,0x20]
16  add $4, 0
17# CHECK: addi   $4, $4, 0               # encoding: [0x00,0x00,0x84,0x20]
18  add $4, 0xFFFF
19# CHECK: ori    $1, $zero, 65535        # encoding: [0xff,0xff,0x01,0x34]
20# CHECK: add    $4, $4, $1              # encoding: [0x20,0x20,0x81,0x00]
21  add $4, 0x10000
22# CHECK: lui    $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
23# CHECK: add    $4, $4, $1              # encoding: [0x20,0x20,0x81,0x00]
24  add $4, 0xFFFFFFFF
25# CHECK: addi   $4, $4, -1              # encoding: [0xff,0xff,0x84,0x20]
26
27  add $4, $5, -0x80000000
28# CHECK: lui    $4, 32768               # encoding: [0x00,0x80,0x04,0x3c]
29# CHECK: add    $4, $4, $5              # encoding: [0x20,0x20,0x85,0x00]
30  add $4, $5, -0x8001
31# CHECK: lui    $4, 65535               # encoding: [0xff,0xff,0x04,0x3c]
32# CHECK: ori    $4, $4, 32767           # encoding: [0xff,0x7f,0x84,0x34]
33# CHECK: add    $4, $4, $5              # encoding: [0x20,0x20,0x85,0x00]
34  add $4, $5, -0x8000
35# CHECK: addi   $4, $5, -32768          # encoding: [0x00,0x80,0xa4,0x20]
36  add $4, $5, 0
37# CHECK: addi   $4, $5, 0               # encoding: [0x00,0x00,0xa4,0x20]
38  add $4, $5, 0xFFFF
39# CHECK: ori    $4, $zero, 65535        # encoding: [0xff,0xff,0x04,0x34]
40# CHECK: add    $4, $4, $5              # encoding: [0x20,0x20,0x85,0x00]
41  add $4, $5, 0x10000
42# CHECK: lui    $4, 1                   # encoding: [0x01,0x00,0x04,0x3c]
43# CHECK: add    $4, $4, $5              # encoding: [0x20,0x20,0x85,0x00]
44  add $4, $5, 0xFFFFFFFF
45# CHECK: addi   $4, $5, -1              # encoding: [0xff,0xff,0xa4,0x20]
46
47  addu $4, -0x80000000
48# CHECK: lui    $1, 32768               # encoding: [0x00,0x80,0x01,0x3c]
49# CHECK: addu   $4, $4, $1              # encoding: [0x21,0x20,0x81,0x00]
50  addu $4, -0x8001
51# CHECK: lui    $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
52# CHECK: ori    $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
53# CHECK: addu   $4, $4, $1              # encoding: [0x21,0x20,0x81,0x00]
54  addu $4, -0x8000
55# CHECK: addiu  $4, $4, -32768          # encoding: [0x00,0x80,0x84,0x24]
56  addu $4, 0
57# CHECK: addiu  $4, $4, 0               # encoding: [0x00,0x00,0x84,0x24]
58  addu $4, 0xFFFF
59# CHECK: ori    $1, $zero, 65535        # encoding: [0xff,0xff,0x01,0x34]
60# CHECK: addu   $4, $4, $1              # encoding: [0x21,0x20,0x81,0x00]
61  addu $4, 0x10000
62# CHECK: lui    $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
63# CHECK: addu   $4, $4, $1              # encoding: [0x21,0x20,0x81,0x00]
64  addu $4, 0xFFFFFFFF
65# CHECK: addiu  $4, $4, -1              # encoding: [0xff,0xff,0x84,0x24]
66
67  addu $4, $5, -0x80000000
68# CHECK: lui    $4, 32768               # encoding: [0x00,0x80,0x04,0x3c]
69# CHECK: addu   $4, $4, $5              # encoding: [0x21,0x20,0x85,0x00]
70  addu $4, $5, -0x8001
71# CHECK: lui    $4, 65535               # encoding: [0xff,0xff,0x04,0x3c]
72# CHECK: ori    $4, $4, 32767           # encoding: [0xff,0x7f,0x84,0x34]
73# CHECK: addu   $4, $4, $5              # encoding: [0x21,0x20,0x85,0x00]
74  addu $4, $5, -0x8000
75# CHECK: addiu  $4, $5, -32768          # encoding: [0x00,0x80,0xa4,0x24]
76  addu $4, $5, 0
77# CHECK: addiu  $4, $5, 0               # encoding: [0x00,0x00,0xa4,0x24]
78  addu $4, $5, 0xFFFF
79# CHECK: ori    $4, $zero, 65535        # encoding: [0xff,0xff,0x04,0x34]
80# CHECK: addu   $4, $4, $5              # encoding: [0x21,0x20,0x85,0x00]
81  addu $4, $5, 0x10000
82# CHECK: lui    $4, 1                   # encoding: [0x01,0x00,0x04,0x3c]
83# CHECK: addu   $4, $4, $5              # encoding: [0x21,0x20,0x85,0x00]
84  addu $4, $5, 0xFFFFFFFF
85# CHECK: addiu  $4, $5, -1              # encoding: [0xff,0xff,0xa4,0x24]
86
87  and $4, -0x80000000
88# CHECK: lui    $1, 32768               # encoding: [0x00,0x80,0x01,0x3c]
89# CHECK: and    $4, $4, $1              # encoding: [0x24,0x20,0x81,0x00]
90  and $4, -0x8001
91# CHECK: lui    $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
92# CHECK: ori    $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
93# CHECK: and    $4, $4, $1              # encoding: [0x24,0x20,0x81,0x00]
94  and $4, -0x8000
95# CHECK: addiu  $1, $zero, -32768       # encoding: [0x00,0x80,0x01,0x24]
96  and $4, 0
97# CHECK: andi   $4, $4, 0               # encoding: [0x00,0x00,0x84,0x30]
98  and $4, 0xFFFF
99# CHECK: andi   $4, $4, 65535           # encoding: [0xff,0xff,0x84,0x30]
100  and $4, 0x10000
101# CHECK: lui    $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
102# CHECK: and    $4, $4, $1              # encoding: [0x24,0x20,0x81,0x00]
103  and $4, 0xFFFFFFFF
104# CHECK: addiu  $1, $zero, -1           # encoding: [0xff,0xff,0x01,0x24]
105# CHECK: and    $4, $4, $1              # encoding: [0x24,0x20,0x81,0x00]
106
107  and $4, $5, -0x80000000
108# CHECK: lui    $4, 32768               # encoding: [0x00,0x80,0x04,0x3c]
109# CHECK: and    $4, $4, $5              # encoding: [0x24,0x20,0x85,0x00]
110  and $4, $5, -0x8001
111# CHECK: lui    $4, 65535               # encoding: [0xff,0xff,0x04,0x3c]
112# CHECK: ori    $4, $4, 32767           # encoding: [0xff,0x7f,0x84,0x34]
113# CHECK: and    $4, $4, $5              # encoding: [0x24,0x20,0x85,0x00]
114  and $4, $5, -0x8000
115# CHECK: addiu  $4, $zero, -32768       # encoding: [0x00,0x80,0x04,0x24]
116# CHECK: and    $4, $4, $5              # encoding: [0x24,0x20,0x85,0x00]
117  and $4, $5, 0
118# CHECK: andi   $4, $5, 0               # encoding: [0x00,0x00,0xa4,0x30]
119  and $4, $5, 0xFFFF
120# CHECK: andi   $4, $5, 65535           # encoding: [0xff,0xff,0xa4,0x30]
121  and $4, $5, 0x10000
122# CHECK: lui    $4, 1                   # encoding: [0x01,0x00,0x04,0x3c]
123# CHECK: and    $4, $4, $5              # encoding: [0x24,0x20,0x85,0x00]
124  and $4, $5, 0xFFFFFFFF
125# CHECK: addiu  $4, $zero, -1           # encoding: [0xff,0xff,0x04,0x24]
126# CHECK: and    $4, $4, $5              # encoding: [0x24,0x20,0x85,0x00]
127
128  nor $4, $5, 0
129# CHECK: addiu  $4, $zero, 0            # encoding: [0x00,0x00,0x04,0x24]
130# CHECK: nor    $4, $4, $5              # encoding: [0x27,0x20,0x85,0x00]
131  nor $4, $5, 1
132# CHECK: addiu  $4, $zero, 1            # encoding: [0x01,0x00,0x04,0x24]
133# CHECK: nor    $4, $4, $5              # encoding: [0x27,0x20,0x85,0x00]
134  nor $4, $5, 0x8000
135# CHECK: ori    $4, $zero, 32768        # encoding: [0x00,0x80,0x04,0x34]
136# CHECK: nor    $4, $4, $5              # encoding: [0x27,0x20,0x85,0x00]
137  nor $4, $5, -0x8000
138# CHECK: addiu  $4, $zero, -32768       # encoding: [0x00,0x80,0x04,0x24]
139# CHECK: nor    $4, $4, $5              # encoding: [0x27,0x20,0x85,0x00]
140  nor $4, $5, 0x10000
141# CHECK: lui    $4, 1                   # encoding: [0x01,0x00,0x04,0x3c]
142# CHECK: nor    $4, $4, $5              # encoding: [0x27,0x20,0x85,0x00]
143  nor $4, $5, 0x1a5a5
144# CHECK: lui    $4, 1                   # encoding: [0x01,0x00,0x04,0x3c]
145# CHECK: ori    $4, $4, 42405           # encoding: [0xa5,0xa5,0x84,0x34]
146# CHECK: nor    $4, $4, $5              # encoding: [0x27,0x20,0x85,0x00]
147
148  or $4, -0x80000000
149# CHECK: lui    $1, 32768               # encoding: [0x00,0x80,0x01,0x3c]
150# CHECK: or     $4, $4, $1              # encoding: [0x25,0x20,0x81,0x00]
151  or $4, -0x8001
152# CHECK: lui    $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
153# CHECK: ori    $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
154# CHECK: or     $4, $4, $1              # encoding: [0x25,0x20,0x81,0x00]
155  or $4, -0x8000
156# CHECK: addiu  $1, $zero, -32768       # encoding: [0x00,0x80,0x01,0x24]
157# CHECK: or     $4, $4, $1              # encoding: [0x25,0x20,0x81,0x00]
158  or $4, 0
159# CHECK: ori    $4, $4, 0               # encoding: [0x00,0x00,0x84,0x34]
160  or $4, 0xFFFF
161# CHECK: ori    $4, $4, 65535           # encoding: [0xff,0xff,0x84,0x34]
162  or $4, 0x10000
163# CHECK: lui    $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
164# CHECK: or     $4, $4, $1              # encoding: [0x25,0x20,0x81,0x00]
165  or $4, 0xFFFFFFFF
166# CHECK: addiu  $1, $zero, -1           # encoding: [0xff,0xff,0x01,0x24]
167# CHECK: or     $4, $4, $1              # encoding: [0x25,0x20,0x81,0x00]
168
169  or $4, $5, -0x80000000
170# CHECK: lui    $4, 32768               # encoding: [0x00,0x80,0x04,0x3c]
171# CHECK: or     $4, $4, $5              # encoding: [0x25,0x20,0x85,0x00]
172  or $4, $5, -0x8001
173# CHECK: lui    $4, 65535               # encoding: [0xff,0xff,0x04,0x3c]
174# CHECK: ori    $4, $4, 32767           # encoding: [0xff,0x7f,0x84,0x34]
175# CHECK: or     $4, $4, $5              # encoding: [0x25,0x20,0x85,0x00]
176  or $4, $5, -0x8000
177# CHECK: addiu  $4, $zero, -32768       # encoding: [0x00,0x80,0x04,0x24]
178# CHECK: or     $4, $4, $5              # encoding: [0x25,0x20,0x85,0x00]
179  or $4, $5, 0
180# CHECK: ori    $4, $5, 0               # encoding: [0x00,0x00,0xa4,0x34]
181  or $4, $5, 0xFFFF
182# CHECK: ori    $4, $5, 65535           # encoding: [0xff,0xff,0xa4,0x34]
183  or $4, $5, 0x10000
184# CHECK: lui    $4, 1                   # encoding: [0x01,0x00,0x04,0x3c]
185# CHECK: or     $4, $4, $5              # encoding: [0x25,0x20,0x85,0x00]
186  or $4, $5, 0xFFFFFFFF
187# CHECK: addiu  $4, $zero, -1           # encoding: [0xff,0xff,0x04,0x24]
188# CHECK: or     $4, $4, $5              # encoding: [0x25,0x20,0x85,0x00]
189
190  slt $4, $5, -0x80000000
191# CHECK: lui    $4, 32768               # encoding: [0x00,0x80,0x04,0x3c]
192# CHECK: slt    $4, $4, $5              # encoding: [0x2a,0x20,0x85,0x00]
193  slt $4, $5, -0x8001
194# CHECK: lui    $4, 65535               # encoding: [0xff,0xff,0x04,0x3c]
195# CHECK: ori    $4, $4, 32767           # encoding: [0xff,0x7f,0x84,0x34]
196# CHECK: slt    $4, $4, $5              # encoding: [0x2a,0x20,0x85,0x00]
197  slt $4, $5, -0x8000
198# CHECK: slti   $4, $5, -32768          # encoding: [0x00,0x80,0xa4,0x28]
199  slt $4, $5, 0
200# CHECK: slti   $4, $5, 0               # encoding: [0x00,0x00,0xa4,0x28]
201  slt $4, $5, 0xFFFF
202# CHECK: ori    $4, $zero, 65535        # encoding: [0xff,0xff,0x04,0x34]
203  slt $4, $5, 0x10000
204# CHECK: lui    $4, 1                   # encoding: [0x01,0x00,0x04,0x3c]
205# CHECK: slt    $4, $4, $5              # encoding: [0x2a,0x20,0x85,0x00]
206  slt $4, $5, 0xFFFFFFFF
207# CHECK: slti   $4, $5, -1              # encoding: [0xff,0xff,0xa4,0x28]
208
209  sltu $4, $5, -0x80000000
210# CHECK: lui    $4, 32768               # encoding: [0x00,0x80,0x04,0x3c]
211# CHECK: sltu   $4, $4, $5              # encoding: [0x2b,0x20,0x85,0x00]
212  sltu $4, $5, -0x8001
213# CHECK: lui    $4, 65535               # encoding: [0xff,0xff,0x04,0x3c]
214# CHECK: ori    $4, $4, 32767           # encoding: [0xff,0x7f,0x84,0x34]
215# CHECK: sltu   $4, $4, $5              # encoding: [0x2b,0x20,0x85,0x00]
216  sltu $4, $5, -0x8000
217# CHECK: sltiu  $4, $5, -32768          # encoding: [0x00,0x80,0xa4,0x2c]
218  sltu $4, $5, 0
219# CHECK: sltiu  $4, $5, 0               # encoding: [0x00,0x00,0xa4,0x2c]
220  sltu $4, $5, 0xFFFF
221# CHECK: ori    $4, $zero, 65535        # encoding: [0xff,0xff,0x04,0x34]
222  sltu $4, $5, 0x10000
223# CHECK: lui    $4, 1                   # encoding: [0x01,0x00,0x04,0x3c]
224# CHECK: sltu   $4, $4, $5              # encoding: [0x2b,0x20,0x85,0x00]
225  sltu $4, $5, 0xFFFFFFFF
226# CHECK: sltiu  $4, $5, -1              # encoding: [0xff,0xff,0xa4,0x2c]
227
228  xor $4, -0x80000000
229# CHECK: lui    $1, 32768               # encoding: [0x00,0x80,0x01,0x3c]
230# CHECK: xor    $4, $4, $1              # encoding: [0x26,0x20,0x81,0x00]
231  xor $4, -0x8001
232# CHECK: lui    $1, 65535               # encoding: [0xff,0xff,0x01,0x3c]
233# CHECK: ori    $1, $1, 32767           # encoding: [0xff,0x7f,0x21,0x34]
234# CHECK: xor    $4, $4, $1              # encoding: [0x26,0x20,0x81,0x00]
235  xor $4, -0x8000
236# CHECK: addiu  $1, $zero, -32768       # encoding: [0x00,0x80,0x01,0x24]
237  xor $4, 0
238# CHECK: xori   $4, $4, 0               # encoding: [0x00,0x00,0x84,0x38]
239  xor $4, 0xFFFF
240# CHECK: xori   $4, $4, 65535           # encoding: [0xff,0xff,0x84,0x38]
241  xor $4, 0x10000
242# CHECK: lui    $1, 1                   # encoding: [0x01,0x00,0x01,0x3c]
243# CHECK: xor    $4, $4, $1              # encoding: [0x26,0x20,0x81,0x00]
244  xor $4, 0xFFFFFFFF
245# CHECK: addiu  $1, $zero, -1           # encoding: [0xff,0xff,0x01,0x24]
246# CHECK: xor    $4, $4, $1              # encoding: [0x26,0x20,0x81,0x00]
247
248  xor $4, $5, -0x80000000
249# CHECK: lui    $4, 32768               # encoding: [0x00,0x80,0x04,0x3c]
250# CHECK: xor    $4, $4, $5              # encoding: [0x26,0x20,0x85,0x00]
251  xor $4, $5, -0x8001
252# CHECK: lui    $4, 65535               # encoding: [0xff,0xff,0x04,0x3c]
253# CHECK: ori    $4, $4, 32767           # encoding: [0xff,0x7f,0x84,0x34]
254# CHECK: xor    $4, $4, $5              # encoding: [0x26,0x20,0x85,0x00]
255  xor $4, $5, -0x8000
256# CHECK: addiu  $4, $zero, -32768       # encoding: [0x00,0x80,0x04,0x24]
257# CHECK: xor $4, $4, $5                 # encoding: [0x26,0x20,0x85,0x00]
258  xor $4, $5, 0
259# CHECK: xori   $4, $5, 0               # encoding: [0x00,0x00,0xa4,0x38]
260  xor $4, $5, 0xFFFF
261# CHECK: xori   $4, $5, 65535           # encoding: [0xff,0xff,0xa4,0x38]
262  xor $4, $5, 0x10000
263# CHECK: lui    $4, 1                   # encoding: [0x01,0x00,0x04,0x3c]
264# CHECK: xor    $4, $4, $5              # encoding: [0x26,0x20,0x85,0x00]
265  xor $4, $5, 0xFFFFFFFF
266# CHECK: addiu  $4, $zero, -1           # encoding: [0xff,0xff,0x04,0x24]
267# CHECK: xor    $4, $4, $5              # encoding: [0x26,0x20,0x85,0x00]
268