Implement the "mips endian" for r_info.
[oota-llvm.git] / test / MC / Mips / mips-jump-instructions.s
1 # RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | \
2 # RUN: FileCheck %s
3 # Check that the assembler can handle the documented syntax
4 # for jumps and branches.
5 # CHECK: .section __TEXT,__text,regular,pure_instructions
6 #------------------------------------------------------------------------------
7 # Branch instructions
8 #------------------------------------------------------------------------------
9 # CHECK:   b 1332                 # encoding: [0x4d,0x01,0x00,0x10]
10 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
11 # CHECK:   bc1f 1332              # encoding: [0x4d,0x01,0x00,0x45]
12 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
13 # CHECK:   bc1t 1332              # encoding: [0x4d,0x01,0x01,0x45]
14 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
15 # CHECK:   beq $9, $6, 1332       # encoding: [0x4d,0x01,0x26,0x11]
16 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
17 # CHECK:   bgez $6, 1332          # encoding: [0x4d,0x01,0xc1,0x04]
18 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
19 # CHECK:   bgezal $6, 1332        # encoding: [0x4d,0x01,0xd1,0x04]
20 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
21 # CHECK:   bgtz $6, 1332          # encoding: [0x4d,0x01,0xc0,0x1c]
22 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
23 # CHECK:   blez $6, 1332          # encoding: [0x4d,0x01,0xc0,0x18]
24 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
25 # CHECK:   bne $9, $6, 1332       # encoding: [0x4d,0x01,0x26,0x15]
26 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
27 # CHECK:   bal     1332           # encoding: [0x4d,0x01,0x11,0x04]
28 # CHECK:   nop                    # encoding: [0x00,0x00,0x00,0x00]
29
30 .set noreorder
31
32          b 1332
33          nop
34          bc1f 1332
35          nop
36          bc1t 1332
37          nop
38          beq $9,$6,1332
39          nop
40          bgez $6,1332
41          nop
42          bgezal $6,1332
43          nop
44          bgtz $6,1332
45          nop
46          blez $6,1332
47          nop
48          bne $9,$6,1332
49          nop
50          bal 1332
51          nop
52
53 end_of_code:
54 #------------------------------------------------------------------------------
55 # Jump instructions
56 #------------------------------------------------------------------------------
57 # CHECK:   j 1328               # encoding: [0x4c,0x01,0x00,0x08]
58 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
59 # CHECK:   jal 1328             # encoding: [0x4c,0x01,0x00,0x0c]
60 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
61 # CHECK:   jalr $6              # encoding: [0x09,0xf8,0xc0,0x00]
62 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
63 # CHECK:   jalr $25             # encoding: [0x09,0xf8,0x20,0x03]
64 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
65 # CHECK:   jalr $10, $11        # encoding: [0x09,0x50,0x60,0x01]
66 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
67 # CHECK:   jr $7                # encoding: [0x08,0x00,0xe0,0x00]
68 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
69 # CHECK:   jr $7                # encoding: [0x08,0x00,0xe0,0x00]
70 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
71 # CHECK:   jalr  $25            # encoding: [0x09,0xf8,0x20,0x03]
72 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
73 # CHECK:   jalr  $4, $25        # encoding: [0x09,0x20,0x20,0x03]
74 # CHECK:   nop                  # encoding: [0x00,0x00,0x00,0x00]
75
76
77    j 1328
78    nop
79    jal 1328
80    nop
81    jalr $6
82    nop
83    jalr $31, $25
84    nop
85    jalr $10, $11
86    nop
87    jr $7
88    nop
89    j $7
90    nop
91    jal  $25
92    nop
93    jal  $4,$25
94    nop