Mips specific llvm assembler support for branch and jump instructions.
[oota-llvm.git] / test / MC / Mips / mips-jump-instructions.s
1 # RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | FileCheck %s
2 # Check that the assembler can handle the documented syntax
3 # for jumps and branches.
4 # CHECK: .section __TEXT,__text,regular,pure_instructions
5 #------------------------------------------------------------------------------
6 # Branch instructions
7 #------------------------------------------------------------------------------
8 # CHECK:   b 1332                 # encoding: [0x34,0x05,0x00,0x10]
9 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
10 # CHECK:   bc1f 1332              # encoding: [0x34,0x05,0x00,0x45]
11 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
12 # CHECK:   bc1t 1332              # encoding: [0x34,0x05,0x01,0x45]
13 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
14 # CHECK:   beq $9, $6, 1332       # encoding: [0x34,0x05,0x26,0x11]
15 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
16 # CHECK:   bgez $6, 1332          # encoding: [0x34,0x05,0xc1,0x04]
17 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
18 # CHECK:   bgezal $6, 1332        # encoding: [0x34,0x05,0xd1,0x04]
19 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
20 # CHECK:   bgtz $6, 1332          # encoding: [0x34,0x05,0xc0,0x1c]
21 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
22 # CHECK:   blez $6, 1332          # encoding: [0x34,0x05,0xc0,0x18]
23 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
24 # CHECK:   bne $9, $6, 1332       # encoding: [0x34,0x05,0x26,0x15]
25 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
26          b 1332
27          nop
28          bc1f 1332
29          nop
30          bc1t 1332
31          nop
32          beq $9,$6,1332
33          nop
34          bgez $6,1332
35          nop
36          bgezal $6,1332
37          nop
38          bgtz $6,1332
39          nop
40          blez $6,1332
41          nop
42          bne $9,$6,1332
43          nop
44
45 end_of_code:
46 #------------------------------------------------------------------------------
47 # Jump instructions
48 #------------------------------------------------------------------------------
49 # CHECK:   j 1328               # encoding: [0x30,0x05,0x00,0x08]
50 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
51 # CHECK:   jal 1328             # encoding: [0x30,0x05,0x00,0x0c]
52 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
53 # CHECK:   jalr $6              # encoding: [0x09,0xf8,0xc0,0x00]
54 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
55 # CHECK:   jr $7                # encoding: [0x08,0x00,0xe0,0x00]
56
57
58    j 1328
59    nop
60    jal 1328
61    nop
62    jalr $6
63    nop
64    jr $7