This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] MIPS: Add MIPS32r2 SYNC variants
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: binutils at sourceware dot org
- Date: Wed, 25 Aug 2010 01:44:03 +0100 (BST)
- Subject: [PATCH] MIPS: Add MIPS32r2 SYNC variants
Hello,
The MIPS32r2 spec rev. 2.61 has added a couple of aliases for the SYNC
instruction with specific values of the "stype" argument. Here's a change
to add them to the list of opcodes supported, together with an appropriate
test case. Octeon-specific names take precedence hence the
non-alphabetical order.
2010-08-25 Maciej W. Rozycki <macro@codesourcery.com>
opcodes/
* mips-opc.c (mips_builtin_opcodes): Add "sync_acquire",
"sync_mb", "sync_release", "sync_rmb" and "sync_wmb".
gas/testsuite/
* gas/mips/mips32r2-sync.d: New test for MIPS32r2 "sync"
instruction variants.
* gas/mips/octeon@mips32r2-sync.d: Likewise, Octeon version.
* gas/mips/mips32r2-sync.s: Source for the new test.
* gas/mips/mips.exp: Run the new test.
Regression-tested successfully. OK to apply?
Maciej
binutils-mips32r2-sync.diff
Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips.exp
===================================================================
--- binutils-fsf-trunk-quilt.orig/gas/testsuite/gas/mips/mips.exp 2010-08-25 00:54:18.000000000 +0100
+++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips.exp 2010-08-25 01:14:47.000000000 +0100
@@ -877,6 +877,8 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "mips16-vis-1"
run_dump_test "call-nonpic-1"
run_dump_test "mips32-sync"
+ run_dump_test_arches "mips32r2-sync" \
+ [mips_arch_list_matching mips32r2]
if $has_newabi { run_dump_test "cfi-n64-1" }
Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips32r2-sync.d
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips32r2-sync.d 2010-08-25 01:28:21.000000000 +0100
@@ -0,0 +1,29 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS32r2 sync instructions
+#as: -32
+#source: mips32r2-sync.s
+
+# Check MIPS32r2 sync instructions assembly and disassembly
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> 0000000f sync
+[0-9a-f]+ <[^>]*> 0000008f sync 0x2
+[0-9a-f]+ <[^>]*> 0000010f sync_wmb
+[0-9a-f]+ <[^>]*> 0000020f sync 0x8
+[0-9a-f]+ <[^>]*> 0000040f sync_mb
+[0-9a-f]+ <[^>]*> 0000044f sync_acquire
+[0-9a-f]+ <[^>]*> 0000048f sync_release
+[0-9a-f]+ <[^>]*> 000004cf sync_rmb
+[0-9a-f]+ <[^>]*> 0000060f sync 0x18
+[0-9a-f]+ <[^>]*> 0000000f sync
+[0-9a-f]+ <[^>]*> 0000008f sync 0x2
+[0-9a-f]+ <[^>]*> 0000010f sync_wmb
+[0-9a-f]+ <[^>]*> 0000020f sync 0x8
+[0-9a-f]+ <[^>]*> 0000040f sync_mb
+[0-9a-f]+ <[^>]*> 0000044f sync_acquire
+[0-9a-f]+ <[^>]*> 0000048f sync_release
+[0-9a-f]+ <[^>]*> 000004cf sync_rmb
+[0-9a-f]+ <[^>]*> 0000060f sync 0x18
+ \.\.\.
Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips32r2-sync.s
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/mips32r2-sync.s 2010-08-25 01:14:01.000000000 +0100
@@ -0,0 +1,26 @@
+# Source file to test assembly of MIPS32r2 sync instructions.
+
+ .text
+foo:
+ sync
+ sync 2
+ sync_wmb
+ sync 8
+ sync_mb
+ sync_acquire
+ sync_release
+ sync_rmb
+ sync 0x18
+ sync 0
+ sync 2
+ sync 4
+ sync 8
+ sync 0x10
+ sync 0x11
+ sync 0x12
+ sync 0x13
+ sync 0x18
+
+# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
+ .align 2
+ .space 8
Index: binutils-fsf-trunk-quilt/opcodes/mips-opc.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/opcodes/mips-opc.c 2010-08-25 00:54:18.000000000 +0100
+++ binutils-fsf-trunk-quilt/opcodes/mips-opc.c 2010-08-25 01:20:04.000000000 +0100
@@ -1335,6 +1335,11 @@ const struct mips_opcode mips_builtin_op
{"syncs", "", 0x0000018f, 0xffffffff, INSN_SYNC, 0, IOCT },
{"syncw", "", 0x0000010f, 0xffffffff, INSN_SYNC, 0, IOCT },
{"syncws", "", 0x0000014f, 0xffffffff, INSN_SYNC, 0, IOCT },
+{"sync_acquire", "", 0x0000044f, 0xffffffff, INSN_SYNC, 0, I33 },
+{"sync_mb", "", 0x0000040f, 0xffffffff, INSN_SYNC, 0, I33 },
+{"sync_release", "", 0x0000048f, 0xffffffff, INSN_SYNC, 0, I33 },
+{"sync_rmb", "", 0x000004cf, 0xffffffff, INSN_SYNC, 0, I33 },
+{"sync_wmb", "", 0x0000010f, 0xffffffff, INSN_SYNC, 0, I33 },
{"sync", "", 0x0000000f, 0xffffffff, INSN_SYNC, 0, I2|G1 },
{"sync", "1", 0x0000000f, 0xfffff83f, INSN_SYNC, 0, I32 },
{"sync.p", "", 0x0000040f, 0xffffffff, INSN_SYNC, 0, I2 },
Index: binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/octeon@mips32r2-sync.d
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ binutils-fsf-trunk-quilt/gas/testsuite/gas/mips/octeon@mips32r2-sync.d 2010-08-25 01:31:11.000000000 +0100
@@ -0,0 +1,29 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: MIPS32r2 sync instructions
+#as: -32
+#source: mips32r2-sync.s
+
+# Check MIPS32r2 sync instructions assembly and disassembly (Octeon).
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> 0000000f sync
+[0-9a-f]+ <[^>]*> 0000008f synciobdma
+[0-9a-f]+ <[^>]*> 0000010f syncw
+[0-9a-f]+ <[^>]*> 0000020f sync 0x8
+[0-9a-f]+ <[^>]*> 0000040f sync_mb
+[0-9a-f]+ <[^>]*> 0000044f sync_acquire
+[0-9a-f]+ <[^>]*> 0000048f sync_release
+[0-9a-f]+ <[^>]*> 000004cf sync_rmb
+[0-9a-f]+ <[^>]*> 0000060f sync 0x18
+[0-9a-f]+ <[^>]*> 0000000f sync
+[0-9a-f]+ <[^>]*> 0000008f synciobdma
+[0-9a-f]+ <[^>]*> 0000010f syncw
+[0-9a-f]+ <[^>]*> 0000020f sync 0x8
+[0-9a-f]+ <[^>]*> 0000040f sync_mb
+[0-9a-f]+ <[^>]*> 0000044f sync_acquire
+[0-9a-f]+ <[^>]*> 0000048f sync_release
+[0-9a-f]+ <[^>]*> 000004cf sync_rmb
+[0-9a-f]+ <[^>]*> 0000060f sync 0x18
+ \.\.\.