xref: /aosp_15_r20/external/llvm/test/MC/Mips/micromips-branch-instructions.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc %s -triple=mipsel -show-encoding -mattr=micromips \
2*9880d681SAndroid Build Coastguard Worker# RUN: | FileCheck %s -check-prefix=CHECK-EL
3*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc %s -triple=mips -show-encoding -mattr=micromips \
4*9880d681SAndroid Build Coastguard Worker# RUN: | FileCheck %s -check-prefix=CHECK-EB
5*9880d681SAndroid Build Coastguard Worker# Check that the assembler can handle the documented syntax
6*9880d681SAndroid Build Coastguard Worker# for arithmetic and logical instructions.
7*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
8*9880d681SAndroid Build Coastguard Worker# Branch Instructions
9*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
10*9880d681SAndroid Build Coastguard Worker# Little endian
11*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
12*9880d681SAndroid Build Coastguard Worker# CHECK-EL: b   1332             # encoding: [0x00,0x94,0x9a,0x02]
13*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x0c]
14*9880d681SAndroid Build Coastguard Worker# CHECK-EL: beq $9, $6, 1332     # encoding: [0xc9,0x94,0x9a,0x02]
15*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x00,0x00,0x00]
16*9880d681SAndroid Build Coastguard Worker# CHECK-EL: bgez $6, 1332        # encoding: [0x46,0x40,0x9a,0x02]
17*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x00,0x00,0x00]
18*9880d681SAndroid Build Coastguard Worker# CHECK-EL: bgezal $6, 1332      # encoding: [0x66,0x40,0x9a,0x02]
19*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x00,0x00,0x00]
20*9880d681SAndroid Build Coastguard Worker# CHECK-EL: bltzal $6, 1332      # encoding: [0x26,0x40,0x9a,0x02]
21*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x00,0x00,0x00]
22*9880d681SAndroid Build Coastguard Worker# CHECK-EL: bgtz $6, 1332        # encoding: [0xc6,0x40,0x9a,0x02]
23*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x00,0x00,0x00]
24*9880d681SAndroid Build Coastguard Worker# CHECK-EL: blez $6, 1332        # encoding: [0x86,0x40,0x9a,0x02]
25*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x00,0x00,0x00]
26*9880d681SAndroid Build Coastguard Worker# CHECK-EL: bne $9, $6, 1332     # encoding: [0xc9,0xb4,0x9a,0x02]
27*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x00,0x00,0x00]
28*9880d681SAndroid Build Coastguard Worker# CHECK-EL: bal 1332             # encoding: [0x60,0x40,0x9a,0x02]
29*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x00,0x00,0x00]
30*9880d681SAndroid Build Coastguard Worker# CHECK-EL: bltz $6, 1332        # encoding: [0x06,0x40,0x9a,0x02]
31*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x00,0x00,0x00]
32*9880d681SAndroid Build Coastguard Worker# CHECK-EL: bgezals $6, 1332     # encoding: [0x66,0x42,0x9a,0x02]
33*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x0c]
34*9880d681SAndroid Build Coastguard Worker# CHECK-EL: bltzals $6, 1332     # encoding: [0x26,0x42,0x9a,0x02]
35*9880d681SAndroid Build Coastguard Worker# CHECK-EL: nop                  # encoding: [0x00,0x0c]
36*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
37*9880d681SAndroid Build Coastguard Worker# Big endian
38*9880d681SAndroid Build Coastguard Worker#------------------------------------------------------------------------------
39*9880d681SAndroid Build Coastguard Worker# CHECK-EB: b   1332             # encoding: [0x94,0x00,0x02,0x9a]
40*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x0c,0x00]
41*9880d681SAndroid Build Coastguard Worker# CHECK-EB: beq $9, $6, 1332     # encoding: [0x94,0xc9,0x02,0x9a]
42*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x00,0x00,0x00,0x00]
43*9880d681SAndroid Build Coastguard Worker# CHECK-EB: bgez $6, 1332        # encoding: [0x40,0x46,0x02,0x9a]
44*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x00,0x00,0x00,0x00]
45*9880d681SAndroid Build Coastguard Worker# CHECK-EB: bgezal $6, 1332      # encoding: [0x40,0x66,0x02,0x9a]
46*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x00,0x00,0x00,0x00]
47*9880d681SAndroid Build Coastguard Worker# CHECK-EB: bltzal $6, 1332      # encoding: [0x40,0x26,0x02,0x9a]
48*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x00,0x00,0x00,0x00]
49*9880d681SAndroid Build Coastguard Worker# CHECK-EB: bgtz $6, 1332        # encoding: [0x40,0xc6,0x02,0x9a]
50*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x00,0x00,0x00,0x00]
51*9880d681SAndroid Build Coastguard Worker# CHECK-EB: blez $6, 1332        # encoding: [0x40,0x86,0x02,0x9a]
52*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x00,0x00,0x00,0x00]
53*9880d681SAndroid Build Coastguard Worker# CHECK-EB: bne $9, $6, 1332     # encoding: [0xb4,0xc9,0x02,0x9a]
54*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x00,0x00,0x00,0x00]
55*9880d681SAndroid Build Coastguard Worker# CHECK-EB: bal 1332             # encoding: [0x40,0x60,0x02,0x9a]
56*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x00,0x00,0x00,0x00]
57*9880d681SAndroid Build Coastguard Worker# CHECK-EB: bltz $6, 1332        # encoding: [0x40,0x06,0x02,0x9a]
58*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x00,0x00,0x00,0x00]
59*9880d681SAndroid Build Coastguard Worker# CHECK-EB: bgezals $6, 1332     # encoding: [0x42,0x66,0x02,0x9a]
60*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x0c,0x00]
61*9880d681SAndroid Build Coastguard Worker# CHECK-EB: bltzals $6, 1332     # encoding: [0x42,0x26,0x02,0x9a]
62*9880d681SAndroid Build Coastguard Worker# CHECK-EB: nop                  # encoding: [0x0c,0x00]
63*9880d681SAndroid Build Coastguard Worker
64*9880d681SAndroid Build Coastguard Worker    .text
65*9880d681SAndroid Build Coastguard Worker    .type main, @function
66*9880d681SAndroid Build Coastguard Worker    .set micromips
67*9880d681SAndroid Build Coastguard Workermain:
68*9880d681SAndroid Build Coastguard Worker     b      1332
69*9880d681SAndroid Build Coastguard Worker     beq    $9,$6,1332
70*9880d681SAndroid Build Coastguard Worker     bgez   $6,1332
71*9880d681SAndroid Build Coastguard Worker     bgezal $6,1332
72*9880d681SAndroid Build Coastguard Worker     bltzal $6,1332
73*9880d681SAndroid Build Coastguard Worker     bgtz   $6,1332
74*9880d681SAndroid Build Coastguard Worker     blez   $6,1332
75*9880d681SAndroid Build Coastguard Worker     bne    $9,$6,1332
76*9880d681SAndroid Build Coastguard Worker     bal    1332
77*9880d681SAndroid Build Coastguard Worker     bltz   $6,1332
78*9880d681SAndroid Build Coastguard Worker     bgezals $6,1332
79*9880d681SAndroid Build Coastguard Worker     bltzals $6,1332
80