[PATCH v2 3/3] MIPS: Fix testcase for MIPSr6

YunQiang Su yunqiang.su@cipunited.com
Sun Mar 28 03:41:06 GMT 2021


From: YunQiang Su <ysu@wavecomp.com>

The major changes include:
   1. disable microMIPS and MIPS16 for r6
   2. FP64 only support for 32r6, so Tag_GNU_MIPS_ABI_FP changes
   3. Encoding for jr changed: 03e00008 -> 03e00009
   4. Some insn removed: jalx, eva, lwl, addi
   5. MIPSr6 supports NAN2008 only, so drop lagacy nan tests

ChangeLog:
2021-03-08  YunQiang Su  <ysu@wavecomp.com>
	* binutils/testsuite/binutils-all/mips/global-local-symtab-final-n32.d:
	  remove -mips3, since it conflicts with -march=from-abi for r6.
	* binutils/testsuite/binutils-all/mips/global-local-symtab-final-n64.d: Likewise
	* binutils/testsuite/binutils-all/mips/global-local-symtab-n32.d: Likewise
	* binutils/testsuite/binutils-all/mips/global-local-symtab-n32t.d: Likewise
	* binutils/testsuite/binutils-all/mips/global-local-symtab-n64.d: Likewise
	* binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32.d: Likewise
	* binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32t.d: Likewise
	* binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64.d: Likewise
	* binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d: Likewise
	* binutils/testsuite/binutils-all/mips/mips-xpa-virt-1.d: R6 encoding changes
	* binutils/testsuite/binutils-all/mips/mips-xpa-virt-2.d: Likewise
	* binutils/testsuite/binutils-all/mips/mips-xpa-virt-3.d: Likewise
	* binutils/testsuite/binutils-all/mips/mips.exp: disable mips16 for r6
	* gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d: r6 support FP64 only
	* gas/testsuite/gas/mips/branch-section-1.d: r6 encoding changes
	* gas/testsuite/gas/mips/branch-section-3.d: Likewise
	* gas/testsuite/gas/mips/branch-weak-1.d: Likewise
	* gas/testsuite/gas/mips/elf-rel.s: r6 removes addi
	* gas/testsuite/gas/mips/elfel-rel.d: Likewise
	* gas/testsuite/gas/mips/mips.exp: Disable some tests for r6
	* gas/testsuite/gas/mips/mipsr6@beq.d: New test for R6.
	* gas/testsuite/gas/mips/mipsr6@cache.d: Likewise
	* gas/testsuite/gas/mips/mipsr6@hwr-names.d: Likewise
	* gas/testsuite/gas/mips/mipsr6@mips32.d: Likewise
	* gas/testsuite/gas/mips/mipsr6@pref.d: Likewise
	* gas/testsuite/gas/mips/option-pic-1.d: r6 encoding changes
	* ld/testsuite/ld-mips-elf/attr-gnu-4-01.d: r6 support FP64 only
	* ld/testsuite/ld-mips-elf/attr-gnu-4-11.d: Likewise
	* ld/testsuite/ld-mips-elf/attr-gnu-4-41.d: Likewise
	* ld/testsuite/ld-mips-elf/attr-gnu-8-00.d: Likewise
	* ld/testsuite/ld-mips-elf/attr-gnu-8-01.d: Likewise
	* ld/testsuite/ld-mips-elf/attr-gnu-8-02.d: Likewise
	* ld/testsuite/ld-mips-elf/attr-gnu-8-10.d: Likewise
	* ld/testsuite/ld-mips-elf/attr-gnu-8-11.d: Likewise
	* ld/testsuite/ld-mips-elf/attr-gnu-8-20.d: Likewise
	* ld/testsuite/ld-mips-elf/attr-gnu-8-22.d: Likewise
	* ld/testsuite/ld-mips-elf/emit-relocs-1.d: r6 encoding changes
	* ld/testsuite/ld-mips-elf/export-class-call16-n32.dd: Likewise
	* ld/testsuite/ld-mips-elf/export-class-call16-n64.dd: Likewise
	* ld/testsuite/ld-mips-elf/export-class-call16-o32.dd: Likewise
	* ld/testsuite/ld-mips-elf/gp-disp-sym.s: r6 removes addi
	* ld/testsuite/ld-mips-elf/jalr3.dd: r6 encoding changes
	* ld/testsuite/ld-mips-elf/jalr4.dd: Likewise
	* ld/testsuite/ld-mips-elf/mips-elf.exp:
          use var abi_as64flags instead of hardcoded -mips3
	  disable test not suitable for r6
	* ld/testsuite/ld-mips-elf/n64-plt-1.dd: r6 encoding changes
	* ld/testsuite/ld-mips-elf/n64-plt-4.dd: Likewise
	* ld/testsuite/ld-mips-elf/pic-and-nonpic-2.d: Likewise
---
 .../mips/global-local-symtab-final-n32.d      |   2 +-
 .../mips/global-local-symtab-final-n64.d      |   2 +-
 .../mips/global-local-symtab-n32.d            |   2 +-
 .../mips/global-local-symtab-n32t.d           |   2 +-
 .../mips/global-local-symtab-n64.d            |   2 +-
 .../mips/global-local-symtab-sort-n32.d       |   2 +-
 .../mips/global-local-symtab-sort-n32t.d      |   2 +-
 .../mips/global-local-symtab-sort-n64.d       |   2 +-
 .../mips/global-local-symtab-sort-n64t.d      |   2 +-
 .../binutils-all/mips/mips-xpa-virt-1.d       |   8 +-
 .../binutils-all/mips/mips-xpa-virt-2.d       |   4 +-
 .../binutils-all/mips/mips-xpa-virt-3.d       |   4 +-
 binutils/testsuite/binutils-all/mips/mips.exp |   4 +
 gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d   |   2 +-
 gas/testsuite/gas/mips/branch-section-1.d     |   2 +-
 gas/testsuite/gas/mips/branch-section-3.d     |   2 +-
 gas/testsuite/gas/mips/branch-weak-1.d        |   2 +-
 gas/testsuite/gas/mips/elf-rel.s              |  36 +-
 gas/testsuite/gas/mips/elfel-rel.d            |  12 +-
 gas/testsuite/gas/mips/mips.exp               | 969 ++++++++++--------
 gas/testsuite/gas/mips/mipsr6@beq.d           |   2 +-
 gas/testsuite/gas/mips/mipsr6@cache.d         |   2 +-
 gas/testsuite/gas/mips/mipsr6@hwr-names.d     |   2 +-
 gas/testsuite/gas/mips/mipsr6@mips32.d        |   4 +-
 gas/testsuite/gas/mips/mipsr6@pref.d          |   2 +-
 gas/testsuite/gas/mips/option-pic-1.d         |   2 +-
 ld/testsuite/ld-mips-elf/attr-gnu-4-01.d      |   1 +
 ld/testsuite/ld-mips-elf/attr-gnu-4-11.d      |   1 +
 ld/testsuite/ld-mips-elf/attr-gnu-4-41.d      |   1 +
 ld/testsuite/ld-mips-elf/attr-gnu-8-00.d      |   2 +-
 ld/testsuite/ld-mips-elf/attr-gnu-8-01.d      |   2 +-
 ld/testsuite/ld-mips-elf/attr-gnu-8-02.d      |   2 +-
 ld/testsuite/ld-mips-elf/attr-gnu-8-10.d      |   2 +-
 ld/testsuite/ld-mips-elf/attr-gnu-8-11.d      |   2 +-
 ld/testsuite/ld-mips-elf/attr-gnu-8-20.d      |   2 +-
 ld/testsuite/ld-mips-elf/attr-gnu-8-22.d      |   2 +-
 ld/testsuite/ld-mips-elf/emit-relocs-1.d      |   2 +-
 .../ld-mips-elf/export-class-call16-n32.dd    |   8 +-
 .../ld-mips-elf/export-class-call16-n64.dd    |   8 +-
 .../ld-mips-elf/export-class-call16-o32.dd    |   8 +-
 ld/testsuite/ld-mips-elf/gp-disp-sym.s        |   2 +-
 ld/testsuite/ld-mips-elf/jalr3.dd             |   2 +-
 ld/testsuite/ld-mips-elf/jalr4.dd             |   8 +-
 ld/testsuite/ld-mips-elf/mips-elf.exp         | 309 +++---
 ld/testsuite/ld-mips-elf/n64-plt-1.dd         |   2 +-
 ld/testsuite/ld-mips-elf/n64-plt-4.dd         |   2 +-
 ld/testsuite/ld-mips-elf/pic-and-nonpic-2.d   |   2 +-
 47 files changed, 782 insertions(+), 665 deletions(-)

diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-final-n32.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-final-n32.d
index 0623ddc7b2b..1ae6f88fe08 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-final-n32.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-final-n32.d
@@ -1,7 +1,7 @@
 #PROG: objcopy
 #DUMPPROG: readelf
 #name: MIPS symbol table sort and section symbol names (fully linked) (n32)
-#as: -n32 -mno-pdr -mips3
+#as: -n32 -mno-pdr
 #ld: -e 0 -T ../../../../ld/testsuite/ld-mips-elf/global-local-symtab.ld
 #objcopy: -j .data -j .symtab -j .strtab -j .shstrtab
 #readelf: -s
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-final-n64.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-final-n64.d
index eaee0081fb9..6ec2f4cac3f 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-final-n64.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-final-n64.d
@@ -1,7 +1,7 @@
 #PROG: objcopy
 #DUMPPROG: readelf
 #name: MIPS symbol table sort and section symbol names (fully linked) (n64)
-#as: -64 -mno-pdr -mips3
+#as: -64 -mno-pdr
 #ld: -e 0 -T ../../../../ld/testsuite/ld-mips-elf/global-local-symtab.ld
 #objcopy: -j .data -j .symtab -j .strtab -j .shstrtab
 #readelf: -s
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-n32.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-n32.d
index ef48105afd5..fb6f9f1df15 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-n32.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-n32.d
@@ -1,7 +1,7 @@
 #PROG: objcopy
 #DUMPPROG: readelf
 #name: MIPS global/local symbol table split (n32)
-#as: -n32 -mno-pdr -mips3
+#as: -n32 -mno-pdr
 #objcopy: -j .data -j .symtab -j .strtab -j .shstrtab
 #readelf: -S
 #source: ../../../../gas/testsuite/gas/mips/global-local-symtab.s
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-n32t.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-n32t.d
index b44891f067e..d6348fa29ea 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-n32t.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-n32t.d
@@ -1,7 +1,7 @@
 #PROG: objcopy
 #DUMPPROG: readelf
 #name: MIPS global/local symbol table split (n32)
-#as: -n32 -mno-pdr -mips3
+#as: -n32 -mno-pdr
 #objcopy: -j .data -j .symtab -j .strtab -j .shstrtab
 #readelf: -S
 #source: ../../../../gas/testsuite/gas/mips/global-local-symtab.s
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-n64.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-n64.d
index a170d74ce53..f54ac011186 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-n64.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-n64.d
@@ -1,7 +1,7 @@
 #PROG: objcopy
 #DUMPPROG: readelf
 #name: MIPS global/local symbol table split (n64)
-#as: -64 -mno-pdr -mips3
+#as: -64 -mno-pdr
 #objcopy: -j .data -j .symtab -j .strtab -j .shstrtab
 #readelf: -SW
 #source: ../../../../gas/testsuite/gas/mips/global-local-symtab.s
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32.d
index 818d7919d44..d9e24b8e67a 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32.d
@@ -1,7 +1,7 @@
 #PROG: objcopy
 #DUMPPROG: readelf
 #name: MIPS symbol table sort and section symbol names (relocatable) (n32)
-#as: -n32 -mno-pdr -mips3
+#as: -n32 -mno-pdr
 #objcopy: -j .data -j .symtab -j .strtab -j .shstrtab
 #readelf: -s
 #source: ../../../../gas/testsuite/gas/mips/global-local-symtab.s
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32t.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32t.d
index a6f6548c778..5e8837fd810 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32t.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n32t.d
@@ -1,7 +1,7 @@
 #PROG: objcopy
 #DUMPPROG: readelf
 #name: MIPS symbol table sort and section symbol names (relocatable) (n32)
-#as: -n32 -mno-pdr -mips3
+#as: -n32 -mno-pdr
 #objcopy: -j .data -j .symtab -j .strtab -j .shstrtab
 #readelf: -s
 #source: ../../../../gas/testsuite/gas/mips/global-local-symtab.s
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64.d
index dcb5c23c7d5..13e3f33a824 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64.d
@@ -1,7 +1,7 @@
 #PROG: objcopy
 #DUMPPROG: readelf
 #name: MIPS symbol table sort and section symbol names (relocatable) (n64)
-#as: -64 -mno-pdr -mips3
+#as: -64 -mno-pdr
 #objcopy: -j .data -j .symtab -j .strtab -j .shstrtab
 #readelf: -s
 #source: ../../../../gas/testsuite/gas/mips/global-local-symtab.s
diff --git a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d
index e38f78909ac..8db5a2e2f0c 100644
--- a/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d
+++ b/binutils/testsuite/binutils-all/mips/global-local-symtab-sort-n64t.d
@@ -1,7 +1,7 @@
 #PROG: objcopy
 #DUMPPROG: readelf
 #name: MIPS symbol table sort and section symbol names (relocatable) (n64)
-#as: -64 -mno-pdr -mips3
+#as: -64 -mno-pdr
 #objcopy: -j .data -j .symtab -j .strtab -j .shstrtab
 #readelf: -s
 #source: ../../../../gas/testsuite/gas/mips/global-local-symtab.s
diff --git a/binutils/testsuite/binutils-all/mips/mips-xpa-virt-1.d b/binutils/testsuite/binutils-all/mips/mips-xpa-virt-1.d
index 1bb38ac0c4d..0202fd5a982 100644
--- a/binutils/testsuite/binutils-all/mips/mips-xpa-virt-1.d
+++ b/binutils/testsuite/binutils-all/mips/mips-xpa-virt-1.d
@@ -6,8 +6,8 @@
 .*: +file format .*mips.*
 
 Disassembly of section \.text:
-[0-9a-f]+ <[^>]*> 40020800 	mfc0	v0,c0_random
-[0-9a-f]+ <[^>]*> 40420800 	cfc0	v0,c0_random
-[0-9a-f]+ <[^>]*> 40620800 	0x40620800
-[0-9a-f]+ <[^>]*> 40620c00 	0x40620c00
+[0-9a-f]+ <[^>]*> 40020800 	(mfc0|mfhc0)	v0,c0_random
+[0-9a-f]+ <[^>]*> 40420800 	(cfc0|mfhc0)	v0,c0_random
+[0-9a-f]+ <[^>]*> 40620800 	(0x40620800|mfgc0[\t ]+v0,c0_random)
+[0-9a-f]+ <[^>]*> 40620c00 	(0x40620c00|mfhgc0[\t ]+v0,c0_random)
 	\.\.\.
diff --git a/binutils/testsuite/binutils-all/mips/mips-xpa-virt-2.d b/binutils/testsuite/binutils-all/mips/mips-xpa-virt-2.d
index 58bd5fa9bfd..311fa34ed21 100644
--- a/binutils/testsuite/binutils-all/mips/mips-xpa-virt-2.d
+++ b/binutils/testsuite/binutils-all/mips/mips-xpa-virt-2.d
@@ -8,6 +8,6 @@
 Disassembly of section \.text:
 [0-9a-f]+ <[^>]*> 40020800 	mfc0	v0,c0_random
 [0-9a-f]+ <[^>]*> 40420800 	mfhc0	v0,c0_random
-[0-9a-f]+ <[^>]*> 40620800 	0x40620800
-[0-9a-f]+ <[^>]*> 40620c00 	0x40620c00
+[0-9a-f]+ <[^>]*> 40620800 	(0x40620800|mfgc0[\t ]+v0,c0_random)
+[0-9a-f]+ <[^>]*> 40620c00 	(0x40620c00|mfhgc0[\t ]+v0,c0_random)
 	\.\.\.
