xref: /aosp_15_r20/external/llvm/test/MC/Mips/micromips-alu-instructions.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc %s -triple=mipsel -show-encoding -mattr=micromips | FileCheck -check-prefix=CHECK-EL %s
2*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc %s -triple=mips -show-encoding -mattr=micromips | FileCheck -check-prefix=CHECK-EB %s
3*9880d681SAndroid Build Coastguard Worker# Check that the assembler can handle the documented syntax
4*9880d681SAndroid Build Coastguard Worker# for arithmetic and logical instructions.
5*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
6*9880d681SAndroid Build Coastguard Worker# Arithmetic and Logical Instructions
7*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
8*9880d681SAndroid Build Coastguard Worker# Little endian
9*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
10*9880d681SAndroid Build Coastguard Worker# CHECK-EL: add   $9, $6, $7      # encoding: [0xe6,0x00,0x10,0x49]
11*9880d681SAndroid Build Coastguard Worker# CHECK-EL: addi  $9, $6, 17767   # encoding: [0x26,0x11,0x67,0x45]
12*9880d681SAndroid Build Coastguard Worker# CHECK-EL: addiu $9, $6, -15001  # encoding: [0x26,0x31,0x67,0xc5]
13*9880d681SAndroid Build Coastguard Worker# CHECK-EL: addi  $9, $6, 17767   # encoding: [0x26,0x11,0x67,0x45]
14*9880d681SAndroid Build Coastguard Worker# CHECK-EL: addiu $9, $6, -15001  # encoding: [0x26,0x31,0x67,0xc5]
15*9880d681SAndroid Build Coastguard Worker# CHECK-EL: addu  $9, $6, $7      # encoding: [0xe6,0x00,0x50,0x49]
16*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sub   $9, $6, $7      # encoding: [0xe6,0x00,0x90,0x49]
17*9880d681SAndroid Build Coastguard Worker# CHECK-EL: subu  $4, $3, $5      # encoding: [0xa3,0x00,0xd0,0x21]
18*9880d681SAndroid Build Coastguard Worker# CHECK-EL: neg   $6, $7          # encoding: [0xe0,0x00,0x90,0x31]
19*9880d681SAndroid Build Coastguard Worker# CHECK-EL: negu  $6, $7          # encoding: [0xe0,0x00,0xd0,0x31]
20*9880d681SAndroid Build Coastguard Worker# CHECK-EL: slt    $3, $3, $5     # encoding: [0xa3,0x00,0x50,0x1b]
21*9880d681SAndroid Build Coastguard Worker# CHECK-EL: slti   $3, $3, 103    # encoding: [0x63,0x90,0x67,0x00]
22*9880d681SAndroid Build Coastguard Worker# CHECK-EL: slti   $3, $3, 103    # encoding: [0x63,0x90,0x67,0x00]
23*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sltiu  $3, $3, 103    # encoding: [0x63,0xb0,0x67,0x00]
24*9880d681SAndroid Build Coastguard Worker# CHECK-EL: sltu   $3, $3, $5     # encoding: [0xa3,0x00,0x90,0x1b]
25*9880d681SAndroid Build Coastguard Worker# CHECK-EL: lui    $9, 17767      # encoding: [0xa9,0x41,0x67,0x45]
26*9880d681SAndroid Build Coastguard Worker# CHECK-EL: and    $9, $6, $7     # encoding: [0xe6,0x00,0x50,0x4a]
27*9880d681SAndroid Build Coastguard Worker# CHECK-EL: andi   $9, $6, 17767  # encoding: [0x26,0xd1,0x67,0x45]
28*9880d681SAndroid Build Coastguard Worker# CHECK-EL: andi   $9, $6, 17767  # encoding: [0x26,0xd1,0x67,0x45]
29*9880d681SAndroid Build Coastguard Worker# CHECK-EL: or     $3, $4, $5     # encoding: [0xa4,0x00,0x90,0x1a]
30*9880d681SAndroid Build Coastguard Worker# CHECK-EL: ori    $9, $6, 17767  # encoding: [0x26,0x51,0x67,0x45]
31*9880d681SAndroid Build Coastguard Worker# CHECK-EL: xor    $3, $3, $5     # encoding: [0xa3,0x00,0x10,0x1b]
32*9880d681SAndroid Build Coastguard Worker# CHECK-EL: xori   $9, $6, 17767  # encoding: [0x26,0x71,0x67,0x45]
33*9880d681SAndroid Build Coastguard Worker# CHECK-EL: xori   $9, $6, 17767  # encoding: [0x26,0x71,0x67,0x45]
34*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nor    $9, $6, $7     # encoding: [0xe6,0x00,0xd0,0x4a]
35*9880d681SAndroid Build Coastguard Worker# CHECK-EL: not    $7, $8         # encoding: [0x08,0x00,0xd0,0x3a]
36*9880d681SAndroid Build Coastguard Worker# CHECK-EL: mul    $9, $6, $7     # encoding: [0xe6,0x00,0x10,0x4a]
37*9880d681SAndroid Build Coastguard Worker# CHECK-EL: mult   $9, $7         # encoding: [0xe9,0x00,0x3c,0x8b]
38*9880d681SAndroid Build Coastguard Worker# CHECK-EL: multu  $9, $7         # encoding: [0xe9,0x00,0x3c,0x9b]
39*9880d681SAndroid Build Coastguard Worker# CHECK-EL: div    $zero, $9, $7  # encoding: [0xe9,0x00,0x3c,0xab]
40*9880d681SAndroid Build Coastguard Worker# CHECK-EL: divu   $zero, $9, $7  # encoding: [0xe9,0x00,0x3c,0xbb]
41*9880d681SAndroid Build Coastguard Worker# CHECK-EL: addiupc $2, 20        # encoding: [0x00,0x79,0x05,0x00]
42*9880d681SAndroid Build Coastguard Worker# CHECK-EL: addiupc $7, 16777212  # encoding: [0xbf,0x7b,0xff,0xff]
43*9880d681SAndroid Build Coastguard Worker# CHECK-EL: addiupc $7, -16777216 # encoding: [0xc0,0x7b,0x00,0x00]
44*9880d681SAndroid Build Coastguard Worker# CHECK-EL: andi $3, $3, 5        # encoding: [0x63,0xd0,0x05,0x00]
45*9880d681SAndroid Build Coastguard Worker# CHECK-EL: ori $3, $4, 5         # encoding: [0x64,0x50,0x05,0x00]
46*9880d681SAndroid Build Coastguard Worker# CHECK-EL: ori $3, $3, 5         # encoding: [0x63,0x50,0x05,0x00]
47*9880d681SAndroid Build Coastguard Worker# CHECK-EL: xori $3, $3, 5        # encoding: [0x63,0x70,0x05,0x00]
48*9880d681SAndroid Build Coastguard Worker# CHECK-EL: not $3, $4            # encoding: [0x04,0x00,0xd0,0x1a]
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
51*9880d681SAndroid Build Coastguard Worker# Big endian
52*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
53*9880d681SAndroid Build Coastguard Worker# CHECK-EB: add $9, $6, $7        # encoding: [0x00,0xe6,0x49,0x10]
54*9880d681SAndroid Build Coastguard Worker# CHECK-EB: addi  $9, $6, 17767   # encoding: [0x11,0x26,0x45,0x67]
55*9880d681SAndroid Build Coastguard Worker# CHECK-EB: addiu $9, $6, -15001  # encoding: [0x31,0x26,0xc5,0x67]
56*9880d681SAndroid Build Coastguard Worker# CHECK-EB: addi  $9, $6, 17767   # encoding: [0x11,0x26,0x45,0x67]
57*9880d681SAndroid Build Coastguard Worker# CHECK-EB: addiu $9, $6, -15001  # encoding: [0x31,0x26,0xc5,0x67]
58*9880d681SAndroid Build Coastguard Worker# CHECK-EB: addu  $9, $6, $7      # encoding: [0x00,0xe6,0x49,0x50]
59*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sub $9, $6, $7        # encoding: [0x00,0xe6,0x49,0x90]
60*9880d681SAndroid Build Coastguard Worker# CHECK-EB: subu  $4, $3, $5      # encoding: [0x00,0xa3,0x21,0xd0]
61*9880d681SAndroid Build Coastguard Worker# CHECK-EB: neg $6, $7            # encoding: [0x00,0xe0,0x31,0x90]
62*9880d681SAndroid Build Coastguard Worker# CHECK-EB: negu  $6, $7          # encoding: [0x00,0xe0,0x31,0xd0]
63*9880d681SAndroid Build Coastguard Worker# CHECK-EB: slt $3, $3, $5        # encoding: [0x00,0xa3,0x1b,0x50]
64*9880d681SAndroid Build Coastguard Worker# CHECK-EB: slti  $3, $3, 103     # encoding: [0x90,0x63,0x00,0x67]
65*9880d681SAndroid Build Coastguard Worker# CHECK-EB: slti  $3, $3, 103     # encoding: [0x90,0x63,0x00,0x67]
66*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sltiu $3, $3, 103     # encoding: [0xb0,0x63,0x00,0x67]
67*9880d681SAndroid Build Coastguard Worker# CHECK-EB: sltu  $3, $3, $5      # encoding: [0x00,0xa3,0x1b,0x90]
68*9880d681SAndroid Build Coastguard Worker# CHECK-EB: lui $9, 17767         # encoding: [0x41,0xa9,0x45,0x67]
69*9880d681SAndroid Build Coastguard Worker# CHECK-EB: and $9, $6, $7        # encoding: [0x00,0xe6,0x4a,0x50]
70*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  andi  $9, $6, 17767  # encoding: [0xd1,0x26,0x45,0x67]
71*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  andi  $9, $6, 17767  # encoding: [0xd1,0x26,0x45,0x67]
72*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  or  $3, $4, $5       # encoding: [0x00,0xa4,0x1a,0x90]
73*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  ori $9, $6, 17767    # encoding: [0x51,0x26,0x45,0x67]
74*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  xor $3, $3, $5       # encoding: [0x00,0xa3,0x1b,0x10]
75*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  xori  $9, $6, 17767  # encoding: [0x71,0x26,0x45,0x67]
76*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  xori  $9, $6, 17767  # encoding: [0x71,0x26,0x45,0x67]
77*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  nor $9, $6, $7       # encoding: [0x00,0xe6,0x4a,0xd0]
78*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  not $7, $8           # encoding: [0x00,0x08,0x3a,0xd0]
79*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  mul $9, $6, $7       # encoding: [0x00,0xe6,0x4a,0x10]
80*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  mult  $9, $7         # encoding: [0x00,0xe9,0x8b,0x3c]
81*9880d681SAndroid Build Coastguard Worker# CHECK-EB:  multu $9, $7         # encoding: [0x00,0xe9,0x9b,0x3c]
82*9880d681SAndroid Build Coastguard Worker# CHECK-EB: div  $zero, $9, $7    # encoding: [0x00,0xe9,0xab,0x3c]
83*9880d681SAndroid Build Coastguard Worker# CHECK-EB: divu $zero, $9, $7    # encoding: [0x00,0xe9,0xbb,0x3c]
84*9880d681SAndroid Build Coastguard Worker# CHECK-EB: addiupc $2, 20        # encoding: [0x79,0x00,0x00,0x05]
85*9880d681SAndroid Build Coastguard Worker# CHECK-EB: addiupc $7, 16777212  # encoding: [0x7b,0xbf,0xff,0xff]
86*9880d681SAndroid Build Coastguard Worker# CHECK-EB: addiupc $7, -16777216 # encoding: [0x7b,0xc0,0x00,0x00]
87*9880d681SAndroid Build Coastguard Worker# CHECK-EB: andi $3, $3, 5        # encoding: [0xd0,0x63,0x00,0x05]
88*9880d681SAndroid Build Coastguard Worker# CHECK-EB: ori $3, $4, 5         # encoding: [0x50,0x64,0x00,0x05]
89*9880d681SAndroid Build Coastguard Worker# CHECK-EB: ori $3, $3, 5         # encoding: [0x50,0x63,0x00,0x05]
90*9880d681SAndroid Build Coastguard Worker# CHECK-EB: xori $3, $3, 5        # encoding: [0x70,0x63,0x00,0x05]
91*9880d681SAndroid Build Coastguard Worker# CHECK-EB: not $3, $4            # encoding: [0x00,0x04,0x1a,0xd0]
92*9880d681SAndroid Build Coastguard Worker
93*9880d681SAndroid Build Coastguard Worker    add    $9, $6, $7
94*9880d681SAndroid Build Coastguard Worker    add    $9, $6, 17767
95*9880d681SAndroid Build Coastguard Worker    addu   $9, $6, -15001
96*9880d681SAndroid Build Coastguard Worker    addi   $9, $6, 17767
97*9880d681SAndroid Build Coastguard Worker    addiu  $9, $6,-15001
98*9880d681SAndroid Build Coastguard Worker    addu   $9, $6, $7
99*9880d681SAndroid Build Coastguard Worker    sub    $9, $6, $7
100*9880d681SAndroid Build Coastguard Worker    subu   $4, $3, $5
101*9880d681SAndroid Build Coastguard Worker    neg    $6, $7
102*9880d681SAndroid Build Coastguard Worker    negu   $6, $7
103*9880d681SAndroid Build Coastguard Worker    move   $7, $8
104*9880d681SAndroid Build Coastguard Worker    slt    $3, $3, $5
105*9880d681SAndroid Build Coastguard Worker    slt    $3, $3, 103
106*9880d681SAndroid Build Coastguard Worker    slti   $3, $3, 103
107*9880d681SAndroid Build Coastguard Worker    sltiu  $3, $3, 103
108*9880d681SAndroid Build Coastguard Worker    sltu   $3, $3, $5
109*9880d681SAndroid Build Coastguard Worker    lui    $9, 17767
110*9880d681SAndroid Build Coastguard Worker    and    $9, $6, $7
111*9880d681SAndroid Build Coastguard Worker    and    $9, $6, 17767
112*9880d681SAndroid Build Coastguard Worker    andi   $9, $6, 17767
113*9880d681SAndroid Build Coastguard Worker    or     $3, $4, $5
114*9880d681SAndroid Build Coastguard Worker    ori    $9, $6, 17767
115*9880d681SAndroid Build Coastguard Worker    xor    $3, $3, $5
116*9880d681SAndroid Build Coastguard Worker    xor    $9, $6, 17767
117*9880d681SAndroid Build Coastguard Worker    xori   $9, $6, 17767
118*9880d681SAndroid Build Coastguard Worker    nor    $9, $6, $7
119*9880d681SAndroid Build Coastguard Worker    nor    $7, $8, $zero
120*9880d681SAndroid Build Coastguard Worker    mul    $9, $6, $7
121*9880d681SAndroid Build Coastguard Worker    mult   $9, $7
122*9880d681SAndroid Build Coastguard Worker    multu  $9, $7
123*9880d681SAndroid Build Coastguard Worker    div    $0, $9, $7
124*9880d681SAndroid Build Coastguard Worker    divu   $0, $9, $7
125*9880d681SAndroid Build Coastguard Worker    addiupc $2, 20
126*9880d681SAndroid Build Coastguard Worker    addiupc $7, 16777212
127*9880d681SAndroid Build Coastguard Worker    addiupc $7, -16777216
128*9880d681SAndroid Build Coastguard Worker    and    $3, 5
129*9880d681SAndroid Build Coastguard Worker    or     $3, $4, 5
130*9880d681SAndroid Build Coastguard Worker    or     $3, 5
131*9880d681SAndroid Build Coastguard Worker    xor    $3, 5
132*9880d681SAndroid Build Coastguard Worker    not    $3, $4
133