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 # CHECK: bal 1332 # encoding: [0x34,0x05,0x11,0x04] 27 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 28 b 1332 29 nop 30 bc1f 1332 31 nop 32 bc1t 1332 33 nop 34 beq $9,$6,1332 35 nop 36 bgez $6,1332 37 nop 38 bgezal $6,1332 39 nop 40 bgtz $6,1332 41 nop 42 blez $6,1332 43 nop 44 bne $9,$6,1332 45 nop 46 bal 1332 47 nop 48 49 end_of_code: 50 #------------------------------------------------------------------------------ 51 # Jump instructions 52 #------------------------------------------------------------------------------ 53 # CHECK: j 1328 # encoding: [0x30,0x05,0x00,0x08] 54 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 55 # CHECK: jal 1328 # encoding: [0x30,0x05,0x00,0x0c] 56 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 57 # CHECK: jalr $6 # encoding: [0x09,0xf8,0xc0,0x00] 58 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 59 # CHECK: jalr $25 # encoding: [0x09,0xf8,0x20,0x03] 60 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 61 # CHECK: jalr $10, $11 # encoding: [0x09,0x50,0x60,0x01] 62 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 63 # CHECK: jr $7 # encoding: [0x08,0x00,0xe0,0x00] 64 # CHECK: nop # encoding: [0x00,0x00,0x00,0x00] 65 # CHECK: jr $7 # encoding: [0x08,0x00,0xe0,0x00] 66 67 68 j 1328 69 nop 70 jal 1328 71 nop 72 jalr $6 73 nop 74 jalr $31, $25 75 nop 76 jalr $10, $11 77 nop 78 jr $7 79 nop 80 j $7 81