diff --git a/binutils/testsuite/binutils-all/mips/mips-xpa-virt-3.d b/binutils/testsuite/binutils-all/mips/mips-xpa-virt-3.d
index f42f7d71ae0..23878fb4521 100644
--- a/binutils/testsuite/binutils-all/mips/mips-xpa-virt-3.d
+++ b/binutils/testsuite/binutils-all/mips/mips-xpa-virt-3.d
@@ -7,7 +7,7 @@
 
 Disassembly of section \.text:
 [0-9a-f]+ <[^>]*> 40020800 	mfc0	v0,c0_random
-[0-9a-f]+ <[^>]*> 40420800 	cfc0	v0,c0_random
+[0-9a-f]+ <[^>]*> 40420800 	(cfc0|mfhc0)	v0,c0_random
 [0-9a-f]+ <[^>]*> 40620800 	mfgc0	v0,c0_random
-[0-9a-f]+ <[^>]*> 40620c00 	0x40620c00
+[0-9a-f]+ <[^>]*> 40620c00 	(0x40620c00|mfhgc0[\t ]+v0,c0_random)
 	\.\.\.
diff --git a/binutils/testsuite/binutils-all/mips/mips.exp b/binutils/testsuite/binutils-all/mips/mips.exp
index bcda9bf9011..687c57b7913 100644
--- a/binutils/testsuite/binutils-all/mips/mips.exp
+++ b/binutils/testsuite/binutils-all/mips/mips.exp
@@ -219,6 +219,7 @@ if {[istarget *-*-openbsd*] } {
     set irixemul 1
 }
 set tmips [expr $irixemul ? {""} : {"t"}]
+set is_r6 [expr [istarget mipsisa*r6*-*]]
 
 run_dump_test_o32 "mips-ase-1"
 run_dump_test_o32 "mips-ase-2"
@@ -227,6 +228,8 @@ run_dump_test "mips-xpa-virt-1"
 run_dump_test "mips-xpa-virt-2"
 run_dump_test "mips-xpa-virt-3"
 run_dump_test "mips-xpa-virt-4"
+
+if { !$is_r6 } {
 run_dump_test_o32 "mixed-mips16" noarch
 run_dump_test_o32 "mixed-micromips" noarch
 run_dump_test "mixed-mips16-micromips"
@@ -238,6 +241,7 @@ run_dump_test_o32 "mips16-extend-insn" noarch
 run_dump_test_o32 "mips16e2-extend-insn" noarch
 run_dump_test_o32 "mips16-alias" noarch
 run_dump_test_o32 "mips16-noalias" noarch
+}
 
 run_dump_test_o32 "mips-note-2"
 run_dump_test_n32 "mips-note-2-n32"
diff --git a/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d b/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d
index 97fc8bf3f46..4a42b844a65 100644
--- a/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d
+++ b/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d
@@ -4,7 +4,7 @@
 
 Attribute Section: gnu
 File Attributes
-  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+  Tag_GNU_MIPS_ABI_FP: Hard float \((double precision|32-bit CPU, 64-bit FPU)\)
   Tag_GNU_MIPS_ABI_MSA: 128-bit MSA
 
 #...
diff --git a/gas/testsuite/gas/mips/branch-section-1.d b/gas/testsuite/gas/mips/branch-section-1.d
index 7782d0c0754..08c678d27ed 100644
--- a/gas/testsuite/gas/mips/branch-section-1.d
+++ b/gas/testsuite/gas/mips/branch-section-1.d
@@ -12,6 +12,6 @@ Disassembly of section \.text:
 	\.\.\.
 
 Disassembly of section \.init:
-[0-9a-f]+ <[^>]*> 03e00008 	jr	ra
+[0-9a-f]+ <[^>]*> 03e0000[89] 	jr	ra
 [0-9a-f]+ <[^>]*> 00000000 	nop
 	\.\.\.
diff --git a/gas/testsuite/gas/mips/branch-section-3.d b/gas/testsuite/gas/mips/branch-section-3.d
index b10fcde731d..82763165538 100644
--- a/gas/testsuite/gas/mips/branch-section-3.d
+++ b/gas/testsuite/gas/mips/branch-section-3.d
@@ -13,6 +13,6 @@ Disassembly of section \.text:
 	\.\.\.
 
 Disassembly of section \.init:
-[0-9a-f]+ <[^>]*> 03e00008 	jr	ra
+[0-9a-f]+ <[^>]*> 03e0000[89] 	jr	ra
 [0-9a-f]+ <[^>]*> 00000000 	nop
 	\.\.\.
diff --git a/gas/testsuite/gas/mips/branch-weak-1.d b/gas/testsuite/gas/mips/branch-weak-1.d
index 859a2ca69fb..349b5d96c8d 100644
--- a/gas/testsuite/gas/mips/branch-weak-1.d
+++ b/gas/testsuite/gas/mips/branch-weak-1.d
@@ -10,6 +10,6 @@ Disassembly of section \.text:
 [ 	]*[0-9a-f]+: R_MIPS_PC16	bar
 [0-9a-f]+ <[^>]*> 00000000 	nop
 	\.\.\.
-[0-9a-f]+ <[^>]*> 03e00008 	jr	ra
+[0-9a-f]+ <[^>]*> 03e0000[89] 	jr	ra
 [0-9a-f]+ <[^>]*> 00000000 	nop
 	\.\.\.
diff --git a/gas/testsuite/gas/mips/elf-rel.s b/gas/testsuite/gas/mips/elf-rel.s
index 873bc5fd86a..06c67a659bf 100644
--- a/gas/testsuite/gas/mips/elf-rel.s
+++ b/gas/testsuite/gas/mips/elf-rel.s
@@ -12,12 +12,12 @@ l2	= l0+49150
 	lui	$at,%hi(l0-4)
 	lui	$at,%hi(l1+0x8000)
 l1:		
-	addi	$at,$at,%lo(l1)
-	addi	$at,$at,%lo(l1+0x10004)
-	addi	$at,$at,%lo(l1+0x10000)
-	addi	$at,$at,%lo(l1+4)
-	addi	$at,$at,%lo(l1+0x8000)
-	addi	$at,$at,%lo(l0-4)
+	addiu	$at,$at,%lo(l1)
+	addiu	$at,$at,%lo(l1+0x10004)
+	addiu	$at,$at,%lo(l1+0x10000)
+	addiu	$at,$at,%lo(l1+4)
+	addiu	$at,$at,%lo(l1+0x8000)
+	addiu	$at,$at,%lo(l0-4)
 
 	lui	$at,%hi(l2)
 	lui	$at,%hi(l2+4)
@@ -25,12 +25,12 @@ l1:
 	lui	$at,%hi(l2+0x10004)
 	lui	$at,%hi(l2-4)
 	lui	$at,%hi(l2+0x8000)
-	addi	$at,$at,%lo(l2)
-	addi	$at,$at,%lo(l2+4)
-	addi	$at,$at,%lo(l2+0x10000)
-	addi	$at,$at,%lo(l2+0x10004)
-	addi	$at,$at,%lo(l2+0x8000)
-	addi	$at,$at,%lo(l2-4)
+	addiu	$at,$at,%lo(l2)
+	addiu	$at,$at,%lo(l2+4)
+	addiu	$at,$at,%lo(l2+0x10000)
+	addiu	$at,$at,%lo(l2+0x10004)
+	addiu	$at,$at,%lo(l2+0x8000)
+	addiu	$at,$at,%lo(l2-4)
 
 	lui	$at,%hi((l2))
 	lui	$at,%hi(((l2+4)))
@@ -38,9 +38,9 @@ l1:
 	lui	$at,%hi(((((l2+0x10004)))))
 	lui	$at,%hi((((((l2-4))))))
 	lui	$at,%hi(((((((l2+0x8000)))))))
-	addi	$at,$at,%lo((l2))
-	addi	$at,$at,%lo(((l2+4)))
-	addi	$at,$at,%lo((((l2+0x10000))))
-	addi	$at,$at,%lo(((((l2+0x10004)))))
-	addi	$at,$at,%lo((((((l2+0x8000))))))
-	addi	$at,$at,%lo(((((((l2-4)))))))
+	addiu	$at,$at,%lo((l2))
+	addiu	$at,$at,%lo(((l2+4)))
+	addiu	$at,$at,%lo((((l2+0x10000))))
+	addiu	$at,$at,%lo(((((l2+0x10004)))))
+	addiu	$at,$at,%lo((((((l2+0x8000))))))
+	addiu	$at,$at,%lo(((((((l2-4)))))))
diff --git a/gas/testsuite/gas/mips/elfel-rel.d b/gas/testsuite/gas/mips/elfel-rel.d
index bac44edbef8..c6b2b10cee7 100644
--- a/gas/testsuite/gas/mips/elfel-rel.d
+++ b/gas/testsuite/gas/mips/elfel-rel.d
@@ -49,12 +49,12 @@ OFFSET [ ]+ TYPE              VALUE
 
 Contents of section \.text:
  0000 0000013c 0000013c 0100013c 0100013c  .*
- 0010 0000013c 0100013c 18002120 1c002120  .*
- 0020 18002120 1c002120 18802120 fcff2120  .*
+ 0010 0000013c 0100013c 18002124 1c002124  .*
+ 0020 18002124 1c002124 18802124 fcff2124  .*
  0030 0100013c 0100013c 0200013c 0200013c  .*
- 0040 0100013c 0100013c febf2120 02c02120  .*
- 0050 febf2120 02c02120 fe3f2120 fabf2120  .*
+ 0040 0100013c 0100013c febf2124 02c02124  .*
+ 0050 febf2124 02c02124 fe3f2124 fabf2124  .*
  0060 0100013c 0100013c 0200013c 0200013c  .*
