1 # RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding -mcpu=mips32r2 | \
2 # RUN: FileCheck -check-prefix=CHECK32 %s
3 # RUN: llvm-mc %s -triple=mips64el-unknown-linux -show-encoding -mcpu=mips64r2 | \
4 # RUN: FileCheck -check-prefix=CHECK64 %s
6 # Check that the assembler can handle the documented syntax
7 # for jumps and branches.
8 #------------------------------------------------------------------------------
10 #------------------------------------------------------------------------------
11 # CHECK32: b 1332 # encoding: [0x4d,0x01,0x00,0x10]
12 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
13 # CHECK32: bc1f 1332 # encoding: [0x4d,0x01,0x00,0x45]
14 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
15 # CHECK32: bc1t 1332 # encoding: [0x4d,0x01,0x01,0x45]
16 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
17 # CHECK32: beq $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x11]
18 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
19 # CHECK32: bgez $6, 1332 # encoding: [0x4d,0x01,0xc1,0x04]
20 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
21 # CHECK32: bgezal $6, 1332 # encoding: [0x4d,0x01,0xd1,0x04]
22 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
23 # CHECK32: bgtz $6, 1332 # encoding: [0x4d,0x01,0xc0,0x1c]
24 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
25 # CHECK32: blez $6, 1332 # encoding: [0x4d,0x01,0xc0,0x18]
26 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
27 # CHECK32: bne $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x15]
28 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
29 # CHECK32: bal 1332 # encoding: [0x4d,0x01,0x11,0x04]
30 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
31 # CHECK32: bnez $11, 1332 # encoding: [0x4d,0x01,0x60,0x15]
32 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
33 # CHECK32: beqz $11, 1332 # encoding: [0x4d,0x01,0x60,0x11]
34 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
36 # CHECK64: b 1332 # encoding: [0x4d,0x01,0x00,0x10]
37 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
38 # CHECK64: bc1f 1332 # encoding: [0x4d,0x01,0x00,0x45]
39 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
40 # CHECK64: bc1t 1332 # encoding: [0x4d,0x01,0x01,0x45]
41 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
42 # CHECK64: beq $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x11]
43 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
44 # CHECK64: bgez $6, 1332 # encoding: [0x4d,0x01,0xc1,0x04]
45 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
46 # CHECK64: bgezal $6, 1332 # encoding: [0x4d,0x01,0xd1,0x04]
47 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
48 # CHECK64: bgtz $6, 1332 # encoding: [0x4d,0x01,0xc0,0x1c]
49 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
50 # CHECK64: blez $6, 1332 # encoding: [0x4d,0x01,0xc0,0x18]
51 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
52 # CHECK64: bne $9, $6, 1332 # encoding: [0x4d,0x01,0x26,0x15]
53 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
54 # CHECK64: bal 1332 # encoding: [0x4d,0x01,0x11,0x04]
55 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
56 # CHECK64: bnez $11, 1332 # encoding: [0x4d,0x01,0x60,0x15]
57 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
58 # CHECK64: beqz $11, 1332 # encoding: [0x4d,0x01,0x60,0x11]
59 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
89 #------------------------------------------------------------------------------
91 #------------------------------------------------------------------------------
92 # CHECK32: j 1328 # encoding: [0x4c,0x01,0x00,0x08]
93 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
94 # CHECK32: jal 1328 # encoding: [0x4c,0x01,0x00,0x0c]
95 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
96 # CHECK32: jalr $6 # encoding: [0x09,0xf8,0xc0,0x00]
97 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
98 # CHECK32: jalr $25 # encoding: [0x09,0xf8,0x20,0x03]
99 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
100 # CHECK32: jalr $10, $11 # encoding: [0x09,0x50,0x60,0x01]
101 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
102 # CHECK32: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
103 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
105 # CHECK32: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
106 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
107 # CHECK32: jalr $25 # encoding: [0x09,0xf8,0x20,0x03]
108 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
109 # CHECK32: jalr $4, $25 # encoding: [0x09,0x20,0x20,0x03]
110 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
111 # CHECK32: jalx lab # encoding: [A,A,A,0b011101AA]
112 # CHECK32: # fixup A - offset: 0, value: lab, kind: fixup_Mips_26
113 # CHECK32: nop # encoding: [0x00,0x00,0x00,0x00]
115 # CHECK64: j 1328 # encoding: [0x4c,0x01,0x00,0x08]
116 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
117 # CHECK64: jal 1328 # encoding: [0x4c,0x01,0x00,0x0c]
118 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
119 # CHECK64: jalr $6 # encoding: [0x09,0xf8,0xc0,0x00]
120 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
121 # CHECK64: jalr $25 # encoding: [0x09,0xf8,0x20,0x03]
122 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
123 # CHECK64: jalr $10, $11 # encoding: [0x09,0x50,0x60,0x01]
124 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
125 # CHECK64: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
126 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
128 # CHECK64: jr $7 # encoding: [0x08,0x00,0xe0,0x00]
129 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
130 # CHECK64: jalr $25 # encoding: [0x09,0xf8,0x20,0x03]
131 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
132 # CHECK64: jalr $4, $25 # encoding: [0x09,0x20,0x20,0x03]
133 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]
134 # CHECK64: jalx lab # encoding: [A,A,A,0b011101AA]
135 # CHECK64: # fixup A - offset: 0, value: lab, kind: fixup_Mips_26
136 # CHECK64: nop # encoding: [0x00,0x00,0x00,0x00]