[binutils-gdb/binutils-2_28-branch] MIPS16/GAS: Disallow EXTEND delay-slot scheduling
Maciej W.Rozycki
macro@sourceware.org
Fri Dec 23 20:39:00 GMT 2016
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=48cabe0351a327a24491846027791916681fcff5
commit 48cabe0351a327a24491846027791916681fcff5
Author: Maciej W. Rozycki <macro@imgtec.com>
Date: Fri Dec 23 12:37:40 2016 +0000
MIPS16/GAS: Disallow EXTEND delay-slot scheduling
Do not allow any explicitly coded EXTEND instruction to be automatically
scheduled into a jump delay slot, as an EXTEND prefix is coupled with
the next regular MIPS16 instruction and therefore swapping it with a
jump would change program's semantics; EXTEND is not architecturally
allowed to be present in a jump delay slot anyway.
opcodes/
* mips16-opc.c (mips16_opcodes): Set NODS in `pinfo' for
"extend".
gas/
* testsuite/gas/mips/mips16-extend-swap.d: New test.
* testsuite/gas/mips/mips16-extend-swap.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new test.
(cherry picked from commit 645c455650ed35460afdacb078c7c58308607fbe)
Diff:
---
gas/ChangeLog | 11 +++++++++++
gas/testsuite/gas/mips/mips.exp | 1 +
gas/testsuite/gas/mips/mips16-extend-swap.d | 22 ++++++++++++++++++++++
gas/testsuite/gas/mips/mips16-extend-swap.s | 21 +++++++++++++++++++++
opcodes/ChangeLog | 5 +++++
opcodes/mips16-opc.c | 2 +-
6 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e97d00a..53fa952 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,14 @@
+2016-12-23 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/gas/mips/mips16-extend-swap.d: New test.
+ * testsuite/gas/mips/mips16-extend-swap.s: New test source.
+ * testsuite/gas/mips/mips.exp: Run the new test.
+
+2016-12-23 Joe Seymour <joe.s@somniumtech.com>
+
+ * config/tc-msp430.c (msp430_mcu_data): Sync with data from TI's
+ devices.csv file as of September 2016.
+
2016-12-23 Tristan Gingold <gingold@adacore.com>
* configure: Regenerate.
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index cd62e44..c16891a 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1341,6 +1341,7 @@ if { [istarget mips*-*-vxworks*] } {
run_list_test "mips16e-save-err" "-march=mips32 -32"
run_dump_test "mips16-intermix"
run_dump_test "mips16-extend"
+ run_dump_test "mips16-extend-swap"
run_dump_test "mips16-sprel-swap"
run_dump_test "mips16-sdrasp"
diff --git a/gas/testsuite/gas/mips/mips16-extend-swap.d b/gas/testsuite/gas/mips/mips16-extend-swap.d
new file mode 100644
index 0000000..eb9dd73
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-extend-swap.d
@@ -0,0 +1,22 @@
+#objdump: -d --prefix-addresses --show-raw-insn
+#name: MIPS16 jump delay slot scheduling for EXTEND instructions
+#as: -32
+
+# Verify that EXTEND instructions are not scheduled into a jump delay slot.
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> f123 extend 0x123
+[0-9a-f]+ <[^>]*> 1800 0000 jal 00000000 <foo>
+[0-9a-f]+ <[^>]*> 6500 nop
+[0-9a-f]+ <[^>]*> f123 extend 0x123
+[0-9a-f]+ <[^>]*> 1c00 0000 jalx 00000000 <foo>
+[0-9a-f]+ <[^>]*> 6500 nop
+[0-9a-f]+ <[^>]*> f123 eb00 jr v1
+[0-9a-f]+ <[^>]*> 6500 nop
+[0-9a-f]+ <[^>]*> f123 e820 jr ra
+[0-9a-f]+ <[^>]*> 6500 nop
+[0-9a-f]+ <[^>]*> f123 eb40 jalr v1
+[0-9a-f]+ <[^>]*> 6500 nop
+ \.\.\.
diff --git a/gas/testsuite/gas/mips/mips16-extend-swap.s b/gas/testsuite/gas/mips/mips16-extend-swap.s
new file mode 100644
index 0000000..c299cf1
--- /dev/null
+++ b/gas/testsuite/gas/mips/mips16-extend-swap.s
@@ -0,0 +1,21 @@
+ .set mips1
+ .set mips16
+foo:
+ extend 0x123
+ jal bar
+
+ extend 0x123
+ jalx baz
+
+ extend 0x123
+ jr $3
+
+ extend 0x123
+ jr $31
+
+ extend 0x123
+ jalr $3
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 4, 0
+ .space 16
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 9938992..5166be4 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,10 @@
2016-12-23 Maciej W. Rozycki <macro@imgtec.com>
+ * mips16-opc.c (mips16_opcodes): Set NODS in `pinfo' for
+ "extend".
+
+2016-12-23 Maciej W. Rozycki <macro@imgtec.com>
+
* mips-dis.c (set_default_mips_dis_options): Use
HAVE_BFD_MIPS_ELF_GET_ABIFLAGS rather than BFD64 to guard the
call to `bfd_mips_elf_get_abiflags'.
diff --git a/opcodes/mips16-opc.c b/opcodes/mips16-opc.c
index 758b78f..7d430dd 100644
--- a/opcodes/mips16-opc.c
+++ b/opcodes/mips16-opc.c
@@ -357,7 +357,7 @@ const struct mips_opcode mips16_opcodes[] =
{"zew", "x", 0xe851, 0xf8ff, MOD_1, 0, I64, 0, 0 },
/* Place EXTEND last so that it catches any prefix that didn't match
anything. */
-{"extend", "e", 0xf000, 0xf800, 0, 0, I1, 0, 0 },
+{"extend", "e", 0xf000, 0xf800, NODS, 0, I1, 0, 0 },
};
const int bfd_mips16_num_opcodes =
More information about the Binutils-cvs
mailing list