diff options
Diffstat (limited to 'test/MC')
-rw-r--r-- | test/MC/Disassembler/Mips/micromips.txt | 24 | ||||
-rw-r--r-- | test/MC/Disassembler/Mips/micromips_le.txt | 24 | ||||
-rw-r--r-- | test/MC/Mips/micromips-branch-instructions.s | 65 | ||||
-rw-r--r-- | test/MC/Mips/micromips-branch16.s | 69 |
4 files changed, 182 insertions, 0 deletions
diff --git a/test/MC/Disassembler/Mips/micromips.txt b/test/MC/Disassembler/Mips/micromips.txt index e827326..b3de89e 100644 --- a/test/MC/Disassembler/Mips/micromips.txt +++ b/test/MC/Disassembler/Mips/micromips.txt @@ -225,3 +225,27 @@ # CHECK: jr $7 0x00 0x07 0x0f 0x3c + +# CHECK: beq $9, $6, 1332 +0x94 0xc9 0x02 0x9a + +# CHECK: bgez $6, 1332 +0x40 0x46 0x02 0x9a + +# CHECK: bgezal $6, 1332 +0x40 0x66 0x02 0x9a + +# CHECK: bltzal $6, 1332 +0x40 0x26 0x02 0x9a + +# CHECK: bgtz $6, 1332 +0x40 0xc6 0x02 0x9a + +# CHECK: blez $6, 1332 +0x40 0x86 0x02 0x9a + +# CHECK: bne $9, $6, 1332 +0xb4 0xc9 0x02 0x9a + +# CHECK: bltz $6, 1332 +0x40 0x06 0x02 0x9a diff --git a/test/MC/Disassembler/Mips/micromips_le.txt b/test/MC/Disassembler/Mips/micromips_le.txt index a42bf79..ec9679c 100644 --- a/test/MC/Disassembler/Mips/micromips_le.txt +++ b/test/MC/Disassembler/Mips/micromips_le.txt @@ -225,3 +225,27 @@ # CHECK: jr $7 0x07 0x00 0x3c 0x0f + +# CHECK: beq $9, $6, 1332 +0xc9 0x94 0x9a 0x02 + +# CHECK: bgez $6, 1332 +0x46 0x40 0x9a 0x02 + +# CHECK: bgezal $6, 1332 +0x66 0x40 0x9a 0x02 + +# CHECK: bltzal $6, 1332 +0x26 0x40 0x9a 0x02 + +# CHECK: bgtz $6, 1332 +0xc6 0x40 0x9a 0x02 + +# CHECK: blez $6, 1332 +0x86 0x40 0x9a 0x02 + +# CHECK: bne $9, $6, 1332 +0xc9 0xb4 0x9a 0x02 + +# CHECK: bltz $6, 1332 +0x06 0x40 0x9a 0x02 diff --git a/test/MC/Mips/micromips-branch-instructions.s b/test/MC/Mips/micromips-branch-instructions.s new file mode 100644 index 0000000..84df2a1 --- /dev/null +++ b/test/MC/Mips/micromips-branch-instructions.s @@ -0,0 +1,65 @@ +# RUN: llvm-mc %s -triple=mipsel -show-encoding -mattr=micromips \ +# RUN: | FileCheck %s -check-prefix=CHECK-EL +# RUN: llvm-mc %s -triple=mips -show-encoding -mattr=micromips \ +# RUN: | FileCheck %s -check-prefix=CHECK-EB +# Check that the assembler can handle the documented syntax +# for arithmetic and logical instructions. +#------------------------------------------------------------------------------ +# Branch Instructions +#------------------------------------------------------------------------------ +# Little endian +#------------------------------------------------------------------------------ +# CHECK-EL: b 1332 # encoding: [0x00,0x94,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: beq $9, $6, 1332 # encoding: [0xc9,0x94,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: bgez $6, 1332 # encoding: [0x46,0x40,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: bgezal $6, 1332 # encoding: [0x66,0x40,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: bltzal $6, 1332 # encoding: [0x26,0x40,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: bgtz $6, 1332 # encoding: [0xc6,0x40,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: blez $6, 1332 # encoding: [0x86,0x40,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: bne $9, $6, 1332 # encoding: [0xc9,0xb4,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: bal 1332 # encoding: [0x60,0x40,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EL: bltz $6, 1332 # encoding: [0x06,0x40,0x9a,0x02] +# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00] +#------------------------------------------------------------------------------ +# Big endian +#------------------------------------------------------------------------------ +# CHECK-EB: b 1332 # encoding: [0x94,0x00,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: beq $9, $6, 1332 # encoding: [0x94,0xc9,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: bgez $6, 1332 # encoding: [0x40,0x46,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: bgezal $6, 1332 # encoding: [0x40,0x66,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: bltzal $6, 1332 # encoding: [0x40,0x26,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: bgtz $6, 1332 # encoding: [0x40,0xc6,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: blez $6, 1332 # encoding: [0x40,0x86,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: bne $9, $6, 1332 # encoding: [0xb4,0xc9,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: bal 1332 # encoding: [0x40,0x60,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-EB: bltz $6, 1332 # encoding: [0x40,0x06,0x02,0x9a] +# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00] + + b 1332 + beq $9,$6,1332 + bgez $6,1332 + bgezal $6,1332 + bltzal $6,1332 + bgtz $6,1332 + blez $6,1332 + bne $9,$6,1332 + bal 1332 + bltz $6,1332 diff --git a/test/MC/Mips/micromips-branch16.s b/test/MC/Mips/micromips-branch16.s new file mode 100644 index 0000000..321ee86 --- /dev/null +++ b/test/MC/Mips/micromips-branch16.s @@ -0,0 +1,69 @@ +# RUN: llvm-mc %s -triple=mipsel-unknown-linux -show-encoding \ +# RUN: -mattr=micromips | FileCheck %s -check-prefix=CHECK-FIXUP +# RUN: llvm-mc %s -filetype=obj -triple=mipsel-unknown-linux \ +# RUN: -mattr=micromips | llvm-readobj -r \ +# RUN: | FileCheck %s -check-prefix=CHECK-ELF +#------------------------------------------------------------------------------ +# Check that the assembler can handle the documented syntax +# for relocations. +#------------------------------------------------------------------------------ +# CHECK-FIXUP: b bar # encoding: [A,0x94'A',0x00,0x00] +# CHECK-FIXUP: # fixup A - offset: 0, +# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 +# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-FIXUP: beq $3, $4, bar # encoding: [0x83'A',0x94'A',0x00,0x00] +# CHECK-FIXUP: # fixup A - offset: 0, +# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 +# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-FIXUP: bne $3, $4, bar # encoding: [0x83'A',0xb4'A',0x00,0x00] +# CHECK-FIXUP: # fixup A - offset: 0, +# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 +# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-FIXUP: bgez $4, bar # encoding: [0x44'A',0x40'A',0x00,0x00] +# CHECK-FIXUP: # fixup A - offset: 0, +# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 +# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-FIXUP: bgtz $4, bar # encoding: [0xc4'A',0x40'A',0x00,0x00] +# CHECK-FIXUP: # fixup A - offset: 0, +# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 +# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-FIXUP: blez $4, bar # encoding: [0x84'A',0x40'A',0x00,0x00] +# CHECK-FIXUP: # fixup A - offset: 0, +# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 +# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-FIXUP: bltz $4, bar # encoding: [0x04'A',0x40'A',0x00,0x00] +# CHECK-FIXUP: # fixup A - offset: 0, +# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 +# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-FIXUP: bgezal $4, bar # encoding: [0x64'A',0x40'A',0x00,0x00] +# CHECK-FIXUP: # fixup A - offset: 0, +# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 +# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] +# CHECK-FIXUP: bltzal $4, bar # encoding: [0x24'A',0x40'A',0x00,0x00] +# CHECK-FIXUP: # fixup A - offset: 0, +# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC16_S1 +# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00] +#------------------------------------------------------------------------------ +# Check that the appropriate relocations were created. +#------------------------------------------------------------------------------ +# CHECK-ELF: Relocations [ +# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 +# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 +# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 +# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 +# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 +# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 +# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 +# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 +# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC16_S1 +# CHECK-ELF: ] + + b bar + beq $3, $4, bar + bne $3, $4, bar + bgez $4, bar + bgtz $4, bar + blez $4, bar + bltz $4, bar + bgezal $4, bar + bltzal $4, bar |