- 0070 0100013c 0100013c febf2120 02c02120  .*
- 0080 febf2120 02c02120 fe3f2120 fabf2120  .*
+ 0070 0100013c 0100013c febf2124 02c02124  .*
+ 0080 febf2124 02c02124 fe3f2124 fabf2124  .*
 #pass
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index d021f05a121..895f5566507 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -560,6 +560,7 @@ if { [istarget mips*-*-vxworks*] } {
     set has_newabi [expr [istarget *-*-irix6*] || [istarget mips*-*-linux*] \
                          || [istarget mips*-sde-elf*] || [istarget mips*-mti-elf*] \
                          || [istarget mips*-img-elf*]]
+    set is_r6 [expr [istarget mipsisa*r6*-*]]
 
     if { [istarget "mips*-*-*linux*"]
 	 || [istarget "mips*-sde-elf*"]
@@ -620,101 +621,105 @@ if { [istarget mips*-*-vxworks*] } {
     # close below 4096 as this is the default obstack size limit that
     # we use and some space will have been already consumed.  The exact
     # amount depends on the host's programming model.
-    for { set count 960 } { $count <= 1024 } { incr count } {
-	run_list_test "branch-swap-2" "--defsym count=$count" \
-	    "MIPS branch swapping ($count)"
+    #FIXME: currently R6 cannot work with microMIPS
+    if { !$is_r6 } {
+	for { set count 960 } { $count <= 1024 } { incr count } {
+		run_list_test "branch-swap-2" "--defsym count=$count" \
+		"MIPS branch swapping ($count)"
+	}
     }
 
     run_dump_test_arches "branch-swap-3" [mips_arch_list_all]
     run_dump_test_arches "branch-swap-4" [mips_arch_list_all]
 
     run_dump_test "branch-section-1"
-    run_dump_test "branch-section-2"
-    run_dump_test "branch-section-3"
-    run_dump_test "branch-section-4"
-    run_dump_test "branch-extern-1"
-    run_dump_test "branch-extern-2"
-    run_dump_test "branch-extern-3"
-    run_dump_test "branch-extern-4"
     run_dump_test "branch-weak-1"
-    run_dump_test "branch-weak-2"
-    run_dump_test "branch-weak-3"
-    run_dump_test "branch-weak-4"
-    run_dump_test "branch-weak-5"
-    run_dump_test "branch-weak-6"
-    run_dump_test "branch-weak-7"
-    run_dump_test "branch-local-1"
-    run_dump_test "branch-local-2"
-    run_dump_test "branch-local-ignore-2"
-    run_dump_test "branch-local-3"
-    run_dump_test "branch-local-ignore-3"
-    run_dump_test "branch-local-4"
-    run_dump_test "branch-local-5"
-    run_dump_test "branch-local-ignore-5"
-    run_dump_test "branch-local-6"
-    run_dump_test "branch-local-ignore-6"
-    run_dump_test "branch-local-7"
-    if $has_newabi {
-	run_dump_test "branch-local-n32-1"
-	run_dump_test "branch-local-n32-2"
-	run_dump_test "branch-local-ignore-n32-2"
-	run_dump_test "branch-local-n32-3"
-	run_dump_test "branch-local-ignore-n32-3"
-	run_dump_test "branch-local-n32-4"
-	run_dump_test "branch-local-n32-5"
-	run_dump_test "branch-local-ignore-n32-5"
-	run_dump_test "branch-local-n32-6"
-	run_dump_test "branch-local-ignore-n32-6"
-	run_dump_test "branch-local-n32-7"
-	run_dump_test "branch-local-n64-1"
-	run_dump_test "branch-local-n64-2"
-	run_dump_test "branch-local-ignore-n64-2"
-	run_dump_test "branch-local-n64-3"
-	run_dump_test "branch-local-ignore-n64-3"
-	run_dump_test "branch-local-n64-4"
-	run_dump_test "branch-local-n64-5"
-	run_dump_test "branch-local-ignore-n64-5"
-	run_dump_test "branch-local-n64-6"
-	run_dump_test "branch-local-ignore-n64-6"
-	run_dump_test "branch-local-n64-7"
-    }
-    run_dump_test "branch-addend"
-    run_dump_test "branch-addend-micromips"
-    if $has_newabi {
-	run_dump_test "branch-addend-n32"
-	run_dump_test "branch-addend-micromips-n32"
-	run_dump_test "branch-addend-n64"
-	run_dump_test "branch-addend-micromips-n64"
-    }
-    run_dump_test "branch-absolute"
-    run_dump_test "branch-absolute-addend"
-    if $has_newabi {
-	run_dump_test "branch-absolute-n32"
-	run_dump_test "branch-absolute-addend-n32"
-	run_dump_test "branch-absolute-n64"
-	run_dump_test "branch-absolute-addend-n64"
+    if { !$is_r6 } {
+	run_dump_test "branch-section-2"
+	run_dump_test "branch-section-3"
+	run_dump_test "branch-section-4"
+	run_dump_test "branch-extern-1"
+	run_dump_test "branch-extern-2"
+	run_dump_test "branch-extern-3"
+	run_dump_test "branch-extern-4"
+	run_dump_test "branch-weak-2"
+	run_dump_test "branch-weak-3"
+	run_dump_test "branch-weak-4"
+	run_dump_test "branch-weak-5"
+	run_dump_test "branch-weak-6"
+	run_dump_test "branch-weak-7"
+	run_dump_test "branch-local-1"
+	run_dump_test "branch-local-2"
+	run_dump_test "branch-local-ignore-2"
+	run_dump_test "branch-local-3"
+	run_dump_test "branch-local-ignore-3"
+	run_dump_test "branch-local-4"
+	run_dump_test "branch-local-5"
+	run_dump_test "branch-local-ignore-5"
+	run_dump_test "branch-local-6"
+	run_dump_test "branch-local-ignore-6"
+	run_dump_test "branch-local-7"
+	if $has_newabi {
+	    run_dump_test "branch-local-n32-1"
+	    run_dump_test "branch-local-n32-2"
+	    run_dump_test "branch-local-ignore-n32-2"
+	    run_dump_test "branch-local-n32-3"
+	    run_dump_test "branch-local-ignore-n32-3"
+	    run_dump_test "branch-local-n32-4"
+	    run_dump_test "branch-local-n32-5"
+	    run_dump_test "branch-local-ignore-n32-5"
+	    run_dump_test "branch-local-n32-6"
+	    run_dump_test "branch-local-ignore-n32-6"
+	    run_dump_test "branch-local-n32-7"
+	    run_dump_test "branch-local-n64-1"
+	    run_dump_test "branch-local-n64-2"
+	    run_dump_test "branch-local-ignore-n64-2"
+	    run_dump_test "branch-local-n64-3"
+	    run_dump_test "branch-local-ignore-n64-3"
+	    run_dump_test "branch-local-n64-4"
+	    run_dump_test "branch-local-n64-5"
+	    run_dump_test "branch-local-ignore-n64-5"
+	    run_dump_test "branch-local-n64-6"
+	    run_dump_test "branch-local-ignore-n64-6"
+	    run_dump_test "branch-local-n64-7"
+	}
+	run_dump_test "branch-addend"
+	run_dump_test "branch-addend-micromips"
+	if $has_newabi {
+	    run_dump_test "branch-addend-n32"
+	    run_dump_test "branch-addend-micromips-n32"
+	    run_dump_test "branch-addend-n64"
+	    run_dump_test "branch-addend-micromips-n64"
+        }
+	run_dump_test "branch-absolute"
+	run_dump_test "branch-absolute-addend"
+	if $has_newabi {
+	    run_dump_test "branch-absolute-n32"
+	    run_dump_test "branch-absolute-addend-n32"
+	    run_dump_test "branch-absolute-n64"
+	    run_dump_test "branch-absolute-addend-n64"
+	}
+
+	run_dump_test "compact-eh-eb-1"
+	run_dump_test "compact-eh-eb-2"
+	run_dump_test "compact-eh-eb-3"
+	run_dump_test "compact-eh-eb-4"
+	run_dump_test "compact-eh-eb-5"
+	run_dump_test "compact-eh-eb-6"
+	run_dump_test "compact-eh-eb-7"
+	run_dump_test "compact-eh-el-1"
+	run_dump_test "compact-eh-el-2"
+	run_dump_test "compact-eh-el-3"
+	run_dump_test "compact-eh-el-4"
+	run_dump_test "compact-eh-el-5"
+	run_dump_test "compact-eh-el-6"
+	run_dump_test "compact-eh-el-7"
+	run_list_test "compact-eh-err1"
+	run_list_test "compact-eh-err2"
     }
 
     run_dump_test_arches "nal-1" [mips_arch_list_matching mips1 !micromips]
     run_dump_test_arches "nal-2" [mips_arch_list_matching mips1 !micromips]
-
-    run_dump_test "compact-eh-eb-1"
-    run_dump_test "compact-eh-eb-2"
-    run_dump_test "compact-eh-eb-3"
-    run_dump_test "compact-eh-eb-4"
-    run_dump_test "compact-eh-eb-5"
-    run_dump_test "compact-eh-eb-6"
-    run_dump_test "compact-eh-eb-7"
-    run_dump_test "compact-eh-el-1"
-    run_dump_test "compact-eh-el-2"
-    run_dump_test "compact-eh-el-3"
-    run_dump_test "compact-eh-el-4"
-    run_dump_test "compact-eh-el-5"
-    run_dump_test "compact-eh-el-6"
-    run_dump_test "compact-eh-el-7"
-    run_list_test "compact-eh-err1"
-    run_list_test "compact-eh-err2"
-
     run_dump_test "div"
 
     if { !$addr32 && $has_newabi } {
@@ -736,39 +741,41 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "fix-rm7000-2" \
 					[mips_arch_list_matching mips3 !singlefloat \
 						!mips64r6]
-    run_dump_test_arches "24k-branch-delay-1" \
+    if { !$is_r6 } {
+	run_dump_test_arches "24k-branch-delay-1" \
 					[mips_arch_list_matching mips1]
-    run_dump_test_arches "24k-triple-stores-1" \
+	run_dump_test_arches "24k-triple-stores-1" \
 				[mips_arch_list_matching fpisa5 !octeon]
-    run_dump_test_arches "24k-triple-stores-2" \
+	run_dump_test_arches "24k-triple-stores-2" \
 					[mips_arch_list_matching mips2]
-    run_dump_test_arches "24k-triple-stores-2-llsc" \
+	run_dump_test_arches "24k-triple-stores-2-llsc" \
 					[mips_arch_list_matching mips2 !nollsc]
-    run_dump_test_arches "24k-triple-stores-3" \
+	run_dump_test_arches "24k-triple-stores-3" \
 					[mips_arch_list_matching mips2]
-    run_dump_test_arches "24k-triple-stores-4" \
+	run_dump_test_arches "24k-triple-stores-4" \
 					[mips_arch_list_matching mips2 !singlefloat]
-    run_dump_test_arches "24k-triple-stores-5" \
+	run_dump_test_arches "24k-triple-stores-5" \
 					[mips_arch_list_matching mips1]
-    run_dump_test_arches "24k-triple-stores-6" \
+	run_dump_test_arches "24k-triple-stores-6" \
 					[mips_arch_list_matching mips2 !singlefloat]
-    run_dump_test_arches "24k-triple-stores-7" \
+	run_dump_test_arches "24k-triple-stores-7" \
 					[mips_arch_list_matching mips2 !singlefloat]
-    run_dump_test_arches "24k-triple-stores-8" \
+	run_dump_test_arches "24k-triple-stores-8" \
 					[mips_arch_list_matching mips1]
-    run_dump_test_arches "24k-triple-stores-9" \
+	run_dump_test_arches "24k-triple-stores-9" \
 					[mips_arch_list_matching mips1]
-    run_dump_test_arches "24k-triple-stores-10" \
+	run_dump_test_arches "24k-triple-stores-10" \
 					[mips_arch_list_matching mips1]
-    run_dump_test_arches "24k-triple-stores-11" \
+	run_dump_test_arches "24k-triple-stores-11" \
 	    				[mips_arch_list_matching mips1]
 
-    run_dump_test_arches "jal-svr4pic${imips}" \
+	run_dump_test_arches "jal-svr4pic${imips}" \
 					[mips_arch_list_matching mips1]
-    run_dump_test_arches "jal-svr4pic-noreorder${imips}" \
+	run_dump_test_arches "jal-svr4pic-noreorder${imips}" \
 					[mips_arch_list_matching mips1]
-    run_dump_test_arches "jal-svr4pic-local${imips}" \
+	run_dump_test_arches "jal-svr4pic-local${imips}" \
 					[mips_arch_list_matching mips1]
+    }
     if $has_newabi {
 	run_dump_test_arches "jal-svr4pic-local-n32" \
 					[mips_arch_list_matching mips3]
@@ -905,118 +912,136 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "uld2-eb" [mips_arch_list_matching mips3 !mips32r6]
     run_dump_test_arches "uld2-el" [mips_arch_list_matching mips3 !mips32r6]
 
-    run_dump_test_arches "mips16"	[mips_arch_list_matching mips16-64]
-    if { $has_newabi } {
-	run_dump_test_arches "mips16-64" \
+    if { !$is_r6 } {
+        run_dump_test_arches "mips16"	[mips_arch_list_matching mips16-64]
+        if { $has_newabi } {
+            run_dump_test_arches "mips16-64" \
 					[mips_arch_list_matching mips16-64]
-    }
-    run_dump_test_arches "mips16-macro"	[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-macro-t" \
+        }
+        run_dump_test_arches "mips16-macro"	[mips_arch_list_matching mips16-32]
+        run_dump_test_arches "mips16-macro-t" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-macro-e" \
+        run_dump_test_arches "mips16-macro-e" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-insn-t" \
+        run_dump_test_arches "mips16-insn-t" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-insn-e" \
+        run_dump_test_arches "mips16-insn-e" \
 					[mips_arch_list_matching mips16-32]
-    # Check MIPS16e extensions
-    run_dump_test_arches "mips16e"	[mips_arch_list_matching mips16e-32]
-    run_dump_test_arches "mips16e-64"	[mips_arch_list_matching mips16e-32]
-    # Check MIPS16e2 extensions.
-    run_dump_test_arches "mips16e2"	[mips_arch_list_matching mips16e2-32]
-    run_dump_test_arches "mips16e2-mt"	[mips_arch_list_matching mips16e2-32]
-    # Check MIPS16 ISA subset disassembly
-    run_dump_test_arches "mips16-sub"	[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16e-sub"	[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16e-64-sub" \
+        # Check MIPS16e extensions
+        run_dump_test_arches "mips16e"	[mips_arch_list_matching mips16e-32]
+        run_dump_test_arches "mips16e-64"	[mips_arch_list_matching mips16e-32]
+        # Check MIPS16e2 extensions.
+        run_dump_test_arches "mips16e2"	[mips_arch_list_matching mips16e2-32]
+        run_dump_test_arches "mips16e2-mt"	[mips_arch_list_matching mips16e2-32]
+        # Check MIPS16 ISA subset disassembly
+        run_dump_test_arches "mips16-sub"	[mips_arch_list_matching mips16-32]
+        run_dump_test_arches "mips16e-sub"	[mips_arch_list_matching mips16-32]
+        run_dump_test_arches "mips16e-64-sub" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16e2-sub"	[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16e2-mt-sub" \
+        run_dump_test_arches "mips16e2-sub"	[mips_arch_list_matching mips16-32]
+        run_dump_test_arches "mips16e2-mt-sub" \
 					[mips_arch_list_matching mips16-32]
 
-    # Check jalx handling
-    run_dump_test "mips16-jalx"
-    run_dump_test "mips-jalx"
-    run_dump_test "mips-jalx-2"
-    run_dump_test "jalx-imm"
-    run_dump_test "jalx-addend"
-    run_dump_test "jalx-local"
-    if $has_newabi {
-	run_dump_test "jalx-imm-n32"
-	run_dump_test "jalx-addend-n32"
-	run_dump_test "jalx-local-n32"
-	run_dump_test "jalx-imm-n64"
-	run_dump_test "jalx-addend-n64"
-	run_dump_test "jalx-local-n64"
-    }
-
-    run_list_test "unaligned-jump-1" "-32" \
+        # Check jalx handling
+        run_dump_test "mips16-jalx"
+        run_dump_test "mips-jalx"
+        run_dump_test "mips-jalx-2"
+        run_dump_test "jalx-imm"
+        run_dump_test "jalx-addend"
+        run_dump_test "jalx-local"
+        if $has_newabi {
+            run_dump_test "jalx-imm-n32"
+            run_dump_test "jalx-addend-n32"
+            run_dump_test "jalx-local-n32"
+            run_dump_test "jalx-imm-n64"
+            run_dump_test "jalx-addend-n64"
+            run_dump_test "jalx-local-n64"
+        }
+    }
+
+    if { !$is_r6 } {
+        run_list_test "unaligned-jump-1" "-32" \
 				"MIPS jump to unaligned symbol 1"
-    run_list_test "unaligned-jump-2" "-32" \
+        run_list_test "unaligned-jump-2" "-32" \
 				"MIPS jump to unaligned symbol 2"
-    if $has_newabi {
-	run_dump_test "unaligned-jump-3"
-    }
-    run_list_test "unaligned-jump-mips16-1" "-32" \
+        if $has_newabi {
+	    run_dump_test "unaligned-jump-3"
+        }
+        run_list_test "unaligned-jump-mips16-1" "-32" \
 				"MIPS16 jump to unaligned symbol 1"
-    run_list_test "unaligned-jump-mips16-2" "-32" \
+        run_list_test "unaligned-jump-mips16-2" "-32" \
 				"MIPS16 jump to unaligned symbol 2"
-    if $has_newabi {
-	run_dump_test "unaligned-jump-mips16-3"
-    }
-    run_list_test "unaligned-jump-micromips-1" "-32" \
+        if $has_newabi {
+	    run_dump_test "unaligned-jump-mips16-3"
+        }
+        run_list_test "unaligned-jump-micromips-1" "-32" \
 				"microMIPS jump to unaligned symbol 1"
-    run_list_test "unaligned-jump-micromips-2" "-32" \
+        run_list_test "unaligned-jump-micromips-2" "-32" \
 				"microMIPS jump to unaligned symbol 2"
-    if $has_newabi {
-	run_dump_test "unaligned-jump-micromips-3"
+        if $has_newabi {
+	    run_dump_test "unaligned-jump-micromips-3"
+        }
     }
-    run_list_test "unaligned-branch-1" "-32" \
+    if { !$is_r6 } {
+        run_list_test "unaligned-branch-1" "-32" \
 				"MIPS branch to unaligned symbol 1"
-    run_list_test "unaligned-branch-2" "-32" \
+        run_list_test "unaligned-branch-2" "-32" \
 				"MIPS branch to unaligned symbol 2"
-    if $has_newabi {
-	run_dump_test "unaligned-branch-3"
     }
-    run_list_test "unaligned-branch-r6-1" "-32" \
+    if { !$is_r6 } {
+        if $has_newabi {
+            run_dump_test "unaligned-branch-3"
+        }
+    }
+    if { !$is_r6 } {
+        run_list_test "unaligned-branch-r6-1" "-32" \
 				"MIPSr6 branch to unaligned symbol 1"
+    }
     run_list_test "unaligned-branch-r6-2" "-32 -mips64r6" \
 				"MIPSr6 branch to unaligned symbol 2"
-    run_list_test "unaligned-branch-r6-3" "-32" \
+    if { !$is_r6 } {
+        run_list_test "unaligned-branch-r6-3" "-32" \
 				"MIPSr6 branch to unaligned symbol 3"
+    }
     run_list_test "unaligned-branch-r6-4" "-32 -mips64r6" \
 				"MIPSr6 branch to unaligned symbol 4"
     if $has_newabi {
-	run_dump_test "unaligned-branch-r6-5"
+        if { !$is_r6 } {
+	    run_dump_test "unaligned-branch-r6-5"
+        }
 	run_dump_test "unaligned-branch-r6-6"
     }
-    run_list_test "unaligned-branch-mips16-1" "-32" \
+    if { !$is_r6 } {
+        run_list_test "unaligned-branch-mips16-1" "-32" \
 				"MIPS16 branch to unaligned symbol 1"
-    run_list_test "unaligned-branch-mips16-2" "-32" \
+        run_list_test "unaligned-branch-mips16-2" "-32" \
 				"MIPS16 branch to unaligned symbol 2"
-    if $has_newabi {
-	run_dump_test "unaligned-branch-mips16-3"
-    }
-    run_list_test "unaligned-branch-micromips-1" "-32" \
+        if $has_newabi {
+	    run_dump_test "unaligned-branch-mips16-3"
+        }
+        run_list_test "unaligned-branch-micromips-1" "-32" \
 				"microMIPS branch to unaligned symbol 1"
-    run_list_test "unaligned-branch-micromips-2" "-32" \
+        run_list_test "unaligned-branch-micromips-2" "-32" \
 				"microMIPS branch to unaligned symbol 2"
-    if $has_newabi {
-	run_dump_test "unaligned-branch-micromips-3"
+        if $has_newabi {
+	    run_dump_test "unaligned-branch-micromips-3"
+        }
     }
 
     # Check MIPS16 HI16/LO16 relocations
-    run_dump_test "mips16-hilo"
-    run_dump_test "mips16e2-hilo"
-    if $has_newabi {
-	run_dump_test "mips16-hilo-n32"
-	run_dump_test "mips16e2-hilo-n32"
+    if { !$is_r6 } {
+        run_dump_test "mips16-hilo"
+        run_dump_test "mips16e2-hilo"
+        if $has_newabi {
+            run_dump_test "mips16-hilo-n32"
+            run_dump_test "mips16e2-hilo-n32"
+        }
+        run_dump_test "mips16-hilo-match"
+        run_dump_test "mips16-reloc-error"
+        run_dump_test "mips16e2-reloc-error"
+        run_dump_test "mips16-reg-error"
+        run_dump_test "mips16e2-imm-error"
     }
-    run_dump_test "mips16-hilo-match"
-    run_dump_test "mips16-reloc-error"
-    run_dump_test "mips16e2-reloc-error"
-    run_dump_test "mips16-reg-error"
-    run_dump_test "mips16e2-imm-error"
 
     run_dump_test "delay"
     run_dump_test "nodelay"
@@ -1047,7 +1072,7 @@ if { [istarget mips*-*-vxworks*] } {
     run_list_test_arches "mips32-sf32" "-32 -msoft-float" \
 					[mips_arch_list_matching mips32]
     run_dump_test_arches "mips32-cp2"	[mips_arch_list_matching mips32 \
-					    !octeon]
+					    !octeon !mips32r6]
 
     run_dump_test_arches "mips32r2"	[mips_arch_list_matching mips32r2]
     run_dump_test_arches "mips32r2-cp2"	[mips_arch_list_matching mips32r2 \
@@ -1070,9 +1095,12 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "mips64r2"	[mips_arch_list_matching mips64r2]
     run_list_test_arches "mips64r2-ill"	[mips_arch_list_matching mips64r2]
 
-    run_dump_test "set-arch"
+    if { !$is_r6 } {
+        # r6 add some "R_MIPS_PC16"
+        run_dump_test "set-arch"
+    }
 
-    if { !$addr32 } {
+    if { !$addr32 && !$is_r6 } {
 	run_dump_test "mips64-mips3d"
 	if { $has_newabi } {
 	    run_dump_test_arches "mips64-mips3d-incl" \
@@ -1102,9 +1130,11 @@ if { [istarget mips*-*-vxworks*] } {
 					[mips_arch_list_matching mips64r2 \
 					    !micromips !mips32r6]
 
-    run_dump_test_arches "eva"		[mips_arch_list_matching mips32r2 !octeon]
+    run_dump_test_arches "eva"		[mips_arch_list_matching mips32r2 !octeon !mips32r6]
 
-    run_list_test "illegal" "-32"
+    if { !$is_r6 } {
+        run_list_test "illegal" "-32"
+    }
     run_list_test "baddata1" "-32"
     run_list_test "jalr" ""
 
@@ -1142,13 +1172,15 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test "elf_arch_mips64r6"
 
     # Verify that ASE markings are handled properly.
-    run_dump_test "elf_ase_mips16"
-    run_dump_test "elf_ase_mips16-2"
-    run_dump_test "elf_ase_mips16e2"
-    run_dump_test "elf_ase_mips16e2-2"
+    if { !$is_r6 } {
+        run_dump_test "elf_ase_mips16"
+        run_dump_test "elf_ase_mips16-2"
+        run_dump_test "elf_ase_mips16e2"
+        run_dump_test "elf_ase_mips16e2-2"
 
-    run_dump_test "elf_ase_micromips"
-    run_dump_test "elf_ase_micromips-2"
+        run_dump_test "elf_ase_micromips"
+        run_dump_test "elf_ase_micromips-2"
+    }
 
     # Verify that machine markings are handled properly.
     run_dump_test "elf_mach_5900"
@@ -1174,34 +1206,44 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "elf-rel4" [mips_arch_list_matching gpr64 !mips16-32]
     run_dump_test "e32-rel4"
     run_dump_test "elf-rel5"
-    run_dump_test "elf-rel6"
-    if $has_newabi {
-	run_dump_test "elf-rel6-n32"
-	run_dump_test "elf-rel6-n64"
+    if { !$is_r6 } {
+        run_dump_test "elf-rel6"
+        if $has_newabi {
+            run_dump_test "elf-rel6-n32"
+            run_dump_test "elf-rel6-n64"
+        }
     }
     run_dump_test "elf-rel7"
     run_dump_test "elf-rel8"
-    run_dump_test "elf-rel8-mips16"
+    if { !$is_r6 } {
+        run_dump_test "elf-rel8-mips16"
+    }
     run_dump_test "elf-rel9"
-    run_dump_test "elf-rel9-mips16"
-    run_dump_test "elf-rel9-mips16e2"
+    if { !$is_r6 } {
+        run_dump_test "elf-rel9-mips16"
+        run_dump_test "elf-rel9-mips16e2"
+    }
     if $has_newabi {
 	run_dump_test "elf-rel10"
 	run_dump_test "elf-rel11"
     }
     run_dump_test "elf-rel12"
     run_dump_test "elf-rel13"
-    run_dump_test "elf-rel13-mips16"
+    if { !$is_r6 } {
+        run_dump_test "elf-rel13-mips16"
+    }
     run_dump_test "elf-rel14"
 
     if $has_newabi {
 	run_dump_test "elf-rel15"
 	run_dump_test "elf-rel16"
 
-	run_dump_test "elf-rel-got-n32"
-	run_dump_test "elf-rel-xgot-n32"
-	run_dump_test "elf-rel-got-n64"
-	run_dump_test "elf-rel-xgot-n64"
+        if { !$is_r6 } {
+	    run_dump_test "elf-rel-got-n32"
+	    run_dump_test "elf-rel-xgot-n32"
+	    run_dump_test "elf-rel-got-n64"
+	    run_dump_test "elf-rel-xgot-n64"
+        }
     }
     run_dump_test "elf-rel17"
     if $has_newabi {
@@ -1226,21 +1268,25 @@ if { [istarget mips*-*-vxworks*] } {
 
     if $has_newabi {
 	run_dump_test "elf-rel28-n32"
-	run_dump_test "elf-rel28-micromips-n32"
 	run_dump_test "elf-rel28-n64"
-	run_dump_test "elf-rel28-micromips-n64"
-	run_dump_test "elf-rel28-lldscd-n32"
-	run_dump_test "elf-rel28-lldscd-micromips-n32"
-	run_dump_test "elf-rel28-lldscd-n64"
-	run_dump_test "elf-rel28-lldscd-micromips-n64"
+        if { !$is_r6 } {
+	    run_dump_test "elf-rel28-micromips-n32"
+	    run_dump_test "elf-rel28-micromips-n64"
+	    run_dump_test "elf-rel28-lldscd-n32"
+	    run_dump_test "elf-rel28-lldscd-micromips-n32"
+	    run_dump_test "elf-rel28-lldscd-n64"
+	    run_dump_test "elf-rel28-lldscd-micromips-n64"
+        }
 	run_dump_test_arches "elf-rel29" [mips_arch_list_matching mips3]
     }
     run_list_test_arches "elf-rel30" "-32" [mips_arch_list_all]
 
-    run_dump_test "comdat-reloc"
+    if { !$is_r6 } {
+        run_dump_test "comdat-reloc"
 
-    run_dump_test "${tmips}mips${el}16-e"
-    run_dump_test "${tmips}mips${el}16-f"
+        run_dump_test "${tmips}mips${el}16-e"
+        run_dump_test "${tmips}mips${el}16-f"
+    }
 
     run_dump_test "elf-consthilo"
     run_dump_test "expr1"
@@ -1279,15 +1325,19 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "loc-swap-2"	[mips_arch_list_all]
     run_dump_test_arches "loc-swap-3"	[mips_arch_list_all]
 
-    run_dump_test "nan-legacy-1"
-    run_dump_test "nan-legacy-2"
-    run_dump_test "nan-legacy-3"
-    run_dump_test "nan-legacy-4"
-    run_dump_test "nan-legacy-5"
+    if { !$is_r6 } {
+        run_dump_test "nan-legacy-1"
+        run_dump_test "nan-legacy-2"
+        run_dump_test "nan-legacy-3"
+        run_dump_test "nan-legacy-4"
+        run_dump_test "nan-legacy-5"
+    }
 
     run_dump_test "nan-2008-1"
     run_dump_test "nan-2008-2"
-    run_dump_test "nan-2008-3"
+    if { !$is_r6 } {
+        run_dump_test "nan-2008-3"
+    }
     run_dump_test "nan-2008-4"
 
     run_list_test "nan-error-1"
@@ -1366,7 +1416,9 @@ if { [istarget mips*-*-vxworks*] } {
     if $has_newabi {
 	run_dump_test "ldstla-n64"
 	run_dump_test "ldstla-n64-shared"
-	run_dump_test "ldstla-n64-sym32"
+        if { !$is_r6 } {
+            run_dump_test "ldstla-n64-sym32"
+        }
     }
 
     run_dump_test "macro-warn-1"
@@ -1389,32 +1441,34 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test "at-1"
     run_list_test "at-2" "-32 -mips1" "MIPS at-2"
 
-    run_dump_test "loongson-2e"
-    run_dump_test "loongson-2f"
-    run_dump_test "loongson-2f-2"
-    run_dump_test "loongson-2f-3"
+    if { !$is_r6 } {
+        run_dump_test "loongson-2e"
+        run_dump_test "loongson-2f"
+        run_dump_test "loongson-2f-2"
+        run_dump_test "loongson-2f-3"
 
-    run_dump_test "loongson-3a"
-    run_dump_test "loongson-3a-2"
-    run_dump_test "loongson-3a-3"
+        run_dump_test "loongson-3a"
+        run_dump_test "loongson-3a-2"
+        run_dump_test "loongson-3a-3"
 
-    run_dump_test "loongson-2f-mmi"
-    run_dump_test "loongson-3a-mmi"
+        run_dump_test "loongson-2f-mmi"
+        run_dump_test "loongson-3a-mmi"
 
-    run_dump_test_arches "loongson-cam"		[mips_arch_list_matching gs464]
-    run_dump_test_arches "loongson-ext2"	[mips_arch_list_matching gs464]  
+        run_dump_test_arches "loongson-cam"        [mips_arch_list_matching gs464]
+        run_dump_test_arches "loongson-ext2"    [mips_arch_list_matching gs464]
 
-    if { $has_newabi } {
-	run_dump_test_arches "octeon"	[mips_arch_list_matching octeon]
-    }
-    run_dump_test_arches "octeon-saa-saad" [mips_arch_list_matching octeonp]
-    run_list_test_arches "octeon-ill"	[mips_arch_list_matching octeon]
-    if { $has_newabi } {
-	run_dump_test_arches "octeon-pref" \
-					[mips_arch_list_matching octeon]
+        if { $has_newabi } {
+            run_dump_test_arches "octeon"    [mips_arch_list_matching octeon]
+        }
+        run_dump_test_arches "octeon-saa-saad" [mips_arch_list_matching octeonp]
+        run_list_test_arches "octeon-ill"    [mips_arch_list_matching octeon]
+        if { $has_newabi } {
+            run_dump_test_arches "octeon-pref" \
+                        [mips_arch_list_matching octeon]
+        }
+        run_dump_test_arches "octeon2"	[mips_arch_list_matching octeon2]
+        run_dump_test_arches "octeon3"	[mips_arch_list_matching octeon3]
     }
-    run_dump_test_arches "octeon2"	[mips_arch_list_matching octeon2]
-    run_dump_test_arches "octeon3"	[mips_arch_list_matching octeon3]
 
     run_dump_test "smartmips"
     run_dump_test_arches "mips32-dsp"	[mips_arch_list_matching mips32r2 \
@@ -1435,34 +1489,35 @@ if { [istarget mips*-*-vxworks*] } {
 				[mips_arch_list_matching mips1 !micromips] \
 				[mips_arch_list_matching mips16-32]]]
 
-    run_dump_test "mips16-dwarf2"
-    if $has_newabi {
-	run_dump_test "mips16-dwarf2-n32"
+    if { !$is_r6 } {
+        run_dump_test "mips16-dwarf2"
+        if $has_newabi {
+	    run_dump_test "mips16-dwarf2-n32"
+        }
+        run_dump_test "mips16-stabs"
+
+        run_dump_test "mips16e-jrc"
+        run_dump_test "mips16e2-lui"
+        run_dump_test "mips16e2-mt-err"
+        run_dump_test "mips16e2-copy"
+        run_dump_test "mips16e2-copy-err"
+
+        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"
+        run_dump_test "mips16-insn-length-noargs"
+
+        run_dump_test "mips16-branch-unextended-1"
+        run_dump_test "mips16-branch-unextended-2"
+        run_dump_test "mips16-relax-unextended-1"
+        run_dump_test "mips16-relax-unextended-2"
+        run_dump_test "mips16-jal-t"
+        run_dump_test "mips16-jal-e"
+
+        run_dump_test_arches "mips16-asmacro" [mips_arch_list_matching mips16-32]
     }
-    run_dump_test "mips16-stabs"
-
-    run_dump_test "mips16e-jrc"
-    run_dump_test "mips16e2-lui"
-    run_dump_test "mips16e2-mt-err"
-    run_dump_test "mips16e2-copy"
-    run_dump_test "mips16e2-copy-err"
-
-    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"
-    run_dump_test "mips16-insn-length-noargs"
-
-    run_dump_test "mips16-branch-unextended-1"
-    run_dump_test "mips16-branch-unextended-2"
-    run_dump_test "mips16-relax-unextended-1"
-    run_dump_test "mips16-relax-unextended-2"
-    run_dump_test "mips16-jal-t"
-    run_dump_test "mips16-jal-e"
-
-    run_dump_test_arches "mips16-asmacro" [mips_arch_list_matching mips16-32]
-
     run_dump_test "vxworks1"
     run_dump_test "vxworks1-xgot"
     run_dump_test "vxworks1-el"
@@ -1470,11 +1525,13 @@ if { [istarget mips*-*-vxworks*] } {
 
     run_dump_test "noreorder"
     run_dump_test "align"
-    run_dump_test "align2"
-    run_dump_test "align2-el"
+    if { !$is_r6 } {
+        run_dump_test "align2"
+        run_dump_test "align2-el"
+        run_dump_test "insn-opts"
+    }
     run_dump_test "align3"
     run_dump_test "odd-float"
-    run_dump_test "insn-opts"
 
     run_list_test_arches "mips-macro-ill-sfp" "-32 -msingle-float" \
 					[mips_arch_list_matching mips2]
@@ -1488,7 +1545,9 @@ if { [istarget mips*-*-vxworks*] } {
 	"-32 -msingle-float -mdouble-float" \
 	[mips_arch_list_matching mips1 !singlefloat]
 
-    run_dump_test "mips16-vis-1"
+    if { !$is_r6 } {
+        run_dump_test "mips16-vis-1"
+    }
     run_dump_test "call-nonpic-1"
     run_dump_test "mips32-sync"
     run_dump_test_arches "mips32r2-sync" [lsort -dictionary -unique [concat \
@@ -1519,33 +1578,35 @@ if { [istarget mips*-*-vxworks*] } {
 	run_dump_test "reginfo-2-n32"
     }
 
-    run_dump_test "micromips"
-    run_dump_test "micromips-trap"
-    run_dump_test "micromips-compact"
-    run_dump_test "micromips-insn32"
-    run_dump_test "micromips-noinsn32"
-    run_list_test "micromips" "-mips32r2 -32 -mfp64 -minsn32" \
-	"microMIPS for MIPS32r2 (instructions invalid in insn32 mode)"
-    run_list_test "micromips-size-0" \
-	"-32 -march=mips64 -mmicromips" "microMIPS instruction size 0"
-    run_dump_test "micromips-size-1"
-    run_dump_test "micromips-branch-relax"
-    run_dump_test "micromips-branch-relax-pic${imips}"
-    run_dump_test "micromips-branch-relax-insn32"
-    run_dump_test "micromips-branch-relax-insn32-pic${imips}"
-    run_dump_test "micromips-branch-delay"
-    run_dump_test "micromips-warn-branch-delay"
-    run_dump_test "micromips-warn-branch-delay-1"
-    run_dump_test "micromips-branch-absolute"
-    run_dump_test "micromips-branch-absolute-addend"
-    if $has_newabi {
-	run_dump_test "micromips-branch-absolute-n32"
-	run_dump_test "micromips-branch-absolute-addend-n32"
-	run_dump_test "micromips-branch-absolute-n64"
-	run_dump_test "micromips-branch-absolute-addend-n64"
+    if { !$is_r6 } {
+	run_dump_test "micromips"
+	run_dump_test "micromips-trap"
+	run_dump_test "micromips-compact"
+	run_dump_test "micromips-insn32"
+	run_dump_test "micromips-noinsn32"
+	run_list_test "micromips" "-mips32r2 -32 -mfp64 -minsn32" \
+	    "microMIPS for MIPS32r2 (instructions invalid in insn32 mode)"
+	run_list_test "micromips-size-0" \
+	    "-32 -march=mips64 -mmicromips" "microMIPS instruction size 0"
+	run_dump_test "micromips-size-1"
+	run_dump_test "micromips-branch-relax"
+	run_dump_test "micromips-branch-relax-pic${imips}"
+	run_dump_test "micromips-branch-relax-insn32"
+	run_dump_test "micromips-branch-relax-insn32-pic${imips}"
+	run_dump_test "micromips-branch-delay"
+	run_dump_test "micromips-warn-branch-delay"
+	run_dump_test "micromips-warn-branch-delay-1"
+	run_dump_test "micromips-branch-absolute"
+	run_dump_test "micromips-branch-absolute-addend"
+	if $has_newabi {
+	    run_dump_test "micromips-branch-absolute-n32"
+	    run_dump_test "micromips-branch-absolute-addend-n32"
+	    run_dump_test "micromips-branch-absolute-n64"
+	    run_dump_test "micromips-branch-absolute-addend-n64"
+	}
+	run_dump_test "micromips-b16"
+	run_list_test "micromips-ill"
     }
-    run_dump_test "micromips-b16"
-    run_list_test "micromips-ill"
 
     run_dump_test_arches "mcu"		[mips_arch_list_matching mips32r2 \
 					    !octeon]
@@ -1599,7 +1660,9 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "ulh-reloc"	[mips_arch_list_matching mips2 !mips32r6]
 
     run_dump_test "l_d-reloc"
-    run_list_test "bltzal"
+    if { !$is_r6 } {
+        run_list_test "bltzal"
+    }
 
     run_dump_test_arches "msa"		[mips_arch_list_matching mips32r2]
     if { $has_newabi } {
@@ -1622,185 +1685,189 @@ if { [istarget mips*-*-vxworks*] } {
 	run_dump_test "pcrel-4-64"
     }
 
-    run_dump_test "pcrel-reloc-1"
+    if { !$is_r6 } {
+        run_dump_test "pcrel-reloc-1"
+        run_dump_test "pcrel-reloc-2"
+        run_dump_test "pcrel-reloc-3"
+        run_dump_test "pcrel-reloc-4"
+        run_dump_test "pcrel-reloc-5"
+        run_dump_test "pcrel-reloc-6"
+        run_list_test "pcrel-reloc-6" "-32 --defsym offset=4" \
+	    "MIPS local PC-relative relocations 6b"
+    }
     run_dump_test "pcrel-reloc-1-r6"
-    run_dump_test "pcrel-reloc-2"
     run_dump_test "pcrel-reloc-2-r6"
-    run_dump_test "pcrel-reloc-3"
     run_dump_test "pcrel-reloc-3-r6"
-    run_dump_test "pcrel-reloc-4"
     run_dump_test "pcrel-reloc-4-r6"
-    run_dump_test "pcrel-reloc-5"
     run_dump_test "pcrel-reloc-5-r6"
-    run_dump_test "pcrel-reloc-6"
-    run_list_test "pcrel-reloc-6" "-32 --defsym offset=4" \
-	"MIPS local PC-relative relocations 6b"
-
-    run_dump_test_arches "mips16-pcrel-0" [mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-1" [mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-2" [mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-3" [mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-4" [mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-5" [mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-pic-0" \
+
+    if { !$is_r6 } {
+        run_dump_test_arches "mips16-pcrel-0" [mips_arch_list_matching mips16-32]
+        run_dump_test_arches "mips16-pcrel-1" [mips_arch_list_matching mips16-64]
+        run_dump_test_arches "mips16-pcrel-2" [mips_arch_list_matching mips16-32]
+        run_dump_test_arches "mips16-pcrel-3" [mips_arch_list_matching mips16-32]
+        run_dump_test_arches "mips16-pcrel-4" [mips_arch_list_matching mips16-32]
+        run_dump_test_arches "mips16-pcrel-5" [mips_arch_list_matching mips16-32]
+        run_dump_test_arches "mips16-pcrel-pic-0" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-pic-1" \
+        run_dump_test_arches "mips16-pcrel-pic-1" \
 					[mips_arch_list_matching mips16-64]
-    if $has_newabi {
-	run_dump_test_arches "mips16-pcrel-n32-0" \
+        if $has_newabi {
+	    run_dump_test_arches "mips16-pcrel-n32-0" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-n32-1" \
+	    run_dump_test_arches "mips16-pcrel-n32-1" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-n64-sym32-0" \
+	    run_dump_test_arches "mips16-pcrel-n64-sym32-0" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-n64-sym32-1" \
+	    run_dump_test_arches "mips16-pcrel-n64-sym32-1" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-n64-0" \
+	    run_dump_test_arches "mips16-pcrel-n64-0" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-n64-1" \
+	    run_dump_test_arches "mips16-pcrel-n64-1" \
 					[mips_arch_list_matching mips16-64]
-    }
-    run_dump_test_arches "mips16-pcrel-delay-0" \
+        }
+        run_dump_test_arches "mips16-pcrel-delay-0" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-delay-1" \
+        run_dump_test_arches "mips16-pcrel-delay-1" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test "mips16-pcrel-relax-0"
-    run_dump_test "mips16-pcrel-relax-1"
-    run_dump_test "mips16-pcrel-relax-2"
-    run_dump_test "mips16-pcrel-relax-3"
-    run_dump_test_arches "mips16-pcrel-reloc-0" \
+        run_dump_test "mips16-pcrel-relax-0"
+        run_dump_test "mips16-pcrel-relax-1"
+        run_dump_test "mips16-pcrel-relax-2"
+        run_dump_test "mips16-pcrel-relax-3"
+        run_dump_test_arches "mips16-pcrel-reloc-0" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-reloc-1" \
+        run_dump_test_arches "mips16-pcrel-reloc-1" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-reloc-2" \
+        run_dump_test_arches "mips16-pcrel-reloc-2" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-reloc-3" \
+        run_dump_test_arches "mips16-pcrel-reloc-3" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-reloc-4" \
+        run_dump_test_arches "mips16-pcrel-reloc-4" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-reloc-5" \
+        run_dump_test_arches "mips16-pcrel-reloc-5" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-reloc-6" \
+        run_dump_test_arches "mips16-pcrel-reloc-6" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-reloc-7" \
+        run_dump_test_arches "mips16-pcrel-reloc-7" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-addend-0" \
+        run_dump_test_arches "mips16-pcrel-addend-0" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-addend-1" \
+        run_dump_test_arches "mips16-pcrel-addend-1" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-addend-2" \
+        run_dump_test_arches "mips16-pcrel-addend-2" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-addend-3" \
+        run_dump_test_arches "mips16-pcrel-addend-3" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-addend-4" \
+        run_dump_test_arches "mips16-pcrel-addend-4" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-addend-5" \
+        run_dump_test_arches "mips16-pcrel-addend-5" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-addend-6" \
+        run_dump_test_arches "mips16-pcrel-addend-6" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-addend-7" \
+        run_dump_test_arches "mips16-pcrel-addend-7" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-addend-8" \
+        run_dump_test_arches "mips16-pcrel-addend-8" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-addend-9" \
+        run_dump_test_arches "mips16-pcrel-addend-9" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-addend-pic-8" \
+        run_dump_test_arches "mips16-pcrel-addend-pic-8" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-addend-pic-9" \
+        run_dump_test_arches "mips16-pcrel-addend-pic-9" \
 					[mips_arch_list_matching mips16-64]
-    if $has_newabi {
-	run_dump_test_arches "mips16-pcrel-addend-n32-8" \
+        if $has_newabi {
+	    run_dump_test_arches "mips16-pcrel-addend-n32-8" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-addend-n32-9" \
+	    run_dump_test_arches "mips16-pcrel-addend-n32-9" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-addend-n64-sym32-8" \
+	    run_dump_test_arches "mips16-pcrel-addend-n64-sym32-8" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-addend-n64-sym32-9" \
+	    run_dump_test_arches "mips16-pcrel-addend-n64-sym32-9" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-addend-n64-8" \
+	    run_dump_test_arches "mips16-pcrel-addend-n64-8" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-addend-n64-9" \
+	    run_dump_test_arches "mips16-pcrel-addend-n64-9" \
 					[mips_arch_list_matching mips16-64]
-    }
-    run_dump_test_arches "mips16-pcrel-absolute" \
+        }
+        run_dump_test_arches "mips16-pcrel-absolute" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-absolute-1" \
+        run_dump_test_arches "mips16-pcrel-absolute-1" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-absolute-2" \
+        run_dump_test_arches "mips16-pcrel-absolute-2" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-absolute-3" \
+        run_dump_test_arches "mips16-pcrel-absolute-3" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-absolute-4" \
+        run_dump_test_arches "mips16-pcrel-absolute-4" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-absolute-5" \
+        run_dump_test_arches "mips16-pcrel-absolute-5" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-absolute-6" \
+        run_dump_test_arches "mips16-pcrel-absolute-6" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-absolute-7" \
+        run_dump_test_arches "mips16-pcrel-absolute-7" \
 					[mips_arch_list_matching mips16-64]
-    run_dump_test_arches "mips16-pcrel-absolute-pic-4" \
+        run_dump_test_arches "mips16-pcrel-absolute-pic-4" \
 					[mips_arch_list_matching mips16-32]
-    run_dump_test_arches "mips16-pcrel-absolute-pic-6" \
+        run_dump_test_arches "mips16-pcrel-absolute-pic-6" \
 					[mips_arch_list_matching mips16-64]
-    if $has_newabi {
-	run_dump_test_arches "mips16-pcrel-absolute-n32-4" \
+        if $has_newabi {
+	    run_dump_test_arches "mips16-pcrel-absolute-n32-4" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-n32-6" \
+	    run_dump_test_arches "mips16-pcrel-absolute-n32-6" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-n64-4" \
+	    run_dump_test_arches "mips16-pcrel-absolute-n64-4" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-n64-6" \
+	    run_dump_test_arches "mips16-pcrel-absolute-n64-6" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-n64-sym32-4" \
+	    run_dump_test_arches "mips16-pcrel-absolute-n64-sym32-4" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-n64-sym32-6" \
+	    run_dump_test_arches "mips16-pcrel-absolute-n64-sym32-6" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-pic-n32-4" \
+	    run_dump_test_arches "mips16-pcrel-absolute-pic-n32-4" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-pic-n32-6" \
+	    run_dump_test_arches "mips16-pcrel-absolute-pic-n32-6" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-pic-n64-4" \
+	    run_dump_test_arches "mips16-pcrel-absolute-pic-n64-4" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-pic-n64-6" \
+	    run_dump_test_arches "mips16-pcrel-absolute-pic-n64-6" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-pic-n64-sym32-4" \
+	    run_dump_test_arches "mips16-pcrel-absolute-pic-n64-sym32-4" \
 					[mips_arch_list_matching mips16-64]
-	run_dump_test_arches "mips16-pcrel-absolute-pic-n64-sym32-6" \
+	    run_dump_test_arches "mips16-pcrel-absolute-pic-n64-sym32-6" \
 					[mips_arch_list_matching mips16-64]
+        }
+        run_dump_test "mips16-branch-reloc-0"
+        run_dump_test "mips16-branch-reloc-1"
+        run_dump_test "mips16-branch-reloc-2"
+        run_dump_test "mips16-branch-reloc-3"
+        run_dump_test "mips16-branch-reloc-4"
+        run_dump_test "mips16-branch-reloc-5"
+        run_dump_test "mips16-branch-addend-0"
+        run_dump_test "mips16-branch-addend-1"
+        run_dump_test "mips16-branch-addend-2"
+        run_dump_test "mips16-branch-addend-3"
+        run_dump_test "mips16-branch-addend-4"
+        run_dump_test "mips16-branch-addend-5"
+        run_dump_test "mips16-branch-absolute"
+        run_dump_test "mips16-branch-absolute-1"
+        run_dump_test "mips16-branch-absolute-2"
+        run_dump_test "mips16-branch-absolute-addend"
+        run_dump_test "mips16-branch-absolute-addend-1"
+        if $has_newabi {
+	    run_dump_test "mips16-branch-absolute-n32"
+	    run_dump_test "mips16-branch-absolute-n32-1"
+	    run_dump_test "mips16-branch-absolute-n32-2"
+	    run_dump_test "mips16-branch-absolute-addend-n32"
+	    run_dump_test "mips16-branch-absolute-addend-n32-1"
+	    run_dump_test "mips16-branch-absolute-n64"
+	    run_dump_test "mips16-branch-absolute-n64-1"
+	    run_dump_test "mips16-branch-absolute-n64-2"
+	    run_dump_test "mips16-branch-absolute-addend-n64"
+	    run_dump_test "mips16-branch-absolute-addend-n64-1"
+        }
+        run_dump_test "mips16-absolute-reloc-0"
+        run_dump_test "mips16-absolute-reloc-1"
+        run_dump_test "mips16-absolute-reloc-2"
+        run_dump_test "mips16-absolute-reloc-3"
     }
-    run_dump_test "mips16-branch-reloc-0"
-    run_dump_test "mips16-branch-reloc-1"
-    run_dump_test "mips16-branch-reloc-2"
-    run_dump_test "mips16-branch-reloc-3"
-    run_dump_test "mips16-branch-reloc-4"
-    run_dump_test "mips16-branch-reloc-5"
-    run_dump_test "mips16-branch-addend-0"
-    run_dump_test "mips16-branch-addend-1"
-    run_dump_test "mips16-branch-addend-2"
-    run_dump_test "mips16-branch-addend-3"
-    run_dump_test "mips16-branch-addend-4"
-    run_dump_test "mips16-branch-addend-5"
-    run_dump_test "mips16-branch-absolute"
-    run_dump_test "mips16-branch-absolute-1"
-    run_dump_test "mips16-branch-absolute-2"
-    run_dump_test "mips16-branch-absolute-addend"
-    run_dump_test "mips16-branch-absolute-addend-1"
-    if $has_newabi {
-	run_dump_test "mips16-branch-absolute-n32"
-	run_dump_test "mips16-branch-absolute-n32-1"
-	run_dump_test "mips16-branch-absolute-n32-2"
-	run_dump_test "mips16-branch-absolute-addend-n32"
-	run_dump_test "mips16-branch-absolute-addend-n32-1"
-	run_dump_test "mips16-branch-absolute-n64"
-	run_dump_test "mips16-branch-absolute-n64-1"
-	run_dump_test "mips16-branch-absolute-n64-2"
-	run_dump_test "mips16-branch-absolute-addend-n64"
-	run_dump_test "mips16-branch-absolute-addend-n64-1"
-    }
-    run_dump_test "mips16-absolute-reloc-0"
-    run_dump_test "mips16-absolute-reloc-1"
-    run_dump_test "mips16-absolute-reloc-2"
-    run_dump_test "mips16-absolute-reloc-3"
 
     run_dump_test_arches "attr-gnu-4-0" "-32" \
 				    [mips_arch_list_matching mips1]
@@ -1924,7 +1991,7 @@ if { [istarget mips*-*-vxworks*] } {
 	run_dump_test_arches "attr-gnu-4-3" "-64" \
 				    [mips_arch_list_matching mips3]
     }
- 
+
     run_list_test_arches "attr-gnu-4-4" "-32 -mfp32" \
 				    [mips_arch_list_matching mips1 !mips32r6]
     run_list_test_arches "attr-gnu-4-4" "-32 -mfpxx" \
@@ -1993,30 +2060,35 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arches "attr-gnu-4-7" "-32 -mfp64 -mno-odd-spreg" \
 				    [mips_arch_list_matching mips32r2]
 
-    run_dump_test "attr-gnu-abi-fp-1"
+    if { !$is_r6 } {
+        run_dump_test "attr-gnu-abi-fp-1"
+    }
     run_dump_test "attr-gnu-abi-msa-1"
 
     run_dump_test "module-override"
     run_dump_test "module-defer-warn1"
-    run_list_test "module-defer-warn2" "-32"
+    ## mips32r2 or above support FP64, so no "Error: `fp=64' used with a 32-bit fpu"
+    run_list_test "module-defer-warn2" "-32 -mips32"
 
-    foreach testopt [list -mfp32 -mfpxx -mfp64 "-mfp64-noodd" \
-			  -msingle-float -msoft-float] {
-      foreach cmdopt [list -mfp32 -mfpxx -mfp64 "-mfp64 -mno-odd-spreg" \
-			   -msingle-float -msoft-float] {
-        run_dump_test "module${testopt}" \
-			    [list [list as $cmdopt] [list name ($cmdopt)]]
-      }
+    if { !$is_r6 } {
+        foreach testopt [list -mfp32 -mfpxx -mfp64 "-mfp64-noodd" \
+                           -msingle-float -msoft-float] {
+          foreach cmdopt [list -mfp32 -mfpxx -mfp64 "-mfp64 -mno-odd-spreg" \
+                           -msingle-float -msoft-float] {
+            run_dump_test "module${testopt}" \
+                           [list [list as $cmdopt] [list name ($cmdopt)]]
+          }
+        }
+        run_dump_test "module-set-mfpxx"
     }
 
-    run_dump_test "module-set-mfpxx"
     run_list_test_arches "fpxx-oddfpreg" "-32 -mfpxx" \
-			[mips_arch_list_matching mips2 !singlefloat]
+			[mips_arch_list_matching mips2 !singlefloat !mips32r6]
     run_list_test_arches "fpxx-oddfpreg" "-32 -mfpxx -mno-odd-spreg" \
-			[mips_arch_list_matching mips2 !singlefloat]
+			[mips_arch_list_matching mips2 !singlefloat !mips32r6]
     run_dump_test_arches "fpxx-oddfpreg" \
-			[mips_arch_list_matching oddspreg]
-    run_dump_test_arches "odd-spreg" "-mfp32" [mips_arch_list_matching oddspreg]
+			[mips_arch_list_matching oddspreg !mips32r6]
+    run_dump_test_arches "odd-spreg" "-mfp32" [mips_arch_list_matching oddspreg !mips32r6]
     run_dump_test_arches "odd-spreg" "-mfpxx" [mips_arch_list_matching oddspreg]
     run_dump_test_arches "odd-spreg" "-mfp64" [mips_arch_list_matching mips32r2]
     run_dump_test_arches "no-odd-spreg" "-mfp32" [mips_arch_list_matching mips1 \
@@ -2035,13 +2107,15 @@ if { [istarget mips*-*-vxworks*] } {
 	"MIPS invalid PIC option in VxWorks PIC"
     run_list_test "option-pic-vxworks-2" "-mvxworks-pic" \
 	"MIPS invalid switch to SVR4 PIC from VxWorks PIC"
-    run_dump_test "option-pic-relax-0"
-    run_dump_test "option-pic-relax-1"
-    run_dump_test "option-pic-relax-2"
-    run_dump_test "option-pic-relax-3"
-    run_dump_test "option-pic-relax-3a"
-    run_dump_test "option-pic-relax-4"
-    run_dump_test "option-pic-relax-5"
+    if { !$is_r6 } {
+        run_dump_test "option-pic-relax-0"
+        run_dump_test "option-pic-relax-1"
+        run_dump_test "option-pic-relax-2"
+        run_dump_test "option-pic-relax-3"
+        run_dump_test "option-pic-relax-3a"
+        run_dump_test "option-pic-relax-4"
+        run_dump_test "option-pic-relax-5"
+    }
 
     run_dump_test_arches "isa-override-1" "" [mips_arch_list_matching mips1]
     run_dump_test_arches "isa-override-2" "" [mips_arch_list_matching mips1]
@@ -2050,18 +2124,20 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test "debug-label-end-2"
     run_dump_test "debug-label-end-3"
 
-    run_dump_test "org-1"
-    run_dump_test "org-2"
-    run_dump_test "org-3"
-    run_dump_test "org-4"
-    run_dump_test "org-5"
-    run_dump_test "org-6"
-    run_dump_test "org-7"
-    run_dump_test "org-8"
-    run_dump_test "org-9"
-    run_dump_test "org-10"
-    run_dump_test "org-11"
-    run_dump_test "org-12"
+    if { !$is_r6 } {
+        run_dump_test "org-1"
+        run_dump_test "org-2"
+        run_dump_test "org-3"
+        run_dump_test "org-4"
+        run_dump_test "org-5"
+        run_dump_test "org-6"
+        run_dump_test "org-7"
+        run_dump_test "org-8"
+        run_dump_test "org-9"
+        run_dump_test "org-10"
+        run_dump_test "org-11"
+        run_dump_test "org-12"
+    }
 
     run_dump_test_arches "stabs-symbol-type" [mips_arch_list_all]
 
@@ -2091,8 +2167,9 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test_arch "llpscp-64" "" mips64r6
 
     run_dump_test "pr14798${imips}"
-    run_dump_test "insn-isa-mode"
-    run_dump_test "insn-isa-mode"
+    if { !$is_r6 } {
+	run_dump_test "insn-isa-mode"
+    }
     run_dump_test "global-local-symtab-o32${tmips}"
     run_dump_test "global-local-symtab-sort-o32${tmips}"
     if $has_newabi {
diff --git a/gas/testsuite/gas/mips/mipsr6@beq.d b/gas/testsuite/gas/mips/mipsr6@beq.d
index d6fc670445e..c73109164cc 100644
--- a/gas/testsuite/gas/mips/mipsr6@beq.d
+++ b/gas/testsuite/gas/mips/mipsr6@beq.d
@@ -1,6 +1,6 @@
 #objdump: -dr --prefix-addresses -mmips:4000
 #name: MIPS beq
-#as: -32
+#as: -32 --defsym r6=1
 #source: beq.s
 
 # Test the beq macro.
diff --git a/gas/testsuite/gas/mips/mipsr6@cache.d b/gas/testsuite/gas/mips/mipsr6@cache.d
index 803f5de05f0..ca6e06066ee 100644
--- a/gas/testsuite/gas/mips/mipsr6@cache.d
+++ b/gas/testsuite/gas/mips/mipsr6@cache.d
@@ -1,7 +1,7 @@
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS CACHE instruction
 #source: cache.s
-#as: -32
+#as: -32 --defsym r6=1
 
 # Check MIPS CACHE instruction assembly.
 
diff --git a/gas/testsuite/gas/mips/mipsr6@hwr-names.d b/gas/testsuite/gas/mips/mipsr6@hwr-names.d
index e44a120c384..3c1473fd88e 100644
--- a/gas/testsuite/gas/mips/mipsr6@hwr-names.d
+++ b/gas/testsuite/gas/mips/mipsr6@hwr-names.d
@@ -1,6 +1,6 @@
 #objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa32r6 -M gpr-names=numeric,hwr-names=mips32r6
 #name: MIPS HWR disassembly (mips32r6)
-#as: -32
+#as: -32 --defsym r6=1
 #source: hwr-names.s
 
 # Check objdump's handling of -M hwr-names=foo options.
diff --git a/gas/testsuite/gas/mips/mipsr6@mips32.d b/gas/testsuite/gas/mips/mipsr6@mips32.d
index e7af216b499..b909880cd56 100644
--- a/gas/testsuite/gas/mips/mipsr6@mips32.d
+++ b/gas/testsuite/gas/mips/mipsr6@mips32.d
@@ -1,7 +1,7 @@
 #objdump: -dr --prefix-addresses --show-raw-insn
-#name: MIPS MIPS32 instructions
-#as: -32
 #source: mips32.s
+#name: MIPS MIPS32 instructions
+#as: -32 --defsym r6=1
 
 # Check MIPS32 instruction assembly
 
diff --git a/gas/testsuite/gas/mips/mipsr6@pref.d b/gas/testsuite/gas/mips/mipsr6@pref.d
index a6446655a98..389b03334aa 100644
--- a/gas/testsuite/gas/mips/mipsr6@pref.d
+++ b/gas/testsuite/gas/mips/mipsr6@pref.d
@@ -1,6 +1,6 @@
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS PREF instruction
-#as: -32 --defsym tpref=1
+#as: -32 --defsym tpref=1 --defsym r6=1
 #source: cache.s
 
 # Check MIPS PREF instruction assembly.
diff --git a/gas/testsuite/gas/mips/option-pic-1.d b/gas/testsuite/gas/mips/option-pic-1.d
index da32af6a6ce..612414ae752 100644
--- a/gas/testsuite/gas/mips/option-pic-1.d
+++ b/gas/testsuite/gas/mips/option-pic-1.d
@@ -13,6 +13,6 @@ Disassembly of section \.text:
 [ 	]*[0-9a-f]+: R_MIPS_LO16	bar
 [0-9a-f]+ <[^>]*> 8f820000 	lw	v0,0\(gp\)
 [ 	]*[0-9a-f]+: R_MIPS_GOT16	bar
-[0-9a-f]+ <[^>]*> 03e00008 	jr	ra
+[0-9a-f]+ <[^>]*> 03e0000[89] 	jr	ra
 [0-9a-f]+ <[^>]*> 00000000 	nop
 	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-01.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-01.d
index 24d051d5c42..2993d6d0b63 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-01.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-01.d
@@ -2,6 +2,7 @@
 #source: attr-gnu-4-1.s
 #ld: -r
 #readelf: -A
+#xfail: mipsisa32r6*-*-* mipsisa64r6*-*-*
 
 Attribute Section: gnu
 File Attributes
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-11.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-11.d
index ce94a818eb6..a76da49fad2 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-11.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-11.d
@@ -2,6 +2,7 @@
 #source: attr-gnu-4-1.s
 #ld: -r
 #readelf: -A
+#xfail: mipsisa32r6*-*-* mipsisa64r6*-*-*
 
 Attribute Section: gnu
 File Attributes
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-4-41.d b/ld/testsuite/ld-mips-elf/attr-gnu-4-41.d
index 49f2137e0e2..acebbeb7d25 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-4-41.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-4-41.d
@@ -1,6 +1,7 @@
 #source: attr-gnu-4-4.s -W
 #source: attr-gnu-4-1.s
 #ld: -r
+#xfail: mipsisa32r6*-*-* mipsisa64r6*-*-*
 #error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
 #error:   [^\n]*: warning: .* uses -mips32r2 -mfp64 \(12 callee-saved\) \(set by .*\), .* uses -mdouble-float\n
 #error:   [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-8-00.d b/ld/testsuite/ld-mips-elf/attr-gnu-8-00.d
index 2f8e5f09253..34f766bae52 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-8-00.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-8-00.d
@@ -5,5 +5,5 @@
 
 Attribute Section: gnu
 File Attributes
-  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+  Tag_GNU_MIPS_ABI_FP: Hard float \((double precision|32-bit CPU, 64-bit FPU)\)
 #pass
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-8-01.d b/ld/testsuite/ld-mips-elf/attr-gnu-8-01.d
index e2cda3341e7..26a835f9792 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-8-01.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-8-01.d
@@ -5,6 +5,6 @@
 
 Attribute Section: gnu
 File Attributes
-  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+  Tag_GNU_MIPS_ABI_FP: Hard float \((double precision|32-bit CPU, 64-bit FPU)\)
   Tag_GNU_MIPS_ABI_MSA: 128-bit MSA
 #pass
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-8-02.d b/ld/testsuite/ld-mips-elf/attr-gnu-8-02.d
index 54b196fa38b..aee5d4cf577 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-8-02.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-8-02.d
@@ -5,6 +5,6 @@
 
 Attribute Section: gnu
 File Attributes
-  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+  Tag_GNU_MIPS_ABI_FP: Hard float \((double precision|32-bit CPU, 64-bit FPU)\)
   Tag_GNU_MIPS_ABI_MSA: \?\?\? \(2\)
 #pass
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-8-10.d b/ld/testsuite/ld-mips-elf/attr-gnu-8-10.d
index f7c512beeb4..de9ac3009a5 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-8-10.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-8-10.d
@@ -5,6 +5,6 @@
 
 Attribute Section: gnu
 File Attributes
-  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+  Tag_GNU_MIPS_ABI_FP: Hard float \((double precision|32-bit CPU, 64-bit FPU)\)
   Tag_GNU_MIPS_ABI_MSA: 128-bit MSA
 #pass
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-8-11.d b/ld/testsuite/ld-mips-elf/attr-gnu-8-11.d
index be87af4bd18..c07721c4261 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-8-11.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-8-11.d
@@ -5,6 +5,6 @@
 
 Attribute Section: gnu
 File Attributes
-  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+  Tag_GNU_MIPS_ABI_FP: Hard float \((double precision|32-bit CPU, 64-bit FPU)\)
   Tag_GNU_MIPS_ABI_MSA: 128-bit MSA
 #pass
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-8-20.d b/ld/testsuite/ld-mips-elf/attr-gnu-8-20.d
index 05f4da064a9..47de4c7763d 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-8-20.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-8-20.d
@@ -5,6 +5,6 @@
 
 Attribute Section: gnu
 File Attributes
-  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+  Tag_GNU_MIPS_ABI_FP: Hard float \((double precision|32-bit CPU, 64-bit FPU)\)
   Tag_GNU_MIPS_ABI_MSA: \?\?\? \(2\)
 #pass
diff --git a/ld/testsuite/ld-mips-elf/attr-gnu-8-22.d b/ld/testsuite/ld-mips-elf/attr-gnu-8-22.d
index 908ce4f00a2..ba267ebdd3c 100644
--- a/ld/testsuite/ld-mips-elf/attr-gnu-8-22.d
+++ b/ld/testsuite/ld-mips-elf/attr-gnu-8-22.d
@@ -5,6 +5,6 @@
 
 Attribute Section: gnu
 File Attributes
-  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+  Tag_GNU_MIPS_ABI_FP: Hard float \((double precision|32-bit CPU, 64-bit FPU)\)
   Tag_GNU_MIPS_ABI_MSA: \?\?\? \(2\)
 #pass
diff --git a/ld/testsuite/ld-mips-elf/emit-relocs-1.d b/ld/testsuite/ld-mips-elf/emit-relocs-1.d
index 86305d314c5..d305752aad3 100644
--- a/ld/testsuite/ld-mips-elf/emit-relocs-1.d
+++ b/ld/testsuite/ld-mips-elf/emit-relocs-1.d
@@ -23,7 +23,7 @@ OFFSET   TYPE              VALUE *
 
 
 Contents of section \.text:
- 80000 03e00008 00000000 00000000 00000000  .*
+ 80000 03e0000[89] 00000000 00000000 00000000  .*
 Contents of section \.merge1:
  80400 666c7574 74657200                    flutter.*
 Contents of section \.merge2:
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-n32.dd b/ld/testsuite/ld-mips-elf/export-class-call16-n32.dd
index a033972a9d5..011089a56ba 100644
--- a/ld/testsuite/ld-mips-elf/export-class-call16-n32.dd
+++ b/ld/testsuite/ld-mips-elf/export-class-call16-n32.dd
@@ -21,21 +21,21 @@ Disassembly of section \.text:
 12340038:	00000000 	nop
 1234003c:	dfbc0000 	ld	gp,0\(sp\)
 12340040:	dfbf0008 	ld	ra,8\(sp\)
-12340044:	03e00008 	jr	ra
+12340044:	03e0000[89] 	jr	ra
 12340048:	27bd0010 	addiu	sp,sp,16
 	\.\.\.
 
 12340060 <protected_foo>:
-12340060:	03e00008 	jr	ra
+12340060:	03e0000[89] 	jr	ra
 12340064:	00000000 	nop
 	\.\.\.
 
 12340070 <hidden_foo>:
-12340070:	03e00008 	jr	ra
+12340070:	03e0000[89] 	jr	ra
 12340074:	00000000 	nop
 	\.\.\.
 
 12340080 <internal_foo>:
-12340080:	03e00008 	jr	ra
+12340080:	03e0000[89] 	jr	ra
 12340084:	00000000 	nop
 	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-n64.dd b/ld/testsuite/ld-mips-elf/export-class-call16-n64.dd
index 7b481aaa015..1694500b526 100644
--- a/ld/testsuite/ld-mips-elf/export-class-call16-n64.dd
+++ b/ld/testsuite/ld-mips-elf/export-class-call16-n64.dd
@@ -21,21 +21,21 @@ Disassembly of section \.text:
 123456789abc0038:	00000000 	nop
 123456789abc003c:	dfbc0000 	ld	gp,0\(sp\)
 123456789abc0040:	dfbf0008 	ld	ra,8\(sp\)
-123456789abc0044:	03e00008 	jr	ra
+123456789abc0044:	03e0000[89] 	jr	ra
 123456789abc0048:	67bd0010 	daddiu	sp,sp,16
 	\.\.\.
 
 123456789abc0060 <protected_foo>:
-123456789abc0060:	03e00008 	jr	ra
+123456789abc0060:	03e0000[89] 	jr	ra
 123456789abc0064:	00000000 	nop
 	\.\.\.
 
 123456789abc0070 <hidden_foo>:
-123456789abc0070:	03e00008 	jr	ra
+123456789abc0070:	03e0000[89] 	jr	ra
 123456789abc0074:	00000000 	nop
 	\.\.\.
 
 123456789abc0080 <internal_foo>:
-123456789abc0080:	03e00008 	jr	ra
+123456789abc0080:	03e0000[89] 	jr	ra
 123456789abc0084:	00000000 	nop
 	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/export-class-call16-o32.dd b/ld/testsuite/ld-mips-elf/export-class-call16-o32.dd
index 616af2fe0cf..2ea8be62297 100644
--- a/ld/testsuite/ld-mips-elf/export-class-call16-o32.dd
+++ b/ld/testsuite/ld-mips-elf/export-class-call16-o32.dd
@@ -23,21 +23,21 @@ Disassembly of section \.text:
 12340040:	00000000 	nop
 12340044:	8fbc0000 	lw	gp,0\(sp\)
 12340048:	8fbf0004 	lw	ra,4\(sp\)
-1234004c:	03e00008 	jr	ra
+1234004c:	03e0000[89] 	jr	ra
 12340050:	27bd0008 	addiu	sp,sp,8
 	\.\.\.
 
 12340060 <protected_foo>:
-12340060:	03e00008 	jr	ra
+12340060:	03e0000[89] 	jr	ra
 12340064:	00000000 	nop
 	\.\.\.
 
 12340070 <hidden_foo>:
-12340070:	03e00008 	jr	ra
+12340070:	03e0000[89] 	jr	ra
 12340074:	00000000 	nop
 	\.\.\.
 
 12340080 <internal_foo>:
-12340080:	03e00008 	jr	ra
+12340080:	03e0000[89] 	jr	ra
 12340084:	00000000 	nop
 	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/gp-disp-sym.s b/ld/testsuite/ld-mips-elf/gp-disp-sym.s
index c6380ba1fb0..3b06e717f5f 100644
--- a/ld/testsuite/ld-mips-elf/gp-disp-sym.s
+++ b/ld/testsuite/ld-mips-elf/gp-disp-sym.s
@@ -2,4 +2,4 @@
   .text
 foo:
   lui    $t0, %hi(_gp_disp)
-  addi   $t0, $t0, %lo(_gp_disp)
+  addiu   $t0, $t0, %lo(_gp_disp)
diff --git a/ld/testsuite/ld-mips-elf/jalr3.dd b/ld/testsuite/ld-mips-elf/jalr3.dd
index 6b6d4841208..5c9d83fdfd4 100644
--- a/ld/testsuite/ld-mips-elf/jalr3.dd
+++ b/ld/testsuite/ld-mips-elf/jalr3.dd
@@ -9,6 +9,6 @@ Disassembly of section \.text:
    c:	00000000 	nop
 
 0+000010 <\$bar>:
-  10:	03e00008 	jr	ra
+  10:	03e0000[89] 	jr	ra
   14:	00000000 	nop
 	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/jalr4.dd b/ld/testsuite/ld-mips-elf/jalr4.dd
index 56ee0940b74..207a10283b8 100644
--- a/ld/testsuite/ld-mips-elf/jalr4.dd
+++ b/ld/testsuite/ld-mips-elf/jalr4.dd
@@ -9,15 +9,15 @@ Disassembly of section \.text:
 [0-9a-f]+ <[^>]*> 00000000 	nop
 [0-9a-f]+ <[^>]*> 0320f809 	jalr	t9
 [0-9a-f]+ <[^>]*> 00000000 	nop
-[0-9a-f]+ <[^>]*> 03200009 	jalr	zero,t9
+[0-9a-f]+ <[^>]*> 03200009 	(jalr	zero,t9|jr	t9)
 [0-9a-f]+ <[^>]*> 00000000 	nop
-[0-9a-f]+ <[^>]*> 03200008 	jr	t9
+[0-9a-f]+ <[^>]*> 0320000[89] 	jr	t9
 [0-9a-f]+ <[^>]*> 00000000 	nop
 [0-9a-f]+ <[^>]*> 0320f809 	jalr	t9
 [0-9a-f]+ <[^>]*> 00000000 	nop
-[0-9a-f]+ <[^>]*> 03200009 	jalr	zero,t9
+[0-9a-f]+ <[^>]*> 03200009 	(jalr	zero,t9|jr	t9)
 [0-9a-f]+ <[^>]*> 00000000 	nop
-[0-9a-f]+ <[^>]*> 03200008 	jr	t9
+[0-9a-f]+ <[^>]*> 0320000[89] 	jr	t9
 [0-9a-f]+ <[^>]*> 00000000 	nop
 	\.\.\.
 	\.\.\.
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 3744f6baa87..601f463ec1d 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -149,10 +149,18 @@ set abi_ldflags(n32) ""
 set abi_ldflags(n64) ""
 set abi_ldflags(eabi) ""
 
+if { $has_abi(o32) && $is_r6 }  {
+    set abi_as64flags "-mips64r6"
+} elseif { $has_abi(o32) && !$is_r6 } {
+    set abi_as64flags "-mips3"
+} else {
+    set abi_as64flags ""
+}
+
 # Override as needed.
 if {[istarget *-*-openbsd*] } {
     set irixemul 0
-} elseif { [istarget mips64*-*-linux*] } {
+} elseif { [istarget mips*64*-*-linux*] } {
     if [istarget *el-*-*] {
 	set abi_asflags(o32) -32
 	set abi_ldflags(o32) -melf32ltsmip
@@ -251,7 +259,7 @@ if {[istarget *-*-openbsd*] } {
 }
 set tmips [expr $irixemul ? {""} : {"t"}]
 
-if { $linux_gnu } {
+if { $linux_gnu && !$is_r6 } {
     run_ld_link_tests [list \
 	[list "Dummy shared library for MIPS16 PIC test 1" \
 	      "-shared -melf32btsmip" "" \
@@ -301,66 +309,71 @@ if { $linux_gnu } {
 }
 
 # Check MIPS16 markings being passed through link.
-run_dump_test "mips16-1"
+if { !$is_r6 } {
+    run_dump_test "mips16-1"
+}
 
 # MIPS branch offset final link checking.
 run_dump_test "branch-misc-1"
 run_dump_test "branch-misc-2"
-run_dump_test_o32 "branch-absolute"
-run_dump_test_o32 "branch-absolute-addend"
-run_dump_test_n32 "branch-absolute-n32"
-run_dump_test_n32 "branch-absolute-addend-n32"
-run_dump_test_n64 "branch-absolute-n64"
-run_dump_test_n64 "branch-absolute-addend-n64"
-
-run_dump_test_o32 "mips16-pcrel-0"
-run_dump_test_o32 "mips16-pcrel-1" noarch
-run_dump_test_o32 "mips16e2-pcrel-0" noarch
-run_dump_test_o32 "mips16e2-pcrel-1" noarch
-run_dump_test_o32 "mips16-pcrel-addend-2"
-run_dump_test_o32 "mips16-pcrel-addend-6"
-run_dump_test_o32 "mips16e2-pcrel-addend-2" noarch
-run_dump_test_o32 "mips16e2-pcrel-addend-6" noarch
-run_dump_test_n32 "mips16-pcrel-n32-0"
-run_dump_test_n32 "mips16-pcrel-n32-1"
-run_dump_test_n64 "mips16-pcrel-n64-sym32-0"
-run_dump_test_n64 "mips16-pcrel-n64-sym32-1"
-run_dump_test_n32 "mips16e2-pcrel-n32-0" noarch
-run_dump_test_n32 "mips16e2-pcrel-n32-1" noarch
-run_dump_test_n64 "mips16e2-pcrel-n64-sym32-0" noarch
-run_dump_test_n64 "mips16e2-pcrel-n64-sym32-1" noarch
-
-run_dump_test_o32 "mips16-branch-2"
-run_dump_test_o32 "mips16-branch-3"
-run_dump_test_o32 "mips16-branch-addend-2"
-run_dump_test_o32 "mips16-branch-addend-3"
-run_dump_test_o32 "mips16-branch-absolute"
-run_dump_test_o32 "mips16-branch-absolute-1"
-run_dump_test_o32 "mips16-branch-absolute-2"
-run_dump_test_o32 "mips16-branch-absolute-addend"
-run_dump_test_o32 "mips16-branch-absolute-addend-1"
-run_dump_test_n32 "mips16-branch-absolute-n32"
-run_dump_test_n32 "mips16-branch-absolute-n32-1"
-run_dump_test_n32 "mips16-branch-absolute-n32-2"
-run_dump_test_n32 "mips16-branch-absolute-addend-n32"
-run_dump_test_n32 "mips16-branch-absolute-addend-n32-1"
-run_dump_test_n64 "mips16-branch-absolute-n64"
-run_dump_test_n64 "mips16-branch-absolute-n64-1"
-run_dump_test_n64 "mips16-branch-absolute-n64-2"
-run_dump_test_n64 "mips16-branch-absolute-addend-n64"
-run_dump_test_n64 "mips16-branch-absolute-addend-n64-1"
-
-run_dump_test_o32 "micromips-branch-absolute"
-run_dump_test_o32 "micromips-branch-absolute-addend"
-run_dump_test_n32 "micromips-branch-absolute-n32"
-run_dump_test_n32 "micromips-branch-absolute-addend-n32"
-run_dump_test_n64 "micromips-branch-absolute-n64"
-run_dump_test_n64 "micromips-branch-absolute-addend-n64"
-
-# Jalx test
-run_dump_test "jalx-1"
 
-if { $linux_gnu } {
+if { !$is_r6 } {
+    run_dump_test_o32 "branch-absolute"
+    run_dump_test_o32 "branch-absolute-addend"
+    run_dump_test_n32 "branch-absolute-n32"
+    run_dump_test_n32 "branch-absolute-addend-n32"
+    run_dump_test_n64 "branch-absolute-n64"
+    run_dump_test_n64 "branch-absolute-addend-n64"
+
+    run_dump_test_o32 "mips16-pcrel-0"
+    run_dump_test_o32 "mips16-pcrel-1" noarch
+    run_dump_test_o32 "mips16e2-pcrel-0" noarch
+    run_dump_test_o32 "mips16e2-pcrel-1" noarch
+    run_dump_test_o32 "mips16-pcrel-addend-2"
+    run_dump_test_o32 "mips16-pcrel-addend-6"
+    run_dump_test_o32 "mips16e2-pcrel-addend-2" noarch
+    run_dump_test_o32 "mips16e2-pcrel-addend-6" noarch
+    run_dump_test_n32 "mips16-pcrel-n32-0"
+    run_dump_test_n32 "mips16-pcrel-n32-1"
+    run_dump_test_n64 "mips16-pcrel-n64-sym32-0"
+    run_dump_test_n64 "mips16-pcrel-n64-sym32-1"
+    run_dump_test_n32 "mips16e2-pcrel-n32-0" noarch
+    run_dump_test_n32 "mips16e2-pcrel-n32-1" noarch
+    run_dump_test_n64 "mips16e2-pcrel-n64-sym32-0" noarch
+    run_dump_test_n64 "mips16e2-pcrel-n64-sym32-1" noarch
+
+    run_dump_test_o32 "mips16-branch-2"
+    run_dump_test_o32 "mips16-branch-3"
+    run_dump_test_o32 "mips16-branch-addend-2"
+    run_dump_test_o32 "mips16-branch-addend-3"
+    run_dump_test_o32 "mips16-branch-absolute"
+    run_dump_test_o32 "mips16-branch-absolute-1"
+    run_dump_test_o32 "mips16-branch-absolute-2"
+    run_dump_test_o32 "mips16-branch-absolute-addend"
+    run_dump_test_o32 "mips16-branch-absolute-addend-1"
+    run_dump_test_n32 "mips16-branch-absolute-n32"
+    run_dump_test_n32 "mips16-branch-absolute-n32-1"
+    run_dump_test_n32 "mips16-branch-absolute-n32-2"
+    run_dump_test_n32 "mips16-branch-absolute-addend-n32"
+    run_dump_test_n32 "mips16-branch-absolute-addend-n32-1"
+    run_dump_test_n64 "mips16-branch-absolute-n64"
+    run_dump_test_n64 "mips16-branch-absolute-n64-1"
+    run_dump_test_n64 "mips16-branch-absolute-n64-2"
+    run_dump_test_n64 "mips16-branch-absolute-addend-n64"
+    run_dump_test_n64 "mips16-branch-absolute-addend-n64-1"
+
+    run_dump_test_o32 "micromips-branch-absolute"
+    run_dump_test_o32 "micromips-branch-absolute-addend"
+    run_dump_test_n32 "micromips-branch-absolute-n32"
+    run_dump_test_n32 "micromips-branch-absolute-addend-n32"
+    run_dump_test_n64 "micromips-branch-absolute-n64"
+    run_dump_test_n64 "micromips-branch-absolute-addend-n64"
+
+    # Jalx test
+    run_dump_test "jalx-1"
+}
+
+if { $linux_gnu && !$is_r6 } {
     run_ld_link_tests [list \
 	[list "Dummy shared library for JALX test 2" \
 	      "-shared -nostdlib -melf32btsmip" "" \
@@ -382,69 +395,75 @@ if { $linux_gnu } {
 	      "jalx-2"]]
 }
 
-run_dump_test_o32 "jalx-addend"
-run_dump_test_o32 "jalx-local"
-run_dump_test_o32 "bal-jalx-addend"
-run_dump_test_o32 "bal-jalx-addend-micromips"
-run_dump_test_o32 "bal-jalx-local"
-run_dump_test_o32 "bal-jalx-local-micromips"
-run_dump_test_o32 "bal-jalx-pic"
-run_dump_test_o32 "bal-jalx-pic-micromips"
-run_dump_test_o32 "bal-jalx-pic-ignore"
-run_dump_test_o32 "bal-jalx-pic-ignore-micromips"
-run_dump_test_n32 "jalx-addend-n32"
-run_dump_test_n32 "jalx-local-n32"
-run_dump_test_n32 "bal-jalx-addend-n32"
-run_dump_test_n32 "bal-jalx-addend-micromips-n32"
-run_dump_test_n32 "bal-jalx-local-n32"
-run_dump_test_n32 "bal-jalx-local-micromips-n32"
-run_dump_test_n32 "bal-jalx-pic-n32"
-run_dump_test_n32 "bal-jalx-pic-micromips-n32"
-run_dump_test_n32 "bal-jalx-pic-ignore-n32"
-run_dump_test_n32 "bal-jalx-pic-ignore-micromips-n32"
-run_dump_test_n64 "jalx-addend-n64"
-run_dump_test_n64 "jalx-local-n64"
-run_dump_test_n64 "bal-jalx-addend-n64"
-run_dump_test_n64 "bal-jalx-addend-micromips-n64"
-run_dump_test_n64 "bal-jalx-local-n64"
-run_dump_test_n64 "bal-jalx-local-micromips-n64"
-run_dump_test_n64 "bal-jalx-pic-n64"
-run_dump_test_n64 "bal-jalx-pic-micromips-n64"
-run_dump_test_n64 "bal-jalx-pic-ignore-n64"
-run_dump_test_n64 "bal-jalx-pic-ignore-micromips-n64"
-
-run_dump_test "unaligned-jalx-0" [list [list ld $abi_ldflags(o32)]]
-run_dump_test "unaligned-jalx-1" [list [list ld $abi_ldflags(o32)]]
-run_dump_test "unaligned-jalx-2" [list [list ld $abi_ldflags(o32)]]
-run_dump_test "unaligned-jalx-3" [list [list ld $abi_ldflags(o32)]]
-run_dump_test "unaligned-jalx-mips16-0" [list [list ld $abi_ldflags(o32)]]
-run_dump_test "unaligned-jalx-mips16-1" [list [list ld $abi_ldflags(o32)]]
-run_dump_test "unaligned-jalx-micromips-0" [list [list ld $abi_ldflags(o32)]]
-run_dump_test "unaligned-jalx-micromips-1" [list [list ld $abi_ldflags(o32)]]
-
-run_dump_test_n32 "unaligned-jalx-addend-0"
-run_dump_test_n32 "unaligned-jalx-addend-1"
-run_dump_test_n32 "unaligned-jalx-addend-2"
-run_dump_test_n32 "unaligned-jalx-addend-3"
-run_dump_test_n32 "unaligned-jalx-addend-mips16-0"
-run_dump_test_n32 "unaligned-jalx-addend-mips16-1"
-run_dump_test_n32 "unaligned-jalx-addend-micromips-0"
-run_dump_test_n32 "unaligned-jalx-addend-micromips-1"
+if { !$is_r6 } {
+    run_dump_test_o32 "jalx-addend"
+    run_dump_test_o32 "jalx-local"
+    run_dump_test_o32 "bal-jalx-addend"
+    run_dump_test_o32 "bal-jalx-addend-micromips"
+    run_dump_test_o32 "bal-jalx-local"
+    run_dump_test_o32 "bal-jalx-local-micromips"
+    run_dump_test_o32 "bal-jalx-pic"
+    run_dump_test_o32 "bal-jalx-pic-micromips"
+    run_dump_test_o32 "bal-jalx-pic-ignore"
+    run_dump_test_o32 "bal-jalx-pic-ignore-micromips"
+    run_dump_test_n32 "jalx-addend-n32"
+    run_dump_test_n32 "jalx-local-n32"
+    run_dump_test_n32 "bal-jalx-addend-n32"
+    run_dump_test_n32 "bal-jalx-addend-micromips-n32"
+    run_dump_test_n32 "bal-jalx-local-n32"
+    run_dump_test_n32 "bal-jalx-local-micromips-n32"
+    run_dump_test_n32 "bal-jalx-pic-n32"
+    run_dump_test_n32 "bal-jalx-pic-micromips-n32"
+    run_dump_test_n32 "bal-jalx-pic-ignore-n32"
+    run_dump_test_n32 "bal-jalx-pic-ignore-micromips-n32"
+    run_dump_test_n64 "jalx-addend-n64"
+    run_dump_test_n64 "jalx-local-n64"
+    run_dump_test_n64 "bal-jalx-addend-n64"
+    run_dump_test_n64 "bal-jalx-addend-micromips-n64"
+    run_dump_test_n64 "bal-jalx-local-n64"
+    run_dump_test_n64 "bal-jalx-local-micromips-n64"
+    run_dump_test_n64 "bal-jalx-pic-n64"
+    run_dump_test_n64 "bal-jalx-pic-micromips-n64"
+    run_dump_test_n64 "bal-jalx-pic-ignore-n64"
+    run_dump_test_n64 "bal-jalx-pic-ignore-micromips-n64"
+
+    run_dump_test "unaligned-jalx-0" [list [list ld $abi_ldflags(o32)]]
+    run_dump_test "unaligned-jalx-1" [list [list ld $abi_ldflags(o32)]]
+    run_dump_test "unaligned-jalx-2" [list [list ld $abi_ldflags(o32)]]
+    run_dump_test "unaligned-jalx-3" [list [list ld $abi_ldflags(o32)]]
+    run_dump_test "unaligned-jalx-mips16-0" [list [list ld $abi_ldflags(o32)]]
+    run_dump_test "unaligned-jalx-mips16-1" [list [list ld $abi_ldflags(o32)]]
+    run_dump_test "unaligned-jalx-micromips-0" [list [list ld $abi_ldflags(o32)]]
+    run_dump_test "unaligned-jalx-micromips-1" [list [list ld $abi_ldflags(o32)]]
+
+    run_dump_test_n32 "unaligned-jalx-addend-0"
+    run_dump_test_n32 "unaligned-jalx-addend-1"
+    run_dump_test_n32 "unaligned-jalx-addend-2"
+    run_dump_test_n32 "unaligned-jalx-addend-3"
+    run_dump_test_n32 "unaligned-jalx-addend-mips16-0"
+    run_dump_test_n32 "unaligned-jalx-addend-mips16-1"
+    run_dump_test_n32 "unaligned-jalx-addend-micromips-0"
+    run_dump_test_n32 "unaligned-jalx-addend-micromips-1"
+}
 
 run_dump_test_o32 "unaligned-branch" noarch
 
-run_dump_test_n32 "unaligned-branch-2"
-run_dump_test_n32 "unaligned-branch-ignore-2"
-run_dump_test_n32 "unaligned-branch-r6-1"
-run_dump_test_n32 "unaligned-branch-ignore-r6-1"
+if { !$is_r6 } {
+    run_dump_test_n32 "unaligned-branch-2"
+    run_dump_test_n32 "unaligned-branch-ignore-2"
+    run_dump_test_n32 "unaligned-branch-r6-1"
+    run_dump_test_n32 "unaligned-branch-ignore-r6-1"
+}
 run_dump_test_n32 "unaligned-branch-r6-2" noarch
-run_dump_test_n32 "unaligned-branch-mips16"
-run_dump_test_n32 "unaligned-branch-ignore-mips16"
-run_dump_test_n32 "unaligned-branch-micromips"
-run_dump_test_n32 "unaligned-branch-ignore-micromips"
-run_dump_test_n32 "unaligned-jump"
-run_dump_test_n32 "unaligned-jump-mips16"
-run_dump_test_n32 "unaligned-jump-micromips"
+if { !$is_r6 } {
+    run_dump_test_n32 "unaligned-branch-mips16"
+    run_dump_test_n32 "unaligned-branch-ignore-mips16"
+    run_dump_test_n32 "unaligned-branch-micromips"
+    run_dump_test_n32 "unaligned-branch-ignore-micromips"
+    run_dump_test_n32 "unaligned-jump"
+    run_dump_test_n32 "unaligned-jump-mips16"
+    run_dump_test_n32 "unaligned-jump-micromips"
+}
 
 run_dump_test_o32 "unaligned-lwpc-0" noarch
 run_dump_test_o32 "unaligned-lwpc-1" noarch
@@ -478,8 +497,10 @@ if { $embedded_elf } {
     run_dump_test_n32 "elf-rel-got-n32-embed" {{as -EB} {ld -EB}}
     run_dump_test_n32 "elf-rel-xgot-n32-embed" {{as -EB} {ld -EB}}
 } else {
-    run_dump_test_n32 "elf-rel-got-n32" {{as -EB} {ld -EB}}
-    run_dump_test_n32 "elf-rel-xgot-n32" {{as -EB} {ld -EB}}
+    if { !$is_r6 } {
+        run_dump_test_n32 "elf-rel-got-n32" {{as -EB} {ld -EB}}
+        run_dump_test_n32 "elf-rel-xgot-n32" {{as -EB} {ld -EB}}
+    }
 }
 if { $irix } {
     run_dump_test_n64 "elf-rel-got-n64-irix"
@@ -488,8 +509,10 @@ if { $irix } {
     run_dump_test_n64 "elf-rel-got-n64-embed" {{as -EB} {ld -EB}}
     run_dump_test_n64 "elf-rel-xgot-n64-embed" {{as -EB} {ld -EB}}
 } else {
-    run_dump_test_n64 "elf-rel-got-n64" {{as -EB} {ld -EB}}
-    run_dump_test_n64 "elf-rel-xgot-n64" {{as -EB} {ld -EB}}
+    if { !$is_r6 } {
+        run_dump_test_n64 "elf-rel-got-n64" {{as -EB} {ld -EB}}
+        run_dump_test_n64 "elf-rel-xgot-n64" {{as -EB} {ld -EB}}
+    }
 }
 
 run_dump_test_n32 "relax-jalr-n32" {{as -EB} {ld -EB}}
@@ -714,7 +737,9 @@ run_dump_test_o32 "reloc-2" [list [list objdump [expr { [istarget *el-*-*] \
 							? "--endian=little" \
 							: "--endian=big" }]]]
 run_dump_test "reloc-merge-lo16"
-run_dump_test "reloc-3"
+if { !$is_r6 } {
+    run_dump_test "reloc-3"
+}
 run_dump_test_n32 "reloc-3-n32" noarch
 run_dump_test "reloc-4"
 run_dump_test "reloc-5"
@@ -804,10 +829,12 @@ run_dump_test_n64 "undefweak-overflow" [list [list name (n64)]]
 
 run_dump_test_n32 "jalbal" noarch
 
-run_dump_test "mode-change-error-1"
+if { !$is_r6 } {
+    run_dump_test "mode-change-error-1"
 
 run_dump_test_o32 "mips16-hilo"
 run_dump_test_n32 "mips16-hilo-n32"
+}
 
 if { $linux_gnu } {
     run_dump_test_n32 "textrel-1"
@@ -869,7 +896,7 @@ run_dump_test_n32 "emit-relocs-1" {{as -EB} {ld -EB}}
 run_dump_test "hash1"
 run_dump_test "hash2"
 
-if { $linux_gnu && $has_abi(o32) } {
+if { $linux_gnu && $has_abi(o32) && !$is_r6 } {
     # The number of symbols that are always included in the symbol table
     # for these tests.
     #     the null symbol entry
@@ -1120,10 +1147,12 @@ run_dump_test_o32 "abiflags-strip8-ph"
 run_dump_test_o32 "abiflags-strip9-ph"
 run_dump_test_o32 "abiflags-strip10-ph"
 
-run_dump_test "nan-legacy"
+if { !$is_r6 } {
+    run_dump_test "nan-legacy"
+    run_dump_test "nan-mixed-1"
+    run_dump_test "nan-mixed-2"
+}
 run_dump_test "nan-2008"
-run_dump_test "nan-mixed-1"
-run_dump_test "nan-mixed-2"
 
 if { $linux_gnu && $has_abi(o32) } {
     run_ld_link_tests {
@@ -1147,7 +1176,9 @@ if { $linux_gnu } {
 }
 
 # MIPS16 and microMIPS interlinking test.
-run_dump_test "mips16-and-micromips"
+if { !$is_r6 } {
+    run_dump_test "mips16-and-micromips"
+}
 
 set abis {}
 if $has_abi(o32) {
@@ -1175,7 +1206,7 @@ if [check_shared_lib_support] {
 		"$abi_ldflags($abi) -shared -Ttext $loadaddr\
 		 -T export-class-call16.ld" \
 		"" \
-		"$abi_asflags($abi) -mips3 -KPIC" \
+		"$abi_asflags($abi) $abi_as64flags -KPIC" \
 		[list export-class-call16-${abi}.s export-class-call16-def.s] \
 		[list \
 		    "objdump -d export-class-call16-${suff}.dd" \
@@ -1309,7 +1340,7 @@ if { $linux_gnu && $has_abi(o32) } {
 	o32 109 1 umips-word compressed-plt-1e.s
 }
 
-if { $linux_gnu && $has_abi(n32) } {
+if { $linux_gnu && $has_abi(n32) && !$is_r6 } {
     build_mips_plt_lib n32
     run_mips_plt_test "n32 PLTs for mixed MIPS and MIPS16" \
 	n32 109 0 mips16
@@ -1390,7 +1421,7 @@ if { $linux_gnu && $has_abi(o32) } {
 }
 
 # PR ld/21334 GOT relocation in static binary test.
-if { $has_abi(o32) } {
+if { $has_abi(o32) && !$is_r6 } {
     run_ld_link_tests [list \
 	[list \
 	    "PR ld/21334 MIPS GOT16 relocation in static binary" \
@@ -1406,7 +1437,7 @@ run_dump_test_o32 "lsi-4010-isa" noarch
 
 # PIC branch relaxation with offset tests.  We need to use our version
 # of `prune_warnings' to get rid of GAS branch relaxation noise.
-if { $has_abi(o32) } {
+if { $has_abi(o32) && !$is_r6 } {
     rename prune_warnings mips_old_prune_warnings
     proc prune_warnings { msg } {
 	set msg1 "Assembler messages:"
@@ -1593,7 +1624,7 @@ proc run_mips_undefweak_test { name abi args } {
     }
 }
 
-if $has_abi(o32) {
+if { $has_abi(o32) && !$is_r6 } {
     run_mips_undefweak_test "SVR4 executable" \
 						    o32
     run_mips_undefweak_test "SVR4 executable (hidden)" \
@@ -1633,7 +1664,7 @@ if $has_abi(o32) {
     run_mips_undefweak_test "shared library (microMIPS, large GOT, hidden)" \
 						    o32 dso umips xgot hidden
 }
-if $has_abi(n32) {
+if { $has_abi(n32) && !$is_r6 } {
     run_mips_undefweak_test "shared library (n32)" \
 						    n32 dso
     run_mips_undefweak_test "shared library (n32, hidden)" \
@@ -1643,7 +1674,7 @@ if $has_abi(n32) {
     run_mips_undefweak_test "shared library (n32, microMIPS, hidden)" \
 						    n32 dso umips hidden
 }
-if $has_abi(n64) {
+if { $has_abi(n64) && !$is_r6 } {
     run_mips_undefweak_test "shared library (n64)" \
 						    n64 dso
     run_mips_undefweak_test "shared library (n64, hidden)" \
@@ -1661,13 +1692,15 @@ run_dump_test "pic-reloc-2"
 run_dump_test "pic-reloc-3"
 run_dump_test "pic-reloc-4"
 run_dump_test_o32 "pic-reloc-5"
-run_dump_test_o32 "pic-reloc-5" [list [list name (microMIPS)] \
+if { !$is_r6 } {
+    run_dump_test_o32 "pic-reloc-5" [list [list name (microMIPS)] \
 				      [list as "-mmicromips"]]
-run_dump_test_o32 "pic-reloc-6"
-run_dump_test_n64 "pic-reloc-7"
-run_dump_test_n64 "pic-reloc-7" [list [list name (microMIPS)] \
+    run_dump_test_o32 "pic-reloc-6"
+    run_dump_test_n64 "pic-reloc-7" [list [list name (microMIPS)] \
 				      [list as "-mmicromips"]]
 
+}
+run_dump_test_n64 "pic-reloc-7"
 run_dump_test_o32 "reloc-pcrel-r6"
 
 # Global/local symbol table split tests.
diff --git a/ld/testsuite/ld-mips-elf/n64-plt-1.dd b/ld/testsuite/ld-mips-elf/n64-plt-1.dd
index 4c24a9a16ce..51d654a343b 100644
--- a/ld/testsuite/ld-mips-elf/n64-plt-1.dd
+++ b/ld/testsuite/ld-mips-elf/n64-plt-1.dd
@@ -15,7 +15,7 @@ Disassembly of section \.plt:
 00000000100002a0 <bar@plt>:
     100002a0:	3c0f7fff 	lui	t3,0x7fff
     100002a4:	ddf97ff8 	ld	t9,32760\(t3\)
-    100002a8:	03200008 	jr	t9
+    100002a8:	0320000[89] 	jr	t9
     100002ac:	25f87ff8 	addiu	t8,t3,32760
 
 Disassembly of section \.text:
diff --git a/ld/testsuite/ld-mips-elf/n64-plt-4.dd b/ld/testsuite/ld-mips-elf/n64-plt-4.dd
index 01c50256153..71fee33c4e1 100644
--- a/ld/testsuite/ld-mips-elf/n64-plt-4.dd
+++ b/ld/testsuite/ld-mips-elf/n64-plt-4.dd
@@ -15,7 +15,7 @@ ffffffff1000029c:	2718fffe 	addiu	t8,t8,-2
 ffffffff100002a0 <bar@plt>:
 ffffffff100002a0:	3c0f8000 	lui	t3,0x8000
 ffffffff100002a4:	ddf98010 	ld	t9,-32752\(t3\)
-ffffffff100002a8:	03200008 	jr	t9
+ffffffff100002a8:	0320000[89] 	jr	t9
 ffffffff100002ac:	25f88010 	addiu	t8,t3,-32752
 
 Disassembly of section \.text:
diff --git a/ld/testsuite/ld-mips-elf/pic-and-nonpic-2.d b/ld/testsuite/ld-mips-elf/pic-and-nonpic-2.d
index 3baf22851a0..e3cc14ec793 100644
--- a/ld/testsuite/ld-mips-elf/pic-and-nonpic-2.d
+++ b/ld/testsuite/ld-mips-elf/pic-and-nonpic-2.d
@@ -17,6 +17,6 @@ Disassembly of section \.text:
    4101c:	27391020 	addiu	t9,t9,4128
 
 00041020 <foo2>:
-   41020:	03e00008 	jr	ra
+   41020:	03e0000[89] 	jr	ra
    41024:	00000000 	nop
 	\.\.\.
-- 
2.30.2



More information about the Binutils mailing list