1# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | \
2# RUN:   FileCheck %s
3# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | \
4# RUN:   FileCheck %s
5# RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r2 | \
6# RUN:   FileCheck %s
7
8# Check that the IAS expands macro instructions in the same way as GAS
9
10.extern sym
11# imm and rs are deliberately swapped to test whitespace separated arguments.
12.macro EX2 insn, rd, imm, rs
13.ex\@: \insn \rd, \rs, \imm
14.endm
15
16.option pic0
17
18EX2 addiu $2, 1 $3           # CHECK: addiu    $2, $3, 1
19EX2 addiu $2, ~1 $3          # CHECK: addiu    $2, $3, -2
20EX2 addiu $2, ~ 1 $3         # CHECK: addiu    $2, $3, -2
21EX2 addiu $2, 1+1 $3         # CHECK: addiu    $2, $3, 2
22EX2 addiu $2, 1+ 1 $3        # CHECK: addiu    $2, $3, 2
23EX2 addiu $2, 1 +1 $3        # CHECK: addiu    $2, $3, 2
24EX2 addiu $2, 1 + 1 $3       # CHECK: addiu    $2, $3, 2
25EX2 addiu $2, 1+~1 $3        # CHECK: addiu    $2, $3, -1
26EX2 addiu $2, 1+~ 1 $3       # CHECK: addiu    $2, $3, -1
27EX2 addiu $2, 1+ ~1 $3       # CHECK: addiu    $2, $3, -1
28EX2 addiu $2, 1 +~1 $3       # CHECK: addiu    $2, $3, -1
29EX2 addiu $2, 1 +~ 1 $3      # CHECK: addiu    $2, $3, -1
30EX2 addiu $2, 1 + ~1 $3      # CHECK: addiu    $2, $3, -1
31EX2 addiu $2, 1 + ~ 1 $3     # CHECK: addiu    $2, $3, -1
32EX2 addiu $2, 1+(1) $3       # CHECK: addiu    $2, $3, 2
33EX2 addiu $2, 1 +(1) $3      # CHECK: addiu    $2, $3, 2
34EX2 addiu $2, 1+ (1) $3      # CHECK: addiu    $2, $3, 2
35EX2 addiu $2, 1 + (1) $3     # CHECK: addiu    $2, $3, 2
36EX2 addiu $2, 1+(1)+1 $3     # CHECK: addiu    $2, $3, 3
37EX2 addiu $2, 1 +(1)+1 $3    # CHECK: addiu    $2, $3, 3
38EX2 addiu $2, 1+ (1)+1 $3    # CHECK: addiu    $2, $3, 3
39EX2 addiu $2, 1 + (1)+1 $3   # CHECK: addiu    $2, $3, 3
40nop                          # CHECK: nop
41