This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed] MIPS16/opcodes: Use hexadecimal interpretation for the `e' operand code
- From: "Maciej W. Rozycki" <macro at imgtec dot com>
- To: <binutils at sourceware dot org>
- Date: Fri, 9 Dec 2016 23:27:18 +0000
- Subject: [committed] MIPS16/opcodes: Use hexadecimal interpretation for the `e' operand code
- Authentication-results: sourceware.org; auth=none
Make the `e' operand code used with raw EXTEND instructions use the
hexadecimal rather than decimal format, for consistency with what is
actually produced by code in `print_insn_mips16' dedicated to EXTEND
disassembly. Due to that special handling the operand code is only
interpreted for assembly however, which accepts either format either
way, so there is no functional change here.
opcodes/
* mips16-opc.c (decode_mips16_operand) <'e'>: Use HINT rather
than UINT.
gas/
* testsuite/gas/mips/mips16-extend.d: New test.
* testsuite/gas/mips/mips16-extend.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new test.
---
binutils-mips16-opcode-extend-hex.diff
Index: binutils/gas/testsuite/gas/mips/mips.exp
===================================================================
--- binutils.orig/gas/testsuite/gas/mips/mips.exp 2016-12-09 21:53:46.917515958 +0000
+++ binutils/gas/testsuite/gas/mips/mips.exp 2016-12-09 21:53:48.000000000 +0000
@@ -1295,6 +1295,7 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "mips16e-64"
run_list_test "mips16e-64" "-march=mips32 -32"
run_dump_test "mips16-intermix"
+ run_dump_test "mips16-extend"
run_dump_test "vxworks1"
run_dump_test "vxworks1-xgot"
Index: binutils/gas/testsuite/gas/mips/mips16-extend.d
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/gas/testsuite/gas/mips/mips16-extend.d 2016-12-09 21:53:48.000000000 +0000
@@ -0,0 +1,16 @@
+#objdump: -d --prefix-addresses --show-raw-insn
+#name: MIPS16 explicit EXTEND encoding
+#as: -32
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> f000 0000 addiu s0,sp,0
+[0-9a-f]+ <[^>]*> f001 0000 addiu s0,sp,2048
+[0-9a-f]+ <[^>]*> f5a5 0000 addiu s0,sp,11680
+[0-9a-f]+ <[^>]*> f7ff 0000 addiu s0,sp,-32
+[0-9a-f]+ <[^>]*> f123 0000 addiu s0,sp,6432
+[0-9a-f]+ <[^>]*> f432 0000 addiu s0,sp,-27616
+[0-9a-f]+ <[^>]*> f789 0000 addiu s0,sp,20352
+[0-9a-f]+ <[^>]*> f7ff 0000 addiu s0,sp,-32
+ \.\.\.
Index: binutils/gas/testsuite/gas/mips/mips16-extend.s
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils/gas/testsuite/gas/mips/mips16-extend.s 2016-12-09 21:53:48.000000000 +0000
@@ -0,0 +1,23 @@
+ .set mips16
+ .set noreorder
+foo:
+ extend 0
+ addiu $16, $29, 0
+ extend 1
+ addiu $16, $29, 0
+ extend 1445
+ addiu $16, $29, 0
+ extend 2047
+ addiu $16, $29, 0
+ extend 0x123
+ addiu $16, $29, 0
+ extend 0x432
+ addiu $16, $29, 0
+ extend 0x789
+ addiu $16, $29, 0
+ extend 0x7ff
+ addiu $16, $29, 0
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
Index: binutils/opcodes/mips16-opc.c
===================================================================
--- binutils.orig/opcodes/mips16-opc.c 2016-12-09 21:51:06.321604449 +0000
+++ binutils/opcodes/mips16-opc.c 2016-12-09 22:33:11.402945660 +0000
@@ -61,7 +61,7 @@ decode_mips16_operand (char type, bfd_bo
case 'Z': MAPPED_REG (3, 0, GP, reg_m16_map);
case 'a': JUMP (26, 0, 2);
- case 'e': UINT (11, 0);
+ case 'e': HINT (11, 0);
case 'i': JALX (26, 0, 2);
case 'l': SPECIAL (6, 5, ENTRY_EXIT_LIST);
case 'm': SPECIAL (7, 0, SAVE_RESTORE_LIST);