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