1# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | \
2# RUN:   FileCheck %s --check-prefixes=CHECK,CHECK-LE
3# RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r2 | \
4# RUN:   FileCheck %s --check-prefixes=CHECK,CHECK-BE
5
6# Check that the IAS expands macro instructions in the same way as GAS.
7
8# Load address, done by MipsAsmParser::expandLoadAddressReg()
9# and MipsAsmParser::expandLoadAddressImm():
10  la $8, 1f
11# CHECK-LE: lui     $8, %hi($tmp0)        # encoding: [A,A,0x08,0x3c]
12# CHECK-LE:                               #   fixup A - offset: 0, value: %hi($tmp0), kind: fixup_Mips_HI16
13# CHECK-LE: addiu   $8, $8, %lo($tmp0)    # encoding: [A,A,0x08,0x25]
14# CHECK-LE:                               #   fixup A - offset: 0, value: %lo($tmp0), kind: fixup_Mips_LO16
15
16# LW/SW and LDC1/SDC1 of symbol address, done by MipsAsmParser::expandMemInst():
17  .set noat
18  lw $10, symbol($4)
19# CHECK-LE: lui     $10, %hi(symbol)        # encoding: [A,A,0x0a,0x3c]
20# CHECK-LE:                                 #   fixup A - offset: 0, value: %hi(symbol), kind: fixup_Mips_HI16
21# CHECK-LE: addu    $10, $10, $4            # encoding: [0x21,0x50,0x44,0x01]
22# CHECK-LE: lw      $10, %lo(symbol)($10)   # encoding: [A,A,0x4a,0x8d]
23# CHECK-LE:                                 #   fixup A - offset: 0, value: %lo(symbol), kind: fixup_Mips_LO16
24  .set at
25  sw $10, symbol($9)
26# CHECK-LE: lui     $1, %hi(symbol)         # encoding: [A,A,0x01,0x3c]
27# CHECK-LE:                                 #   fixup A - offset: 0, value: %hi(symbol), kind: fixup_Mips_HI16
28# CHECK-LE: addu    $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
29# CHECK-LE: sw      $10, %lo(symbol)($1)    # encoding: [A,A,0x2a,0xac]
30# CHECK-LE:                                 #   fixup A - offset: 0, value: %lo(symbol), kind: fixup_Mips_LO16
31
32  lw $8, 1f
33# CHECK-LE: lui $8, %hi($tmp0)              # encoding: [A,A,0x08,0x3c]
34# CHECK-LE:                                 #   fixup A - offset: 0, value: %hi($tmp0), kind: fixup_Mips_HI16
35# CHECK-LE: lw  $8, %lo($tmp0)($8)          # encoding: [A,A,0x08,0x8d]
36# CHECK-LE:                                 #   fixup A - offset: 0, value: %lo($tmp0), kind: fixup_Mips_LO16
37  sw $8, 1f
38# CHECK-LE: lui $1, %hi($tmp0)              # encoding: [A,A,0x01,0x3c]
39# CHECK-LE:                                 #   fixup A - offset: 0, value: %hi($tmp0), kind: fixup_Mips_HI16
40# CHECK-LE: sw  $8, %lo($tmp0)($1)          # encoding: [A,A,0x28,0xac]
41# CHECK-LE:                                 #   fixup A - offset: 0, value: %lo($tmp0), kind: fixup_Mips_LO16
42
43  lw $10, 655483($4)
44# CHECK-LE: lui     $10, 10                 # encoding: [0x0a,0x00,0x0a,0x3c]
45# CHECK-LE: addu    $10, $10, $4            # encoding: [0x21,0x50,0x44,0x01]
46# CHECK-LE: lw      $10, 123($10)           # encoding: [0x7b,0x00,0x4a,0x8d]
47  sw $10, 123456($9)
48# CHECK-LE: lui     $1, 2                   # encoding: [0x02,0x00,0x01,0x3c]
49# CHECK-LE: addu    $1, $1, $9              # encoding: [0x21,0x08,0x29,0x00]
50# CHECK-LE: sw      $10, -7616($1)          # encoding: [0x40,0xe2,0x2a,0xac]
51
52  lw $8, symbol
53# CHECK-LE:     lui     $8, %hi(symbol)     # encoding: [A,A,0x08,0x3c]
54# CHECK-LE:                                 #   fixup A - offset: 0, value: %hi(symbol), kind: fixup_Mips_HI16
55# CHECK-LE-NOT: move    $8, $8              # encoding: [0x21,0x40,0x00,0x01]
56# CHECK-LE:     lw      $8, %lo(symbol)($8) # encoding: [A,A,0x08,0x8d]
57# CHECK-LE:                                 #   fixup A - offset: 0, value: %lo(symbol), kind: fixup_Mips_LO16
58  sw $8, symbol
59# CHECK-LE:     lui     $1, %hi(symbol)     # encoding: [A,A,0x01,0x3c]
60# CHECK-LE:                                 #   fixup A - offset: 0, value: %hi(symbol), kind: fixup_Mips_HI16
61# CHECK-LE-NOT: move    $1, $1              # encoding: [0x21,0x08,0x20,0x00]
62# CHECK-LE:     sw      $8, %lo(symbol)($1) # encoding: [A,A,0x28,0xac]
63# CHECK-LE:                                 #   fixup A - offset: 0, value: %lo(symbol), kind: fixup_Mips_LO16
64
65  ldc1 $f0, symbol
66# CHECK-LE: lui     $1, %hi(symbol)
67# CHECK-LE: ldc1    $f0, %lo(symbol)($1)
68  sdc1 $f0, symbol
69# CHECK-LE: lui     $1, %hi(symbol)
70# CHECK-LE: sdc1    $f0, %lo(symbol)($1)
71
72# Test BNE with an immediate as the 2nd operand.
73  bne $2, 0, 1332
74# CHECK-LE: bnez  $2, 1332          # encoding: [0x4d,0x01,0x40,0x14]
75# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
76
77  bne $2, 123, 1332
78# CHECK-LE: addiu $1, $zero, 123    # encoding: [0x7b,0x00,0x01,0x24]
79# CHECK-LE: bne   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x14]
80# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
81
82  bne $2, -2345, 1332
83# CHECK-LE: addiu $1, $zero, -2345  # encoding: [0xd7,0xf6,0x01,0x24]
84# CHECK-LE: bne   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x14]
85# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
86
87  bne $2, 65538, 1332
88# CHECK-LE: lui   $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
89# CHECK-LE: ori   $1, $1, 2         # encoding: [0x02,0x00,0x21,0x34]
90# CHECK-LE: bne   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x14]
91# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
92
93  bne $2, ~7, 1332
94# CHECK-LE: addiu $1, $zero, -8     # encoding: [0xf8,0xff,0x01,0x24]
95# CHECK-LE: bne   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x14]
96# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
97
98  bne $2, 0x10000, 1332
99# CHECK-LE: lui   $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
100# CHECK-LE: bne   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x14]
101# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
102
103# Test BEQ with an immediate as the 2nd operand.
104  beq $2, 0, 1332
105# CHECK-LE: beqz  $2, 1332          # encoding: [0x4d,0x01,0x40,0x10]
106# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
107
108  beq $2, 123, 1332
109# CHECK-LE: addiu $1, $zero, 123    # encoding: [0x7b,0x00,0x01,0x24]
110# CHECK-LE: beq   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x10]
111# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
112
113  beq $2, -2345, 1332
114# CHECK-LE: addiu $1, $zero, -2345  # encoding: [0xd7,0xf6,0x01,0x24]
115# CHECK-LE: beq   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x10]
116# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
117
118  beq $2, 65538, 1332
119# CHECK-LE: lui   $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
120# CHECK-LE: ori   $1, $1, 2         # encoding: [0x02,0x00,0x21,0x34]
121# CHECK-LE: beq   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x10]
122# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
123
124  beq $2, ~7, 1332
125# CHECK-LE: addiu $1, $zero, -8     # encoding: [0xf8,0xff,0x01,0x24]
126# CHECK-LE: beq   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x10]
127# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
128
129  beq $2, 0x10000, 1332
130# CHECK-LE: lui   $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
131# CHECK-LE: beq   $2, $1, 1332      # encoding: [0x4d,0x01,0x41,0x10]
132# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
133
134  beq $2, 65538, foo
135# CHECK-LE: lui   $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
136# CHECK-LE: ori   $1, $1, 2         # encoding: [0x02,0x00,0x21,0x34]
137# CHECK-LE: beq   $2, $1, foo       # encoding: [A,A,0x41,0x10]
138# CHECK-LE: nop                     # encoding: [0x00,0x00,0x00,0x00]
139
140# Test ULH with immediate operand.
141ulh_imm: # CHECK-LABEL: ulh_imm:
142  ulh $8, 0
143# CHECK-BE: lb   $1, 0($zero)      # encoding: [0x80,0x01,0x00,0x00]
144# CHECK-BE: lbu  $8, 1($zero)      # encoding: [0x90,0x08,0x00,0x01]
145# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
146# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
147# CHECK-LE: lb   $1, 1($zero)      # encoding: [0x01,0x00,0x01,0x80]
148# CHECK-LE: lbu  $8, 0($zero)      # encoding: [0x00,0x00,0x08,0x90]
149# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
150# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
151
152  ulh $8, 2
153# CHECK-BE: lb   $1, 2($zero)      # encoding: [0x80,0x01,0x00,0x02]
154# CHECK-BE: lbu  $8, 3($zero)      # encoding: [0x90,0x08,0x00,0x03]
155# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
156# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
157# CHECK-LE: lb   $1, 3($zero)      # encoding: [0x03,0x00,0x01,0x80]
158# CHECK-LE: lbu  $8, 2($zero)      # encoding: [0x02,0x00,0x08,0x90]
159# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
160# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
161
162  ulh $8, 0x8000
163# CHECK-BE: ori  $1, $zero, 32768  # encoding: [0x34,0x01,0x80,0x00]
164# CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
165# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
166# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
167# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
168# CHECK-LE: ori  $1, $zero, 32768  # encoding: [0x00,0x80,0x01,0x34]
169# CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
170# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
171# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
172# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
173
174  ulh $8, -0x8000
175# CHECK-BE: lb   $1, -32768($zero) # encoding: [0x80,0x01,0x80,0x00]
176# CHECK-BE: lbu  $8, -32767($zero) # encoding: [0x90,0x08,0x80,0x01]
177# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
178# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
179# CHECK-LE: lb   $1, -32767($zero) # encoding: [0x01,0x80,0x01,0x80]
180# CHECK-LE: lbu  $8, -32768($zero) # encoding: [0x00,0x80,0x08,0x90]
181# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
182# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
183
184  ulh $8, 0x10000
185# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
186# CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
187# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
188# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
189# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
190# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
191# CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
192# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
193# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
194# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
195
196  ulh $8, 0x18888
197# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
198# CHECK-BE: ori  $1, $1, 34952     # encoding: [0x34,0x21,0x88,0x88]
199# CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
200# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
201# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
202# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
203# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
204# CHECK-LE: ori  $1, $1, 34952     # encoding: [0x88,0x88,0x21,0x34]
205# CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
206# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
207# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
208# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
209
210  ulh $8, -32769
211# CHECK-BE: lui  $1, 65535         # encoding: [0x3c,0x01,0xff,0xff]
212# CHECK-BE: ori  $1, $1, 32767     # encoding: [0x34,0x21,0x7f,0xff]
213# CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
214# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
215# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
216# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
217# CHECK-LE: lui  $1, 65535         # encoding: [0xff,0xff,0x01,0x3c]
218# CHECK-LE: ori  $1, $1, 32767     # encoding: [0xff,0x7f,0x21,0x34]
219# CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
220# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
221# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
222# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
223
224  ulh $8, 32767
225# CHECK-BE: addiu $1, $zero, 32767  # encoding: [0x24,0x01,0x7f,0xff]
226# CHECK-BE: lb   $8, 0($1)          # encoding: [0x80,0x28,0x00,0x00]
227# CHECK-BE: lbu  $1, 1($1)          # encoding: [0x90,0x21,0x00,0x01]
228# CHECK-BE: sll  $8, $8, 8          # encoding: [0x00,0x08,0x42,0x00]
229# CHECK-BE: or   $8, $8, $1         # encoding: [0x01,0x01,0x40,0x25]
230# CHECK-LE: addiu $1, $zero, 32767  # encoding: [0xff,0x7f,0x01,0x24]
231# CHECK-LE: lb   $8, 1($1)          # encoding: [0x01,0x00,0x28,0x80]
232# CHECK-LE: lbu  $1, 0($1)          # encoding: [0x00,0x00,0x21,0x90]
233# CHECK-LE: sll  $8, $8, 8          # encoding: [0x00,0x42,0x08,0x00]
234# CHECK-LE: or   $8, $8, $1         # encoding: [0x25,0x40,0x01,0x01]
235
236# Test ULH with immediate offset and a source register operand.
237ulh_reg: # CHECK-LABEL: ulh_reg:
238  ulh $8, 0($9)
239# CHECK-BE: lb   $1, 0($9)         # encoding: [0x81,0x21,0x00,0x00]
240# CHECK-BE: lbu  $8, 1($9)         # encoding: [0x91,0x28,0x00,0x01]
241# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
242# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
243# CHECK-LE: lb   $1, 1($9)         # encoding: [0x01,0x00,0x21,0x81]
244# CHECK-LE: lbu  $8, 0($9)         # encoding: [0x00,0x00,0x28,0x91]
245# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
246# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
247
248  ulh $8, 2($9)
249# CHECK-BE: lb   $1, 2($9)         # encoding: [0x81,0x21,0x00,0x02]
250# CHECK-BE: lbu  $8, 3($9)         # encoding: [0x91,0x28,0x00,0x03]
251# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
252# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
253# CHECK-LE: lb   $1, 3($9)         # encoding: [0x03,0x00,0x21,0x81]
254# CHECK-LE: lbu  $8, 2($9)         # encoding: [0x02,0x00,0x28,0x91]
255# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
256# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
257
258  ulh $8, 0x8000($9)
259# CHECK-BE: ori  $1, $zero, 32768  # encoding: [0x34,0x01,0x80,0x00]
260# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
261# CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
262# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
263# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
264# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
265# CHECK-LE: ori  $1, $zero, 32768  # encoding: [0x00,0x80,0x01,0x34]
266# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
267# CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
268# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
269# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
270# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
271
272  ulh $8, -0x8000($9)
273# CHECK-BE: lb   $1, -32768($9)    # encoding: [0x81,0x21,0x80,0x00]
274# CHECK-BE: lbu  $8, -32767($9)    # encoding: [0x91,0x28,0x80,0x01]
275# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
276# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
277# CHECK-LE: lb   $1, -32767($9)    # encoding: [0x01,0x80,0x21,0x81]
278# CHECK-LE: lbu  $8, -32768($9)    # encoding: [0x00,0x80,0x28,0x91]
279# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
280# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
281
282  ulh $8, 0x10000($9)
283# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
284# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
285# CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
286# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
287# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
288# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
289# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
290# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
291# CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
292# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
293# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
294# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
295
296  ulh $8, 0x18888($9)
297# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
298# CHECK-BE: ori  $1, $1, 34952     # encoding: [0x34,0x21,0x88,0x88]
299# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
300# CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
301# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
302# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
303# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
304# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
305# CHECK-LE: ori  $1, $1, 34952     # encoding: [0x88,0x88,0x21,0x34]
306# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
307# CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
308# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
309# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
310# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
311
312  ulh $8, -32769($9)
313# CHECK-BE: lui  $1, 65535         # encoding: [0x3c,0x01,0xff,0xff]
314# CHECK-BE: ori  $1, $1, 32767     # encoding: [0x34,0x21,0x7f,0xff]
315# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
316# CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
317# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
318# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
319# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
320# CHECK-LE: lui  $1, 65535         # encoding: [0xff,0xff,0x01,0x3c]
321# CHECK-LE: ori  $1, $1, 32767     # encoding: [0xff,0x7f,0x21,0x34]
322# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
323# CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
324# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
325# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
326# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
327
328  ulh $8, 32767($9)
329# CHECK-BE: addiu $1, $zero, 32767 # encoding: [0x24,0x01,0x7f,0xff]
330# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
331# CHECK-BE: lb   $8, 0($1)         # encoding: [0x80,0x28,0x00,0x00]
332# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
333# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
334# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
335# CHECK-LE: addiu $1, $zero, 32767 # encoding: [0xff,0x7f,0x01,0x24]
336# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
337# CHECK-LE: lb   $8, 1($1)         # encoding: [0x01,0x00,0x28,0x80]
338# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
339# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
340# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
341
342# Test ULHU with immediate operand.
343ulhu_imm: # CHECK-LABEL: ulhu_imm:
344  ulhu $8, 0
345# CHECK-BE: lbu  $1, 0($zero)      # encoding: [0x90,0x01,0x00,0x00]
346# CHECK-BE: lbu  $8, 1($zero)      # encoding: [0x90,0x08,0x00,0x01]
347# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
348# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
349# CHECK-LE: lbu  $1, 1($zero)      # encoding: [0x01,0x00,0x01,0x90]
350# CHECK-LE: lbu  $8, 0($zero)      # encoding: [0x00,0x00,0x08,0x90]
351# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
352# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
353
354  ulhu $8, 2
355# CHECK-BE: lbu  $1, 2($zero)      # encoding: [0x90,0x01,0x00,0x02]
356# CHECK-BE: lbu  $8, 3($zero)      # encoding: [0x90,0x08,0x00,0x03]
357# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
358# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
359# CHECK-LE: lbu  $1, 3($zero)      # encoding: [0x03,0x00,0x01,0x90]
360# CHECK-LE: lbu  $8, 2($zero)      # encoding: [0x02,0x00,0x08,0x90]
361# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
362# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
363
364  ulhu $8, 0x8000
365# CHECK-BE: ori  $1, $zero, 32768  # encoding: [0x34,0x01,0x80,0x00]
366# CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
367# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
368# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
369# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
370# CHECK-LE: ori  $1, $zero, 32768  # encoding: [0x00,0x80,0x01,0x34]
371# CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
372# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
373# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
374# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
375
376  ulhu $8, -0x8000
377# CHECK-BE: lbu  $1, -32768($zero) # encoding: [0x90,0x01,0x80,0x00]
378# CHECK-BE: lbu  $8, -32767($zero) # encoding: [0x90,0x08,0x80,0x01]
379# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
380# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
381# CHECK-LE: lbu  $1, -32767($zero) # encoding: [0x01,0x80,0x01,0x90]
382# CHECK-LE: lbu  $8, -32768($zero) # encoding: [0x00,0x80,0x08,0x90]
383# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
384# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
385
386  ulhu $8, 0x10000
387# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
388# CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
389# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
390# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
391# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
392# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
393# CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
394# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
395# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
396# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
397
398  ulhu $8, 0x18888
399# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
400# CHECK-BE: ori  $1, $1, 34952     # encoding: [0x34,0x21,0x88,0x88]
401# CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
402# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
403# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
404# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
405# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
406# CHECK-LE: ori  $1, $1, 34952     # encoding: [0x88,0x88,0x21,0x34]
407# CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
408# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
409# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
410# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
411
412  ulhu $8, -32769
413# CHECK-BE: lui  $1, 65535         # encoding: [0x3c,0x01,0xff,0xff]
414# CHECK-BE: ori  $1, $1, 32767     # encoding: [0x34,0x21,0x7f,0xff]
415# CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
416# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
417# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
418# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
419# CHECK-LE: lui  $1, 65535         # encoding: [0xff,0xff,0x01,0x3c]
420# CHECK-LE: ori  $1, $1, 32767     # encoding: [0xff,0x7f,0x21,0x34]
421# CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
422# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
423# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
424# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
425
426  ulhu $8, 32767
427# CHECK-BE: addiu $1, $zero, 32767  # encoding: [0x24,0x01,0x7f,0xff]
428# CHECK-BE: lbu  $8, 0($1)          # encoding: [0x90,0x28,0x00,0x00]
429# CHECK-BE: lbu  $1, 1($1)          # encoding: [0x90,0x21,0x00,0x01]
430# CHECK-BE: sll  $8, $8, 8          # encoding: [0x00,0x08,0x42,0x00]
431# CHECK-BE: or   $8, $8, $1         # encoding: [0x01,0x01,0x40,0x25]
432# CHECK-LE: addiu $1, $zero, 32767  # encoding: [0xff,0x7f,0x01,0x24]
433# CHECK-LE: lbu  $8, 1($1)          # encoding: [0x01,0x00,0x28,0x90]
434# CHECK-LE: lbu  $1, 0($1)          # encoding: [0x00,0x00,0x21,0x90]
435# CHECK-LE: sll  $8, $8, 8          # encoding: [0x00,0x42,0x08,0x00]
436# CHECK-LE: or   $8, $8, $1         # encoding: [0x25,0x40,0x01,0x01]
437
438# Test ULHU with immediate offset and a source register operand.
439  ulhu $8, 0($9)
440# CHECK-BE: lbu  $1, 0($9)         # encoding: [0x91,0x21,0x00,0x00]
441# CHECK-BE: lbu  $8, 1($9)         # encoding: [0x91,0x28,0x00,0x01]
442# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
443# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
444# CHECK-LE: lbu  $1, 1($9)         # encoding: [0x01,0x00,0x21,0x91]
445# CHECK-LE: lbu  $8, 0($9)         # encoding: [0x00,0x00,0x28,0x91]
446# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
447# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
448
449  ulhu $8, 2($9)
450# CHECK-BE: lbu  $1, 2($9)         # encoding: [0x91,0x21,0x00,0x02]
451# CHECK-BE: lbu  $8, 3($9)         # encoding: [0x91,0x28,0x00,0x03]
452# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
453# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
454# CHECK-LE: lbu  $1, 3($9)         # encoding: [0x03,0x00,0x21,0x91]
455# CHECK-LE: lbu  $8, 2($9)         # encoding: [0x02,0x00,0x28,0x91]
456# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
457# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
458
459  ulhu $8, 0x8000($9)
460# CHECK-BE: ori  $1, $zero, 32768  # encoding: [0x34,0x01,0x80,0x00]
461# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
462# CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
463# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
464# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
465# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
466# CHECK-LE: ori  $1, $zero, 32768  # encoding: [0x00,0x80,0x01,0x34]
467# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
468# CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
469# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
470# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
471# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
472
473  ulhu $8, -0x8000($9)
474# CHECK-BE: lbu  $1, -32768($9)    # encoding: [0x91,0x21,0x80,0x00]
475# CHECK-BE: lbu  $8, -32767($9)    # encoding: [0x91,0x28,0x80,0x01]
476# CHECK-BE: sll  $1, $1, 8         # encoding: [0x00,0x01,0x0a,0x00]
477# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
478# CHECK-LE: lbu  $1, -32767($9)    # encoding: [0x01,0x80,0x21,0x91]
479# CHECK-LE: lbu  $8, -32768($9)    # encoding: [0x00,0x80,0x28,0x91]
480# CHECK-LE: sll  $1, $1, 8         # encoding: [0x00,0x0a,0x01,0x00]
481# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
482
483  ulhu $8, 0x10000($9)
484# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
485# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
486# CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
487# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
488# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
489# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
490# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
491# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
492# CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
493# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
494# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
495# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
496
497  ulhu $8, 0x18888($9)
498# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
499# CHECK-BE: ori  $1, $1, 34952     # encoding: [0x34,0x21,0x88,0x88]
500# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
501# CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
502# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
503# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
504# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
505# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
506# CHECK-LE: ori  $1, $1, 34952     # encoding: [0x88,0x88,0x21,0x34]
507# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
508# CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
509# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
510# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
511# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
512
513  ulhu $8, -32769($9)
514# CHECK-BE: lui  $1, 65535         # encoding: [0x3c,0x01,0xff,0xff]
515# CHECK-BE: ori  $1, $1, 32767     # encoding: [0x34,0x21,0x7f,0xff]
516# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
517# CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
518# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
519# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
520# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
521# CHECK-LE: lui  $1, 65535         # encoding: [0xff,0xff,0x01,0x3c]
522# CHECK-LE: ori  $1, $1, 32767     # encoding: [0xff,0x7f,0x21,0x34]
523# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
524# CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
525# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
526# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
527# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
528
529  ulhu $8, 32767($9)
530# CHECK-BE: addiu $1, $zero, 32767 # encoding: [0x24,0x01,0x7f,0xff]
531# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
532# CHECK-BE: lbu  $8, 0($1)         # encoding: [0x90,0x28,0x00,0x00]
533# CHECK-BE: lbu  $1, 1($1)         # encoding: [0x90,0x21,0x00,0x01]
534# CHECK-BE: sll  $8, $8, 8         # encoding: [0x00,0x08,0x42,0x00]
535# CHECK-BE: or   $8, $8, $1        # encoding: [0x01,0x01,0x40,0x25]
536# CHECK-LE: addiu $1, $zero, 32767 # encoding: [0xff,0x7f,0x01,0x24]
537# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
538# CHECK-LE: lbu  $8, 1($1)         # encoding: [0x01,0x00,0x28,0x90]
539# CHECK-LE: lbu  $1, 0($1)         # encoding: [0x00,0x00,0x21,0x90]
540# CHECK-LE: sll  $8, $8, 8         # encoding: [0x00,0x42,0x08,0x00]
541# CHECK-LE: or   $8, $8, $1        # encoding: [0x25,0x40,0x01,0x01]
542
543# Test ULW with immediate operand.
544  ulw $8, 0
545# CHECK-BE: lwl  $8, 0($zero)      # encoding: [0x88,0x08,0x00,0x00]
546# CHECK-BE: lwr  $8, 3($zero)      # encoding: [0x98,0x08,0x00,0x03]
547# CHECK-LE: lwl $8, 3($zero)       # encoding: [0x03,0x00,0x08,0x88]
548# CHECK-LE: lwr $8, 0($zero)       # encoding: [0x00,0x00,0x08,0x98]
549
550  ulw $8, 2
551# CHECK-BE: lwl  $8, 2($zero)      # encoding: [0x88,0x08,0x00,0x02]
552# CHECK-BE: lwr  $8, 5($zero)      # encoding: [0x98,0x08,0x00,0x05]
553# CHECK-LE: lwl $8, 5($zero)       # encoding: [0x05,0x00,0x08,0x88]
554# CHECK-LE: lwr $8, 2($zero)       # encoding: [0x02,0x00,0x08,0x98]
555
556  ulw $8, 0x8000
557# CHECK-BE: ori  $1, $zero, 32768  # encoding: [0x34,0x01,0x80,0x00]
558# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
559# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
560# CHECK-LE: ori $1, $zero, 32768   # encoding: [0x00,0x80,0x01,0x34]
561# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
562# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
563
564  ulw $8, -0x8000
565# CHECK-BE: lwl  $8, -32768($zero) # encoding: [0x88,0x08,0x80,0x00]
566# CHECK-BE: lwr  $8, -32765($zero) # encoding: [0x98,0x08,0x80,0x03]
567# CHECK-LE: lwl $8, -32765($zero)  # encoding: [0x03,0x80,0x08,0x88]
568# CHECK-LE: lwr $8, -32768($zero)  # encoding: [0x00,0x80,0x08,0x98]
569
570  ulw $8, 0x10000
571# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
572# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
573# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
574# CHECK-LE: lui $1, 1              # encoding: [0x01,0x00,0x01,0x3c]
575# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
576# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
577
578  ulw $8, 0x18888
579# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
580# CHECK-BE: ori  $1, $1, 34952     # encoding: [0x34,0x21,0x88,0x88]
581# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
582# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
583# CHECK-LE: lui $1, 1              # encoding: [0x01,0x00,0x01,0x3c]
584# CHECK-LE: ori $1, $1, 34952      # encoding: [0x88,0x88,0x21,0x34]
585# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
586# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
587
588  ulw $8, -32771
589# CHECK-BE: lui  $1, 65535         # encoding: [0x3c,0x01,0xff,0xff]
590# CHECK-BE: ori  $1, $1, 32765     # encoding: [0x34,0x21,0x7f,0xfd]
591# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
592# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
593# CHECK-LE: lui $1, 65535          # encoding: [0xff,0xff,0x01,0x3c]
594# CHECK-LE: ori $1, $1, 32765      # encoding: [0xfd,0x7f,0x21,0x34]
595# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
596# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
597
598  ulw $8, 32765
599# CHECK-BE: addiu $1, $zero, 32765 # encoding: [0x24,0x01,0x7f,0xfd]
600# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
601# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
602# CHECK-LE: addiu $1, $zero, 32765 # encoding: [0xfd,0x7f,0x01,0x24]
603# CHECK-LE: lwl $8, 3($1)          # encoding: [0x03,0x00,0x28,0x88]
604# CHECK-LE: lwr $8, 0($1)          # encoding: [0x00,0x00,0x28,0x98]
605
606# Test ULW with immediate offset and a source register operand.
607  ulw $8, 0($9)
608# CHECK-BE: lwl  $8, 0($9)         # encoding: [0x89,0x28,0x00,0x00]
609# CHECK-BE: lwr  $8, 3($9)         # encoding: [0x99,0x28,0x00,0x03]
610# CHECK-LE: lwl  $8, 3($9)         # encoding: [0x03,0x00,0x28,0x89]
611# CHECK-LE: lwr  $8, 0($9)         # encoding: [0x00,0x00,0x28,0x99]
612
613  ulw $8, 2($9)
614# CHECK-BE: lwl  $8, 2($9)         # encoding: [0x89,0x28,0x00,0x02]
615# CHECK-BE: lwr  $8, 5($9)         # encoding: [0x99,0x28,0x00,0x05]
616# CHECK-LE: lwl  $8, 5($9)         # encoding: [0x05,0x00,0x28,0x89]
617# CHECK-LE: lwr  $8, 2($9)         # encoding: [0x02,0x00,0x28,0x99]
618
619  ulw $8, 0x8000($9)
620# CHECK-BE: ori  $1, $zero, 32768  # encoding: [0x34,0x01,0x80,0x00]
621# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
622# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
623# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
624# CHECK-LE: ori  $1, $zero, 32768  # encoding: [0x00,0x80,0x01,0x34]
625# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
626# CHECK-LE: lwl  $8, 3($1)         # encoding: [0x03,0x00,0x28,0x88]
627# CHECK-LE: lwr  $8, 0($1)         # encoding: [0x00,0x00,0x28,0x98]
628
629  ulw $8, -0x8000($9)
630# CHECK-BE: lwl  $8, -32768($9)    # encoding: [0x89,0x28,0x80,0x00]
631# CHECK-BE: lwr  $8, -32765($9)    # encoding: [0x99,0x28,0x80,0x03]
632# CHECK-LE: lwl  $8, -32765($9)    # encoding: [0x03,0x80,0x28,0x89]
633# CHECK-LE: lwr  $8, -32768($9)    # encoding: [0x00,0x80,0x28,0x99]
634
635  ulw $8, 0x10000($9)
636# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
637# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
638# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
639# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
640# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
641# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
642# CHECK-LE: lwl  $8, 3($1)         # encoding: [0x03,0x00,0x28,0x88]
643# CHECK-LE: lwr  $8, 0($1)         # encoding: [0x00,0x00,0x28,0x98]
644
645  ulw $8, 0x18888($9)
646# CHECK-BE: lui  $1, 1             # encoding: [0x3c,0x01,0x00,0x01]
647# CHECK-BE: ori  $1, $1, 34952     # encoding: [0x34,0x21,0x88,0x88]
648# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
649# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
650# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
651# CHECK-LE: lui  $1, 1             # encoding: [0x01,0x00,0x01,0x3c]
652# CHECK-LE: ori  $1, $1, 34952     # encoding: [0x88,0x88,0x21,0x34]
653# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
654# CHECK-LE: lwl  $8, 3($1)         # encoding: [0x03,0x00,0x28,0x88]
655# CHECK-LE: lwr  $8, 0($1)         # encoding: [0x00,0x00,0x28,0x98]
656
657  ulw $8, -32771($9)
658# CHECK-BE: lui  $1, 65535         # encoding: [0x3c,0x01,0xff,0xff]
659# CHECK-BE: ori  $1, $1, 32765     # encoding: [0x34,0x21,0x7f,0xfd]
660# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
661# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
662# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
663# CHECK-LE: lui  $1, 65535         # encoding: [0xff,0xff,0x01,0x3c]
664# CHECK-LE: ori  $1, $1, 32765     # encoding: [0xfd,0x7f,0x21,0x34]
665# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
666# CHECK-LE: lwl  $8, 3($1)         # encoding: [0x03,0x00,0x28,0x88]
667# CHECK-LE: lwr  $8, 0($1)         # encoding: [0x00,0x00,0x28,0x98]
668
669  ulw $8, 32765($9)
670# CHECK-BE: addiu $1, $zero, 32765 # encoding: [0x24,0x01,0x7f,0xfd]
671# CHECK-BE: addu $1, $1, $9        # encoding: [0x00,0x29,0x08,0x21]
672# CHECK-BE: lwl  $8, 0($1)         # encoding: [0x88,0x28,0x00,0x00]
673# CHECK-BE: lwr  $8, 3($1)         # encoding: [0x98,0x28,0x00,0x03]
674# CHECK-LE: addiu $1, $zero, 32765 # encoding: [0xfd,0x7f,0x01,0x24]
675# CHECK-LE: addu $1, $1, $9        # encoding: [0x21,0x08,0x29,0x00]
676# CHECK-LE: lwl  $8, 3($1)         # encoding: [0x03,0x00,0x28,0x88]
677# CHECK-LE: lwr  $8, 0($1)         # encoding: [0x00,0x00,0x28,0x98]
678
6791:
680  add $4, $4, $4
681