1# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding \
2# RUN: -mcpu=mips32r2 -mattr=micromips | FileCheck %s
3# Check that the assembler can handle the documented syntax
4# for macro instructions
5#------------------------------------------------------------------------------
6# Load immediate instructions
7#------------------------------------------------------------------------------
8# CHECK: addiu $5, $zero, 123        # encoding: [0xa0,0x30,0x7b,0x00]
9# CHECK: addiu $6, $zero, -2345      # encoding: [0xc0,0x30,0xd7,0xf6]
10# CHECK: lui   $7, 1                 # encoding: [0xa7,0x41,0x01,0x00]
11# CHECK: ori   $7, $7, 2             # encoding: [0xe7,0x50,0x02,0x00]
12# CHECK: addiu $4, $zero, 20         # encoding: [0x80,0x30,0x14,0x00]
13# CHECK: lui   $7, 1                 # encoding: [0xa7,0x41,0x01,0x00]
14# CHECK: ori   $7, $7, 2             # encoding: [0xe7,0x50,0x02,0x00]
15# CHECK: addiu $4, $5, 20            # encoding: [0x85,0x30,0x14,0x00]
16# CHECK: lui   $7, 1                 # encoding: [0xa7,0x41,0x01,0x00]
17# CHECK: ori   $7, $7, 2             # encoding: [0xe7,0x50,0x02,0x00]
18# CHECK: addu  $7, $7, $8            # encoding: [0x07,0x01,0x50,0x39]
19# CHECK: lui   $10, %hi(symbol)      # encoding: [0xaa'A',0x41'A',0x00,0x00]
20# CHECK:                             # fixup A - offset: 0,
21# CHECK:                               value: %hi(symbol),
22# CHECK:                               kind: fixup_MICROMIPS_HI16
23# CHECK: addu  $10, $10, $4          # encoding: [0x8a,0x00,0x50,0x51]
24# CHECK: lw    $10, %lo(symbol)($10) # encoding: [0x4a'A',0xfd'A',0x00,0x00]
25# CHECK:                             # fixup A - offset: 0,
26# CHECK:                               value: %lo(symbol),
27# CHECK:                               kind: fixup_MICROMIPS_LO16
28# CHECK: lui   $1, %hi(symbol)       # encoding: [0xa1'A',0x41'A',0x00,0x00]
29# CHECK:                             # fixup A - offset: 0,
30# CHECK:                               value: %hi(symbol),
31# CHECK:                               kind: fixup_MICROMIPS_HI16
32# CHECK: addu  $1, $1, $9            # encoding: [0x21,0x01,0x50,0x09]
33# CHECK: sw    $10, %lo(symbol)($1)  # encoding: [0x41'A',0xf9'A',0x00,0x00]
34# CHECK:                             # fixup A - offset: 0,
35# CHECK:                               value: %lo(symbol),
36# CHECK:                               kind: fixup_MICROMIPS_LO16
37# CHECK: lui   $10, 10               # encoding: [0xaa,0x41,0x0a,0x00]
38# CHECK: addu  $10, $10, $4          # encoding: [0x8a,0x00,0x50,0x51]
39# CHECK: lw    $10, 123($10)         # encoding: [0x4a,0xfd,0x7b,0x00]
40# CHECK: lui   $1, 2                 # encoding: [0xa1,0x41,0x02,0x00]
41# CHECK: addu  $1, $1, $9            # encoding: [0x21,0x01,0x50,0x09]
42# CHECK: sw    $10, -7616($1)        # encoding: [0x41,0xf9,0x40,0xe2]
43
44    li $5,123
45    li $6,-2345
46    li $7,65538
47
48    la $a0, 20
49    la $7,65538
50    la $a0, 20($a1)
51    la $7,65538($8)
52
53    lw  $t2, symbol($a0)
54    sw  $t2, symbol($t1)
55
56    lw  $t2, 655483($a0)
57    sw  $t2, 123456($t1)
58