summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorJozef Kolek <jozef.kolek@imgtec.com>2015-01-12 12:03:34 +0000
committerJozef Kolek <jozef.kolek@imgtec.com>2015-01-12 12:03:34 +0000
commit9761e96b011f0ef7ca380a25c96d3c04fed84b2d (patch)
tree50213d30dbb27612f4d03aae6cc0dddaadad6119 /llvm/test
parentb70f83eb10c498850b8d099e68b4e3fc13501b17 (diff)
downloadbcm5719-llvm-9761e96b011f0ef7ca380a25c96d3c04fed84b2d.tar.gz
bcm5719-llvm-9761e96b011f0ef7ca380a25c96d3c04fed84b2d.zip
[mips][microMIPS] Implement BEQZ16 and BNEZ16 instructions
Differential Revision: http://reviews.llvm.org/D5271 llvm-svn: 225627
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/MC/Disassembler/Mips/micromips.txt6
-rw-r--r--llvm/test/MC/Disassembler/Mips/micromips_le.txt6
-rw-r--r--llvm/test/MC/Mips/micromips-16-bit-instructions.s10
-rw-r--r--llvm/test/MC/Mips/micromips-bad-branches.s8
-rw-r--r--llvm/test/MC/Mips/micromips-branch7.s27
-rw-r--r--llvm/test/MC/Mips/micromips-invalid.s2
6 files changed, 59 insertions, 0 deletions
diff --git a/llvm/test/MC/Disassembler/Mips/micromips.txt b/llvm/test/MC/Disassembler/Mips/micromips.txt
index 9acad9f8692..07c1df91441 100644
--- a/llvm/test/MC/Disassembler/Mips/micromips.txt
+++ b/llvm/test/MC/Disassembler/Mips/micromips.txt
@@ -468,3 +468,9 @@
# CHECK: sw $4, 124($sp)
0xc8 0x9f
+
+# CHECK: beqz16 $6, 20
+0x8f 0x0a
+
+# CHECK: bnez16 $6, 20
+0xaf 0x0a
diff --git a/llvm/test/MC/Disassembler/Mips/micromips_le.txt b/llvm/test/MC/Disassembler/Mips/micromips_le.txt
index 1015c24c159..9a8c4a94530 100644
--- a/llvm/test/MC/Disassembler/Mips/micromips_le.txt
+++ b/llvm/test/MC/Disassembler/Mips/micromips_le.txt
@@ -468,3 +468,9 @@
# CHECK: sw $4, 124($sp)
0x9f 0xc8
+
+# CHECK: beqz16 $6, 20
+0x0a 0x8f
+
+# CHECK: bnez16 $6, 20
+0x0a 0xaf
diff --git a/llvm/test/MC/Mips/micromips-16-bit-instructions.s b/llvm/test/MC/Mips/micromips-16-bit-instructions.s
index 7a9e84baa3d..8fd6d450ac9 100644
--- a/llvm/test/MC/Mips/micromips-16-bit-instructions.s
+++ b/llvm/test/MC/Mips/micromips-16-bit-instructions.s
@@ -49,6 +49,10 @@
# CHECK-EL: nop # encoding: [0x00,0x0c]
# CHECK-EL: jr16 $9 # encoding: [0x89,0x45]
# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-EL: beqz16 $6, 20 # encoding: [0x0a,0x8f]
+# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-EL: bnez16 $6, 20 # encoding: [0x0a,0xaf]
+# CHECK-EL: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK-EL: break16 8 # encoding: [0x88,0x46]
# CHECK-EL: sdbbp16 14 # encoding: [0xce,0x46]
#------------------------------------------------------------------------------
@@ -94,6 +98,10 @@
# CHECK-EB: nop # encoding: [0x0c,0x00]
# CHECK-EB: jr16 $9 # encoding: [0x45,0x89]
# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-EB: beqz16 $6, 20 # encoding: [0x8f,0x0a]
+# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-EB: bnez16 $6, 20 # encoding: [0xaf,0x0a]
+# CHECK-EB: nop # encoding: [0x00,0x00,0x00,0x00]
# CHECK-EB: break16 8 # encoding: [0x46,0x88]
# CHECK-EB: sdbbp16 14 # encoding: [0x46,0xce]
@@ -135,5 +143,7 @@
jraddiusp 20
jalrs16 $9
jr16 $9
+ beqz16 $6, 20
+ bnez16 $6, 20
break16 8
sdbbp16 14
diff --git a/llvm/test/MC/Mips/micromips-bad-branches.s b/llvm/test/MC/Mips/micromips-bad-branches.s
index 573605e18d6..f64cd9f9e5b 100644
--- a/llvm/test/MC/Mips/micromips-bad-branches.s
+++ b/llvm/test/MC/Mips/micromips-bad-branches.s
@@ -126,6 +126,11 @@
# CHECK: error: branch target out of range
# CHECK: bc1t $fcc0, 65536
+# CHECK: error: branch to misaligned address
+# CHECK: beqz16 $6, 31
+# CHECK: error: branch target out of range
+# CHECK: beqz16 $6, 130
+
b -65535
b -65536
b -65537
@@ -223,3 +228,6 @@
bc1t $fcc0, 65534
bc1t $fcc0, 65535
bc1t $fcc0, 65536
+
+ beqz16 $6, 31
+ beqz16 $6, 130
diff --git a/llvm/test/MC/Mips/micromips-branch7.s b/llvm/test/MC/Mips/micromips-branch7.s
new file mode 100644
index 00000000000..deb7307e938
--- /dev/null
+++ b/llvm/test/MC/Mips/micromips-branch7.s
@@ -0,0 +1,27 @@
+# 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: beqz16 $6, bar # encoding: [0b0AAAAAAA,0x8f]
+# CHECK-FIXUP: # fixup A - offset: 0,
+# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC7_S1
+# CHECK-FIXUP: nop # encoding: [0x00,0x00,0x00,0x00]
+# CHECK-FIXUP: bnez16 $6, bar # encoding: [0b0AAAAAAA,0xaf]
+# CHECK-FIXUP: # fixup A - offset: 0,
+# CHECK-FIXUP: value: bar, kind: fixup_MICROMIPS_PC7_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_PC7_S1
+# CHECK-ELF: 0x{{[0-9,A-F]+}} R_MICROMIPS_PC7_S1
+# CHECK-ELF: ]
+
+ beqz16 $6, bar
+ bnez16 $6, bar
diff --git a/llvm/test/MC/Mips/micromips-invalid.s b/llvm/test/MC/Mips/micromips-invalid.s
index b94313a7fc1..1dbfb113a2c 100644
--- a/llvm/test/MC/Mips/micromips-invalid.s
+++ b/llvm/test/MC/Mips/micromips-invalid.s
@@ -64,3 +64,5 @@
sw16 $7, 4($10) # CHECK: :[[@LINE]]:{{[0-9]+}}: error: invalid operand for instruction
cache 256, 8($5) # CHECK: :[[@LINE]]:{{[0-9]+}}: error: immediate operand value out of range
pref 256, 8($5) # CHECK: :[[@LINE]]:{{[0-9]+}}: error: immediate operand value out of range
+ beqz16 $9, 20 # CHECK: :[[@LINE]]:{{[0-9]+}}: error: invalid operand for instruction
+ bnez16 $9, 20 # CHECK: :[[@LINE]]:{{[0-9]+}}: error: invalid operand for instruction
OpenPOWER on IntegriCloud