set ldflags $abi_ldflags($abi)
        set args [lreplace $args 0 0]
     }
-    if !$has_abi($abi) {
+    set abi_r [regsub "l$" $abi {}]
+    if !$has_abi($abi_r) {
        lappend args {notarget *-*-*}
     }
 
 proc run_dump_test_o32 { name args } {
     run_dump_test_abi o32 $name [lindex $args 0]
 }
+proc run_dump_test_o32l { name args } {
+    if {[istarget *-linux*] || [istarget *-img-elf]} {
+      run_dump_test_abi o32l $name [lindex $args 0]
+    } else {
+      run_dump_test_abi o32 $name [lindex $args 0]
+    }
+}
 
 # run_dump_test_n32 NAME ARGS
 #
 proc run_dump_test_n32 { name args } {
     run_dump_test_abi n32 $name [lindex $args 0]
 }
+proc run_dump_test_n32l { name args } {
+    if {[istarget *-linux*] || [istarget *-img-elf]} {
+      run_dump_test_abi n32l $name [lindex $args 0]
+    } else {
+      run_dump_test_abi n32 $name [lindex $args 0]
+    }
+}
 
 # run_dump_test_n64 NAME ARGS
 #
 proc run_dump_test_n64 { name args } {
     run_dump_test_abi n64 $name [lindex $args 0]
 }
+proc run_dump_test_n64l { name args } {
+    if {[istarget *-linux*] || [istarget *-img-elf]} {
+      run_dump_test_abi n64l $name [lindex $args 0]
+    } else {
+      run_dump_test_abi n64 $name [lindex $args 0]
+    }
+}
 
 set has_abi(o32) [expr ![istarget *-*-openbsd*] \
                     && ![istarget mips64*el-ps2-elf*]]
                     || [istarget *-*-openbsd*]]
 
 # Set defaults.
+# ABI with l tail means legacy, aka pre-R6.
+# Please use them, if the test only suite for pre-R6,
+# such as mips16/micromips tests.
 set abi_asflags(o32) ""
+set abi_asflags(o32l) ""
 set abi_asflags(n32) ""
+set abi_asflags(n32l) ""
 set abi_asflags(n64) ""
+set abi_asflags(n64l) ""
 set abi_asflags(eabi) ""
 set abi_ldflags(o32) ""
+set abi_ldflags(o32l) ""
 set abi_ldflags(n32) ""
+set abi_ldflags(n32l) ""
 set abi_ldflags(n64) ""
+set abi_ldflags(n64l) ""
 set abi_ldflags(eabi) ""
 
 # Override as needed.
 if {[istarget *-*-openbsd*] } {
     set irixemul 0
-} elseif { [istarget mips64*-*-linux*] } {
+} elseif { [istarget mips*64*-*-linux*] } {
+    set abi_asflags(o32) -32
+    set abi_asflags(o32l) "-32 -march=from-abi"
+    set abi_asflags(n32) ""
+    set abi_asflags(n32l) "-n32 -march=from-abi"
+    set abi_asflags(n64) "-64"
+    set abi_asflags(n64l) "-march=from-abi -64"
     if [istarget *el-*-*] {
-       set abi_asflags(o32) -32
        set abi_ldflags(o32) -melf32ltsmip
-       set abi_asflags(n64) "-march=from-abi -64"
+       set abi_ldflags(o32l) -melf32ltsmip
        set abi_ldflags(n64) -melf64ltsmip
+       set abi_ldflags(n64l) -melf64ltsmip
     } else {
-       set abi_asflags(o32) -32
        set abi_ldflags(o32) -melf32btsmip
-       set abi_asflags(n64) "-march=from-abi -64"
+       set abi_ldflags(o32l) -melf32btsmip
        set abi_ldflags(n64) -melf64btsmip
+       set abi_ldflags(n64l) -melf64btsmip
     }
     set irixemul 0
-} elseif {[istarget *-*-linux*] } {
+} elseif {[istarget *-*-linux*] || [istarget *-img-elf] } {
+    set abi_asflags(o32) ""
+    set abi_asflags(o32l) "-march=from-abi"
+    set abi_asflags(n32) "-n32"
+    set abi_asflags(n32l) "-n32 -march=from-abi"
+    set abi_asflags(n64) "-64"
+    set abi_asflags(n64l) "-64 -march=from-abi"
     if [istarget *el-*-*] {
-       set abi_asflags(n32) "-march=from-abi -n32"
        set abi_ldflags(n32) -melf32ltsmipn32
-       set abi_asflags(n64) "-march=from-abi -64"
+       set abi_ldflags(n32l) -melf32ltsmipn32
        set abi_ldflags(n64) -melf64ltsmip
+       set abi_ldflags(n64l) -melf64ltsmip
     } else {
-       set abi_asflags(n32) "-march=from-abi -n32"
        set abi_ldflags(n32) -melf32btsmipn32
-       set abi_asflags(n64) "-march=from-abi -64"
+       set abi_ldflags(n32l) -melf32btsmipn32
        set abi_ldflags(n64) -melf64btsmip
+       set abi_ldflags(n64l) -melf64btsmip
     }
     set irixemul 0
-} elseif {[istarget *-img-elf*] \
-     || [istarget *-mti-elf*] \
+} elseif {[istarget *-mti-elf*] \
      || [istarget *-sde-elf*] \
      || [istarget *-*-netbsd*] \
-     || [istarget *-*-linux*] \
      || [istarget *-*-sysv4*] } {
     if [istarget *el-*-*] {
        set abi_asflags(o32) -32
 run_dump_test "mips-xpa-virt-4"
 run_dump_test_o32 "mixed-mips16" noarch
 run_dump_test_o32 "mixed-micromips" noarch
-run_dump_test "mixed-mips16-micromips"
+run_dump_test_o32l "mixed-mips16-micromips"
+run_dump_test_n32l "mixed-mips16-micromips"
+run_dump_test_n64l "mixed-mips16-micromips"
 run_dump_test_o32 "mips16-undecoded" noarch
 run_dump_test_o32 "mips16e2-undecoded" noarch
 run_dump_test_o32 "mips16-pcrel"
-run_dump_test_o32 "mips16-extend-noinsn"
+run_dump_test_o32l "mips16-extend-noinsn"
 run_dump_test_o32 "mips16-extend-insn" noarch
 run_dump_test_o32 "mips16e2-extend-insn" noarch
 run_dump_test_o32 "mips16-alias" noarch
 
 # source: align2.s
-# as: -EL
+# as: -EL -march=from-abi
 # objdump: -dr
 
 .* file format .*
 
-# as: -EB
+# as: -EB -march=from-abi
 # objdump: -dr
 
 .* file format .*
 
-#as: -32
+#as: -32 -mips1
 #source: attr-gnu-abi-fp-1.s
 #readelf: -A
 #name: MIPS gnu_attribute Tag_GNU_MIPS_ABI_FP,1
 
--- /dev/null
+#as: -32 -mips2 -mfpxx
+#source: attr-gnu-abi-fp-5.s
+#readelf: -A
+#name: MIPS gnu_attribute Tag_GNU_MIPS_ABI_FP,5
+
+Attribute Section: gnu
+File Attributes
+  Tag_GNU_MIPS_ABI_FP: Hard float \(32-bit CPU, Any FPU\)
+
+MIPS ABI Flags Version: 0
+
+ISA: MIPS.*
+GPR size: 32
+CPR1 size: 32
+CPR2 size: 0
+FP ABI: Hard float \(32-bit CPU, Any FPU\)
+ISA Extension: .*
+ASEs:
+       None
+FLAGS 1: 0000000.
+FLAGS 2: 00000000
 
--- /dev/null
+.gnu_attribute Tag_GNU_MIPS_ABI_FP,5
 
--- /dev/null
+#as: -32 -mips32r2 -mfp64
+#source: attr-gnu-abi-fp-6.s
+#readelf: -A
+#name: MIPS gnu_attribute Tag_GNU_MIPS_ABI_FP,6
+
+Attribute Section: gnu
+File Attributes
+  Tag_GNU_MIPS_ABI_FP: Hard float \(32-bit CPU, 64-bit FPU\)
+
+MIPS ABI Flags Version: 0
+
+ISA: MIPS.*
+GPR size: 32
+CPR1 size: 64
+CPR2 size: 0
+FP ABI: Hard float \(32-bit CPU, 64-bit FPU\)
+ISA Extension: .*
+ASEs:
+       None
+FLAGS 1: 0000000.
+FLAGS 2: 00000000
 
--- /dev/null
+.gnu_attribute Tag_GNU_MIPS_ABI_FP,6
 
 
 Attribute Section: gnu
 File Attributes
-  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+  Tag_GNU_MIPS_ABI_FP: Hard float \(.*\)
   Tag_GNU_MIPS_ABI_MSA: 128-bit MSA
 
 #...
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS branch to absolute expression with addend
-#as: -32
+#as: -32 -mips2
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS branch to absolute expression
-#as: -32
+#as: -32 -mips2
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS BAL addend encoding
-#as: -32
+#as: -32 -mips32r2
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS BAL addend encoding
-#as: -32
+#as: -32 -mips32r2
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS branch to an external symbol
-#as: -32 -KPIC -mmicromips
+#as: -32 -KPIC -mips32r2 -mmicromips
 #source: branch-extern.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS relaxed branch to an external symbol
-#as: -32 -KPIC -mmicromips --relax-branch
+#as: -32 -KPIC -mips32r2 -mmicromips --relax-branch
 #source: branch-extern.s
 #warning_output: branch-extern.l
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS branch local symbol relocation 1
-#as: -32
+#as: -32 -mips32r2
 #source: branch-local-1.s
 
 .*: +file format .*mips.*
 
 #name: MIPS branch local symbol relocation 2
-#as: -32
+#as: -32 -mips32r2
 #error_output: branch-local-2.l
 
 #name: MIPS branch local symbol relocation 3
-#as: -32
+#as: -32 -mips32r2
 #error_output: branch-local-3.l
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS branch local symbol relocation 4
-#as: -32
+#as: -32 -mips32r2
 #source: branch-local-4.s
 
 .*: +file format .*mips.*
 
 #name: MIPS branch local symbol relocation 5
-#as: -32
+#as: -32 -mips1
 #error_output: branch-local-5.l
 
 #name: MIPS branch local symbol relocation 6
-#as: -32
+#as: -32 -mips32r2
 #error_output: branch-local-6.l
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS branch local symbol relocation 7
-#as: -32
+#as: -32 -mips32r2
 #source: branch-local-7.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS branch local symbol relocation 2 (ignore branch ISA)
-#as: -32 -mignore-branch-isa
+#as: -32 -mips32r2 -mignore-branch-isa
 #source: branch-local-2.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa32r6
 #name: MIPS branch local symbol relocation 3 (ignore branch ISA)
-#as: -32 -mignore-branch-isa
+#as: -32 -mips32r2 -mignore-branch-isa
 #source: branch-local-3.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS branch local symbol relocation 5 (ignore branch ISA)
-#as: -32 -mignore-branch-isa
+#as: -32 -mips1 -mignore-branch-isa
 #source: branch-local-5.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS branch local symbol relocation 6 (ignore branch ISA)
-#as: -32 -mignore-branch-isa
+#as: -32 -mips32r2 -mignore-branch-isa
 #source: branch-local-6.s
 
 .*: +file format .*mips.*
 
        \.\.\.
 
 Disassembly of section \.init:
-[0-9a-f]+ <[^>]*> 03e00008     jr      ra
+[0-9a-f]+ <[^>]*> 03e0000[89]  jr      ra
 [0-9a-f]+ <[^>]*> 00000000     nop
        \.\.\.
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS branch to a different section
-#as: -32 -mmicromips
+#as: -32 -mips32r2 -mmicromips
 #source: branch-section.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS relaxed branch to a different section
-#as: -32 --relax-branch
+#as: -32 -mips32r2 --relax-branch
 #source: branch-section.s
 #warning_output: branch-section.l
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS relaxed branch to a different section
-#as: -32 -mmicromips --relax-branch
+#as: -32 -mips32r2 -mmicromips --relax-branch
 #source: branch-section.s
 #warning_output: branch-section.l
 
 
 [      ]*[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
        \.\.\.
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS branch to a weak symbol
-#as: -32 -mmicromips --defsym align=12
+#as: -32 -mips32r2 -mmicromips --defsym align=12
 #source: branch-weak.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS relaxed branch to a weak symbol
-#as: -32 --relax-branch --defsym align=12
+#as: -32 -mips1 --relax-branch --defsym align=12
 #source: branch-weak.s
 #warning_output: branch-weak.l
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS relaxed branch to a weak symbol
-#as: -32 -mmicromips --relax-branch --defsym align=12
+#as: -32 -mips32r2 -mmicromips --relax-branch --defsym align=12
 #source: branch-weak.s
 #warning_output: branch-weak.l
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS short branch to a weak symbol
-#as: -32 -mmicromips --defsym align=4
+#as: -32 -mips32r2 -mmicromips --defsym align=4
 #source: branch-weak.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch to a weak symbol
-#as: -32 -mips16 --defsym align=12
+#as: -32 -mips1 -mips16 --defsym align=12
 #source: branch-weak.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 short branch to a weak symbol
-#as: -32 -mips16 --defsym align=4
+#as: -32 -mips1 -mips16 --defsym align=4
 #source: branch-weak.s
 
 .*: +file format .*mips.*
 
--- /dev/null
+#readelf: -gr
+#name: MIPS ELF o32 PIC comdat GOT16/LO16 relocation pairing
+#as: -32 -mno-pdr -mips32r6
+#source: comdat-reloc.s
+
+# Make sure the orphan GOT16 relocation is paired with LO16 for a local
+# symbol in a comdat section, i.e. rather than this:
+#
+# 00000014  00000509 R_MIPS_GOT16      00000000   foo
+# 00000020  00000506 R_MIPS_LO16       00000000   foo
+# 0000001c  00000509 R_MIPS_GOT16      00000000   foo
+#
+# we have this:
+#
+# 00000014  00000509 R_MIPS_GOT16      00000000   foo
+# 00000024  00000509 R_MIPS_GOT16      00000000   foo
+# 0000001c  00000506 R_MIPS_LO16       00000000   foo
+
+#...
+COMDAT group section \[.....\] `\.group' \[bar\] contains .+ sections:
+   \[Index\]    Name
+   \[.....\]   \.text\.foo
+   \[.....\]   \.text\.bar
+#...
+Relocation section '\.rel\.text\.bar' at offset .+ contains .+ entries:
+ Offset     Info    Type            Sym\.Value  Sym\. Name
+00000000  ......05 R_MIPS_HI16       00000000   _gp_disp
+00000004  ......06 R_MIPS_LO16       00000000   _gp_disp
+0000000c  0000070a R_MIPS_PC16       00000020   \.L1\^B1
+00000014  ......09 R_MIPS_GOT16      00000000   foo
+00000024  ......09 R_MIPS_GOT16      00000000   foo
+0000001c  ......06 R_MIPS_LO16       00000000   foo
+00000020  0000080a R_MIPS_PC16       00000018   \.L0\^B1
+#pass
 
 #readelf: -gr
 #name: MIPS ELF o32 PIC comdat GOT16/LO16 relocation pairing
-#as: -32 -mno-pdr
+#as: -32 -mno-pdr -mips1
 
 # Make sure the orphan GOT16 relocation is paired with LO16 for a local
 # symbol in a comdat section, i.e. rather than this:
 
 #objdump: -sr
 #name: Compact EH EB #1 with personality ID and FDE data
 #source: compact-eh-1.s
-#as: -EB -mno-pdr
+#as: -march=from-abi -EB -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EB #2 with personality routine and FDE data
 #source: compact-eh-2.s
-#as: -EB -mno-pdr
+#as: -march=from-abi -EB -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EB #3 with personality id and large FDE data
 #source: compact-eh-3.s
-#as: -EB -mno-pdr
+#as: -march=from-abi -EB -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EB #4 with personality id, FDE data and LSDA
 #source: compact-eh-4.s
-#as: -EB -mno-pdr
+#as: -march=from-abi -EB -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EB #5 with personality routine, FDE data and LSDA
 #source: compact-eh-5.s
-#as: -EB -mno-pdr
+#as: -march=from-abi -EB -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EB #6 with personality id, LSDA and large FDE data
 #source: compact-eh-6.s
-#as: -EB -mno-pdr
+#as: -march=from-abi -EB -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EB #7 with personality id and fallback FDE
 #source: compact-eh-7.s
-#as: -EB -mno-pdr
+#as: -march=from-abi -EB -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EL #1 with personality ID and FDE data
 #source: compact-eh-1.s
-#as: -EL -mno-pdr
+#as: -march=from-abi -EL -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EL #2 with personality routine and FDE data
 #source: compact-eh-2.s
-#as: -EL -mno-pdr
+#as: -march=from-abi -EL -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EL #3 with personality id and large FDE data
 #source: compact-eh-3.s
-#as: -EL -mno-pdr
+#as: -march=from-abi -EL -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EL #4 with personality id, FDE data and LSDA
 #source: compact-eh-4.s
-#as: -EL -mno-pdr
+#as: -march=from-abi -EL -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EL #5 with personality routine, FDE data and LSDA
 #source: compact-eh-5.s
-#as: -EL -mno-pdr
+#as: -march=from-abi -EL -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EL #6 with personality id, LSDA and large FDE data
 #source: compact-eh-6.s
-#as: -EL -mno-pdr
+#as: -march=from-abi -EL -mno-pdr
 
 .*:     file format.*
 
 
 #objdump: -sr
 #name: Compact EH EL #7 with personality id and fallback FDE
 #source: compact-eh-7.s
-#as: -EL -mno-pdr
+#as: -march=from-abi -EL -mno-pdr
 
 .*:     file format.*
 
 
 
 Contents of section \.text:
  0000 3c010000 3c010000 3c010001 3c010001  .*
- 0010 3c010000 3c010001 20210018 2021001c  .*
- 0020 20210018 2021001c 20218018 2021fffc  .*
+ 0010 3c010000 3c010001 24210018 2421001c  .*
+ 0020 24210018 2421001c 24218018 2421fffc  .*
  0030 3c010001 3c010001 3c010002 3c010002  .*
- 0040 3c010001 3c010001 2021bffe 2021c002  .*
- 0050 2021bffe 2021c002 20213ffe 2021bffa  .*
+ 0040 3c010001 3c010001 2421bffe 2421c002  .*
+ 0050 2421bffe 2421c002 24213ffe 2421bffa  .*
  0060 3c010001 3c010001 3c010002 3c010002  .*
- 0070 3c010001 3c010001 2021bffe 2021c002  .*
- 0080 2021bffe 2021c002 20213ffe 2021bffa  .*
+ 0070 3c010001 3c010001 2421bffe 2421c002  .*
+ 0080 2421bffe 2421c002 24213ffe 2421bffa  .*
 #pass
 
        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)
        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)))
        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)))))))
 
 #objdump: -dr --prefix-addresses
 #name: MIPS ELF reloc 6
-#as: -32
+#as: -32 -mips1
 
 .*: +file format elf.*mips.*
 
 
 # name: ELF microMIPS ASE markings 2
 # source: nop.s
 # objdump: -p
-# as: -32 -mmicromips
+# as: -32 -mips32r2 -mmicromips
 
 .*:.*file format.*mips.*
 private flags = [0-9a-f]*[2367abef]......: .*[[,]micromips[],].*
 
 # name: ELF microMIPS ASE markings
 # source: empty.s
 # objdump: -p
-# as: -32 -mmicromips
+# as: -32 -mips32r2 -mmicromips
 
 .*:.*file format.*mips.*
 !private flags = .*micromips.*
 
 # name: ELF MIPS16 ASE markings 2
 # source: nop.s
 # objdump: -p
-# as: -32 -mips16
+# as: -32 -mips1 -mips16
 
 .*:.*file format.*mips.*
 private flags = [0-9a-f]*[4-7c-f]......: .*[[,]mips16[],].*
 
 # name: ELF MIPS16 ASE markings
 # source: empty.s
 # objdump: -p
-# as: -32 -mips16
+# as: -32 -mips1 -mips16
 
 .*:.*file format.*mips.*
 !private flags = .*mips16.*
 
 
 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
 
 #objdump: -dr --show-raw-insn
 #name: microMIPS ISA mode for .insn label references
-#as: -32
+#as: -32 -mips32r2
 
 .*: +file format .*mips.*
 
 
 #objdump: -dtz -j .text --prefix-addresses --show-raw-insn
 #name: MIPS .insn default file options
+#as: -march=from-abi
 
 # Check that .insn at the beginning of assembly sees default file options
 # such as the ISA mode right.
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS JAL/JALX addend encoding
-#as: -32
+#as: -32 -mips32r2
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS JAL/JALX immediate operand encoding
-#as: -32
+#as: -32 -mips32r2
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS JALX local symbol relocation
-#as: -32
+#as: -32 -mips32r2
 
 .*: +file format .*mips.*
 
 
-#as: -mfix-loongson2f-jump
+#as: -march=loongson2f -mfix-loongson2f-jump
 #objdump: -M reg-names=numeric -dr
 #name: ST Microelectronics Loongson-2F workarounds of Jump Instruction issue
 
 
 #objdump: -dr --show-raw-insn
 #name: microMIPS b16, bnez16, beqz16
-#as: -32 -mmicromips
+#as: -32 -mmicromips -mips32r2
 #source: micromips-b16.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS branch to absolute expression with addend
-#as: -32
+#as: -32 -mips32r2
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS branch to absolute expression
-#as: -32
+#as: -32 -mips32r2
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: microMIPS fixed-size branch delay slots 1
-#as: -32 -mmicromips
+#as: -32 -mmicromips -mips32r2
 #source: micromips-warn-branch-delay-1.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --show-raw-insn -M gpr-names=numeric
 #name: microMIPS fixed-size branch delay slots
-#as: -mmicromips
+#as: -mmicromips -march=from-abi
 #source: micromips-warn-branch-delay.s
 #warning_output: micromips-warn-branch-delay.l
 
 
 #objdump: -d
-#as:
+#as: -march=from-abi
 #name: mips jalx-2
 
 .*:     file format .*
 
            continue
        }
        if { [mips_arch_matches $arch $args] } {
-           lappend l $arch
+           # If the triple is mipsisa32*/mipsisa64*, we skip the 'default'
+           # Since it will always run.
+           if { [string compare $arch default] == 0 && [istarget mipsisa32*-*] } {
+             continue
+           } elseif { [string compare $arch default] == 0 && [istarget mipsisa64*-*] } {
+             continue
+           } else {
+             lappend l $arch
+           }
        }
     }
     return $l
        "MIPS invalid switch to SVR4 PIC from VxWorks PIC"
 } elseif { [istarget mips*-*-*] } {
     set addr32 [expr [istarget mipstx39*-*-*] || [istarget mips-*-linux*] || [istarget mipsel-*-linux*] \
-                    || [istarget mipsisa32*-*-linux*] || [istarget mipsisa32*el-*-linux*]]
+                    || [istarget mipsisa32*-*-linux*] || [istarget mipsisa32*el-*-linux*] \
+                    || [istarget mips-*-elf] || [istarget mipsel-*-elf]]
     set has_newabi [expr [istarget *-*-irix6*] || [istarget mips*-*-linux*] \
                          || [istarget mips*-sde-elf*] || [istarget mips*-mti-elf*] \
                          || [istarget mips*-img-elf*]]
     # 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" \
+       run_list_test "branch-swap-2" "-march=from-abi --defsym count=$count" \
            "MIPS branch swapping ($count)"
     }
 
     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_list_test "compact-eh-err1" "-march=from-abi"
+    run_list_test "compact-eh-err2" "-march=from-abi"
 
     run_dump_test "div"
 
        run_dump_test "jalx-local-n64"
     }
 
-    run_list_test "unaligned-jump-1" "-32" \
+    run_list_test "unaligned-jump-1" "-32 -mips32r2" \
                                "MIPS jump to unaligned symbol 1"
-    run_list_test "unaligned-jump-2" "-32" \
+    run_list_test "unaligned-jump-2" "-32 -mips32r2" \
                                "MIPS jump to unaligned symbol 2"
     if $has_newabi {
        run_dump_test "unaligned-jump-3"
     }
-    run_list_test "unaligned-jump-mips16-1" "-32" \
+    run_list_test "unaligned-jump-mips16-1" "-32 -mips1" \
                                "MIPS16 jump to unaligned symbol 1"
-    run_list_test "unaligned-jump-mips16-2" "-32" \
+    run_list_test "unaligned-jump-mips16-2" "-32 -mips1" \
                                "MIPS16 jump to unaligned symbol 2"
     if $has_newabi {
        run_dump_test "unaligned-jump-mips16-3"
     }
-    run_list_test "unaligned-jump-micromips-1" "-32" \
+    run_list_test "unaligned-jump-micromips-1" "-32 -mips32r2" \
                                "microMIPS jump to unaligned symbol 1"
-    run_list_test "unaligned-jump-micromips-2" "-32" \
+    run_list_test "unaligned-jump-micromips-2" "-32 -mips32r2" \
                                "microMIPS jump to unaligned symbol 2"
     if $has_newabi {
        run_dump_test "unaligned-jump-micromips-3"
     }
-    run_list_test "unaligned-branch-1" "-32" \
+    run_list_test "unaligned-branch-1" "-32 -mips32r2" \
                                "MIPS branch to unaligned symbol 1"
-    run_list_test "unaligned-branch-2" "-32" \
+    run_list_test "unaligned-branch-2" "-32 -mips32r2" \
                                "MIPS branch to unaligned symbol 2"
     if $has_newabi {
        run_dump_test "unaligned-branch-3"
        run_dump_test "unaligned-branch-r6-5"
        run_dump_test "unaligned-branch-r6-6"
     }
-    run_list_test "unaligned-branch-mips16-1" "-32" \
+    run_list_test "unaligned-branch-mips16-1" "-32 -mips1" \
                                "MIPS16 branch to unaligned symbol 1"
-    run_list_test "unaligned-branch-mips16-2" "-32" \
+    run_list_test "unaligned-branch-mips16-2" "-32 -mips1" \
                                "MIPS16 branch to unaligned symbol 2"
     if $has_newabi {
        run_dump_test "unaligned-branch-mips16-3"
     }
-    run_list_test "unaligned-branch-micromips-1" "-32" \
+    run_list_test "unaligned-branch-micromips-1" "-32 -mips32r2" \
                                "microMIPS branch to unaligned symbol 1"
-    run_list_test "unaligned-branch-micromips-2" "-32" \
+    run_list_test "unaligned-branch-micromips-2" "-32 -mips32r2" \
                                "microMIPS branch to unaligned symbol 2"
     if $has_newabi {
        run_dump_test "unaligned-branch-micromips-3"
 
     run_dump_test_arches "eva"         [mips_arch_list_matching mips32r2 !octeon]
 
-    run_list_test "illegal" "-32"
+    run_list_test "illegal" "-32 -mips1"
     run_list_test "baddata1" "-32"
     run_list_test "jalr" ""
 
     run_list_test_arches "elf-rel30" "-32" [mips_arch_list_all]
 
     run_dump_test "comdat-reloc"
+    run_dump_test "comdat-reloc-r6"
 
     run_dump_test "${tmips}mips${el}16-e"
     run_dump_test "${tmips}mips${el}16-f"
        run_dump_test "micromips-branch-absolute-addend-n64"
     }
     run_dump_test "micromips-b16"
-    run_list_test "micromips-ill"
+    run_list_test "micromips-ill" "-march=from-abi"
 
     run_dump_test_arches "mcu"         [mips_arch_list_matching mips32r2 \
                                            !octeon]
     run_dump_test_arches "ulh-reloc"   [mips_arch_list_matching mips2 !mips32r6]
 
     run_dump_test "l_d-reloc"
-    run_list_test "bltzal"
+    run_list_test "bltzal" "-march=from-abi"
 
     run_dump_test_arches "msa"         [mips_arch_list_matching mips32r2]
     if { $has_newabi } {
     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" \
+    run_list_test "pcrel-reloc-6" "-32 --defsym offset=4 -mips1" \
        "MIPS local PC-relative relocations 6b"
 
     run_dump_test_arches "mips16-pcrel-0" [mips_arch_list_matching mips16-32]
                                    [mips_arch_list_matching mips32r2]
 
     run_dump_test "attr-gnu-abi-fp-1"
+    run_dump_test "attr-gnu-abi-fp-5"
+    run_dump_test "attr-gnu-abi-fp-6"
     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 -mips1"
 
-    foreach testopt [list -mfp32 -mfpxx -mfp64 "-mfp64-noodd" \
-                         -msingle-float -msoft-float] {
+    foreach testopt [list -mfp32 -mfpxx -mfp64 "-mfp64-noodd" -mfp64r6 "-mfp64r6-noodd" \
+                         -msingle-float -msoft-float -msoft-float-r6] {
       foreach cmdopt [list -mfp32 -mfpxx -mfp64 "-mfp64 -mno-odd-spreg" \
                           -msingle-float -msoft-float] {
         run_dump_test "module${testopt}" \
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 absolute relocation 0
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #name: MIPS16 absolute relocation 2
-#as: -32
+#as: -32 -mips1
 #error_output: mips16-absolute-reloc-2.l
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch to absolute expression 1
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch to absolute expression 2
-#as: -32
+#as: -32 -mips1
 #dump: mips16-branch-absolute-1.d
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch to absolute expression with addend 1
-#as: -32
+#as: -32 -mips1
 #dump: mips16-branch-absolute-1.d
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch to absolute expression with addend
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch to absolute expression
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation with addend 0
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation with addend 1
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation with addend 2
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation with addend 3
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation with addend 4
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation with addend 5
-#as: -32
+#as: -32 -mips1
 #error_output: mips16-branch-addend-5.l
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation 0
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation 1
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation 2
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation 3
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation 4
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 branch relocation 5
-#as: -32
+#as: -32 -mips1
 
 .*: +file format .*mips.*
 
 
 #name: MIPS16 unextended branch instructions with relocation 1
-#as: -32
+#as: -32 -mips32
 #error_output: mips16-branch-unextended.l
 
 #name: MIPS16 unextended branch instructions with relocation 2
-#as: -32
+#as: -32 -mips32
 #error_output: mips16-branch-unextended.l
 
 #readelf: -r -wl
 #name: MIPS16 DWARF2
-#as: -mabi=32 -mips16 -no-mdebug -g0
+#as: -mabi=32 -mips16 -no-mdebug -g0 -mips32
 #source: mips16-dwarf2.s
 
 Relocation section '\.rel\.debug_info' at offset .* contains 4 entries:
 
 #objdump: -rst --special-syms -mips16
 #name: MIPS16 reloc
-#as: -32 -mips16
+#as: -32 -mips16 -mips32
 
 # Check MIPS16 reloc processing
 
 
 #objdump: -d --prefix-addresses --show-raw-insn
 #name: MIPS16 explicit EXTEND encoding
-#as: -32
+#as: -32 -mips32
 
 .*: +file format .*mips.*
 
 
 #objdump: -rst -mips16
 #name: MIPS16 reloc 2
-#as: -32 -mips16
+#as: -32 -mips16 -mips32
 
 # Check MIPS16 reloc processing
 
 
 #objdump: -dr
 #name: MIPS16 lui/addi
-#as: -mips16 -mabi=32
+#as: -mips16 -mabi=32 -mips32
 #source: mips16-hilo.s
 
 .*: +file format .*mips.*
 
 #objdump: -d --prefix-addresses --show-raw-insn
 #name: MIPS16 argumentless instruction size override
-#as: -32
+#as: -32 -mips32
 
 .*: +file format .*mips.*
 
 
 #objdump: -d --prefix-addresses --show-raw-insn
 #name: MIPS16 explicit extended JAL instructions
-#as: -32
+#as: -32 -mips32
 
 .*: +file format .*mips.*
 
 
 #name: MIPS16 explicit unextended JAL instructions
-#as: -32
+#as: -32 -mips32
 #error_output: mips16-jal-t.l
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 PC-relative relaxation 0
-#as: -32
+#as: -32 -mips1
 
 # Check that PC-relative relaxation does not go into oscillation
 # where the address referred depends on the size of the instruction;
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 PC-relative relaxation 1
-#as: -32 --defsym align=1
+#as: -32 -mips1 --defsym align=1
 #source: mips16-pcrel-relax-0.s
 
 # Check that PC-relative relaxation chooses the short encoding
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 PC-relative relaxation 2
-#as: -32
+#as: -32 -mips1
 
 # Check that PC-relative relaxation does not go into oscillation
 # where the address referred depends on the size of the instruction;
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 PC-relative relaxation 3
-#as: -32 --defsym align=1
+#as: -32 -mips1 --defsym align=1
 #source: mips16-pcrel-relax-2.s
 
 # Check that PC-relative relaxation chooses the short encoding
 
 # readelf: --symbols
+# as: -march=from-abi
 #...
 .*: 0+0 +2 +FUNC +GLOBAL +HIDDEN +\[MIPS16\] +[0-9]+ foo
 
 #objdump: -rst --special-syms -mips16
 #name: MIPS16 reloc
-#as: -32 -mips16
+#as: -32 -mips1 -mips16
 #source: mips16-e.s
 
 # Check MIPS16 reloc processing
 
 #objdump: -rst -mips16
 #name: MIPS16 reloc 2
-#as: -32 -mips16
+#as: -32 -mips1 -mips16
 #source: mips16-f.s
 
 # Check MIPS16 reloc processing
 
-#as: -32
+#as: -32 -mips1
 #readelf: -A
 #name: MIPS module fp=32
 
 
--- /dev/null
+#as: -mips32r6 -32
+#readelf: -A
+#name: MIPS module fp=64 nooddspreg
+#source: module-mfp64-noodd.s
+
+Attribute Section: gnu
+File Attributes
+  Tag_GNU_MIPS_ABI_FP: Hard float compat \(32-bit CPU, 64-bit FPU\)
+
+MIPS ABI Flags Version: 0
+
+ISA: MIPS32r6
+GPR size: 32
+CPR1 size: 64
+CPR2 size: 0
+FP ABI: Hard float compat \(32-bit CPU, 64-bit FPU\)
+ISA Extension: None
+ASEs:
+       None
+FLAGS 1: 0000000.
+FLAGS 2: 00000000
 
--- /dev/null
+#as: -mips32r6 -32
+#readelf: -A
+#name: MIPS module fp=64
+#source: module-mfp64.s
+
+Attribute Section: gnu
+File Attributes
+  Tag_GNU_MIPS_ABI_FP: Hard float \(32-bit CPU, 64-bit FPU\)
+
+MIPS ABI Flags Version: 0
+
+ISA: MIPS32r6
+GPR size: 32
+CPR1 size: 64
+CPR2 size: 0
+FP ABI: Hard float \(32-bit CPU, 64-bit FPU\)
+ISA Extension: None
+ASEs:
+       None
+FLAGS 1: 0000000.
+FLAGS 2: 00000000
 
--- /dev/null
+#as: -32 -march=mips32r6
+#readelf: -A
+#name: MIPS module softfloat
+
+Attribute Section: gnu
+File Attributes
+  Tag_GNU_MIPS_ABI_FP: Soft float
+
+MIPS ABI Flags Version: 0
+
+ISA: MIPS.*
+GPR size: 32
+CPR1 size: 0
+CPR2 size: 0
+FP ABI: Soft float
+ISA Extension: .*
+ASEs:
+       None
+FLAGS 1: 0000000.
+FLAGS 2: 00000000
 
--- /dev/null
+.module fp=64
+.module doublefloat
+.module softfloat
 
-#as: -32
+#as: -32 -mips1
 #readelf: -A
 #name: MIPS module softfloat
 
 
 #name: MIPS 2008 NaN setting 3
 #source: nan-2008-override.s
 #objdump: -p
+#as: -march=from-abi
 
 .*:.*file format.*mips.*
 private flags = [0-9a-f]*[4-7c-f]..: .*[[,]nan2008[],].*
 
 #name: MIPS legacy NaN setting 1
 #source: nan-legacy.s
 #objdump: -p
+#as: -march=from-abi
 
 .*:.*file format.*mips.*
 #failif
 
 #name: MIPS legacy NaN setting 2
 #source: nan-legacy.s
 #objdump: -p
-#as: -mnan=2008
+#as: -mnan=2008 -march=from-abi
 
 .*:.*file format.*mips.*
 #failif
 
 #name: MIPS legacy NaN setting 3
 #source: nan-legacy-override.s
 #objdump: -p
+#as: -march=from-abi
 
 .*:.*file format.*mips.*
 #failif
 
 #name: MIPS legacy NaN setting 4
 #source: empty.s
 #objdump: -p
-#as: -mnan=legacy
+#as: -mnan=legacy -march=from-abi
 
 .*:.*file format.*mips.*
 #failif
 
 #name: MIPS legacy NaN setting 5
 #source: empty.s
 #objdump: -p
+#as: -march=from-abi
 
 .*:.*file format.*mips.*
 #failif
 
 [      ]*[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
        \.\.\.
 
 [0-9a-f]+ <[^>]*> 0399e021     addu    gp,gp,t9
 [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
        \.\.\.
 
 [      ]*[0-9a-f]+: R_MIPS_HI16        bar
 [0-9a-f]+ <[^>]*> 24420000     addiu   v0,v0,0
 [      ]*[0-9a-f]+: R_MIPS_LO16        bar
-[0-9a-f]+ <[^>]*> 03e00008     jr      ra
+[0-9a-f]+ <[^>]*> 03e0000[89]  jr      ra
 [0-9a-f]+ <[^>]*> 00000000     nop
        \.\.\.
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS `.option picX' with relaxation 3
-#as: -32 --relax-branch
+#as: -32 -mips1 --relax-branch
 #warning_output: option-pic-relax-3.l
 
 # Verify that relaxation is done according to the `.option picX' setting
 [      ]*[0-9a-f]+: R_MIPS_26  \.text
 [0-9a-f]+ <[^>]*> 00a01825     move    v1,a1
        \.\.\.
-[0-9a-f]+ <[^>]*> 03e00008     jr      ra
+[0-9a-f]+ <[^>]*> 03e0000[89]  jr      ra
 [0-9a-f]+ <[^>]*> 00000000     nop
        \.\.\.
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS `.option picX' with relaxation 3a
-#as: -32
+#as: -32 -mips1
 #source: option-pic-relax-3.s
 #dump: option-pic-relax-3.d
 
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS `.option picX' with relaxation 4
-#as: -32 -mmicromips --relax-branch
+#as: -32 -mips32r2 -mmicromips --relax-branch
 #warning_output: option-pic-relax-4.l
 
 # Verify that relaxation is done according to the `.option picX' setting
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS `.option picX' with relaxation 5
-#as: -32 -mmicromips --relax-branch
+#as: -32 -mips32r2 -mmicromips --relax-branch
 #warning_output: option-pic-relax-5.l
 
 # Verify that relaxation is done according to the `.option picX' setting
 
 #nm: -g --defined-only
-#as: --relax-branch
+#as: --relax-branch -march=from-abi
 #name: MIPS .org test 1
 #warning_output: org-1.l
 
 
 #nm: -g --defined-only
-#as: --relax-branch
+#as: --relax-branch -march=from-abi
 #name: MIPS .org test 10
 #warning_output: org-10.l
 
 
 #nm: -g --defined-only
-#as: -32
+#as: -32 -mips1
 #name: MIPS .org test 11
 
 0+001000 . bar
 
 #nm: -g --defined-only
 #name: MIPS .org test 12
+#as: -march=from-abi
 
 0+001000 . bar
 0+000000 . foo
 
 #nm: -g --defined-only
-#as: -32
+#as: -32 -mips1
 #name: MIPS .org test 2
 
 0+001000 . bar
 
 #nm: -g --defined-only
 #name: MIPS .org test 3
+#as: -march=from-abi
 
 0+001000 . bar
 0+000000 . foo
 
-#as: --relax-branch
+#as: --relax-branch -march=from-abi
 #name: MIPS .org test 4
 #error_output: org-4.l
 
-#as: -32
+#as: -32 -mips1
 #name: MIPS .org test 5
 #error_output: org-5.l
 
 #name: MIPS .org test 6
 #error_output: org-6.l
+#as: -march=from-abi
 
 #nm: -g --defined-only
-#as: --relax-branch
+#as: --relax-branch -march=from-abi
 #name: MIPS .org test 7
 
 0+010000 . bar
 
 #nm: -g --defined-only
-#as: -32
+#as: -32 -mips1
 #name: MIPS .org test 8
 
 0+000100 . bar
 
 #nm: -g --defined-only
 #name: MIPS .org test 9
+#as: -march=from-abi
 
 0+000080 . bar
 0+000000 . foo
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS local PC-relative relocations 1
-#as: -32
+#as: -32 -mips1
 #source: pcrel-reloc-1.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS local PC-relative relocations 2
-#as: -32 --defsym setmips3=1
+#as: -32 -mips1 --defsym setmips3=1
 #source: pcrel-reloc-1.s
 #dump: pcrel-reloc-1.d
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS local PC-relative relocations 3
-#as: -32 --defsym setmips64r6=1
+#as: -32 -mips1 --defsym setmips64r6=1
 #source: pcrel-reloc-1.s
 #dump: pcrel-reloc-1.d
 
 #objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa64r6
 #name: MIPS local PC-relative relocations 4
-#as: -32
+#as: -32 -mips1
 #source: pcrel-reloc-4.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa64r6
 #name: MIPS local PC-relative relocations 5
-#as: -32 --defsym reverse=1
+#as: -32 -mips1 --defsym reverse=1
 #source: pcrel-reloc-4.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn -mmips:isa64r6
 #name: MIPS local PC-relative relocations 6a
-#as: -32 --defsym offset=0
+#as: -32 -mips1 --defsym offset=0
 #source: pcrel-reloc-6.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn -mmips:sb1 -M gpr-names=32
 #name: .set arch=FOO
 #warning_output: set-arch.l
+#as: -march=from-abi
+
+#FIXME: -march=mips32r6 will break this test: which is a problem
+#FIXME: We should find the real problem, and drop -march=from-abi
 
 .*:     file format .*
 
 
 #objdump: -rst --special-syms -mips16
 #name: MIPS16 reloc
-#as: -32 -mips16
+#as: -32 -mips1 -mips16
 #source: mips16-e.s
 
 # Check MIPS16 reloc processing
 
 #objdump: -rst -mips16
 #name: MIPS16 reloc 2
-#as: -32 -mips16
+#as: -32 -mips1 -mips16
 #source: mips16-f.s
 
 # Check MIPS16 reloc processing
 
 #objdump: -rst --special-syms -mips16
 #name: MIPS16 reloc
-#as: -32 -mips16
+#as: -32 -mips1 -mips16
 #source: mips16-e.s
 
 # Check MIPS16 reloc processing
 
 #objdump: -rst -mips16
 #name: MIPS16 reloc 2
-#as: -32 -mips16
+#as: -32 -mips1 -mips16
 #source: mips16-f.s
 
 # Check MIPS16 reloc processing
 
        .endm
 
        .align  4
+       .set    mips32r2
        .set    micromips
        obj     16
        fun     8
 
        .endm
 
        .align  4
+       .set    mips32r2
        .set    micromips
        obj     16
        fun     8
 
 #objdump: -dr --prefix-addresses --show-raw-insn -m mips:isa64r6
 #name: MIPSr6 branch to unaligned symbol 5
-#as: -n32 -march=from-abi
+#as: -n32 -march=mips64r6
 #source: unaligned-branch-r6-3.s
 
 .*: +file format .*mips.*
 
 #objdump: -dr --prefix-addresses --show-raw-insn
 #name: MIPS16 jump to unaligned symbol 3
-#as: -n32 -march=from-abi
+#as: -n32 -march=from-abi --defsym n32=1
 #source: unaligned-jump-mips16-2.s
 
 .*: +file format .*mips.*
 
 #source: attr-gnu-4-0.s
 #source: attr-gnu-4-1.s
+#as: -march=from-abi
 #ld: -r
 #readelf: -A
 
 
 #source: attr-gnu-4-1.s
 #source: attr-gnu-4-1.s
+#as: -march=from-abi
 #ld: -r
 #readelf: -A
 
 
 #source: attr-gnu-4-4.s -W
 #source: attr-gnu-4-0.s
+#as: -march=from-abi
 #ld: -r
 #error: \A[^\n]*: [^\n]* linking -mfp32 module with previous -mfp64 modules\n
 #error:   [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
 
 #source: attr-gnu-4-4.s -W
 #source: attr-gnu-4-1.s
+#as: -march=from-abi
 #ld: -r
 #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
 
 #source: attr-gnu-8-0.s
 #source: attr-gnu-8-0.s
+#as: -march=from-abi
 #ld: -r
 #readelf: -A
 
 
 #source: attr-gnu-8-0.s
 #source: attr-gnu-8-1.s
+#as: -march=from-abi
 #ld: -r
 #readelf: -A
 
 
 #source: attr-gnu-8-0.s
 #source: attr-gnu-8-2.s
+#as: -march=from-abi
 #ld: -r
 #readelf: -A
 
 
 #source: attr-gnu-8-1.s
 #source: attr-gnu-8-0.s
+#as: -march=from-abi
 #ld: -r
 #readelf: -A
 
 
 #source: attr-gnu-8-1.s
 #source: attr-gnu-8-1.s
+#as: -march=from-abi
 #ld: -r
 #readelf: -A
 
 
 #source: attr-gnu-8-2.s
 #source: attr-gnu-8-0.s
+#as: -march=from-abi
 #ld: -r
 #readelf: -A
 
 
 #source: attr-gnu-8-2.s
 #source: attr-gnu-8-2.s
+#as: -march=from-abi
 #ld: -r
 #readelf: -A
 
 
 
 
 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:
 
   .text
 foo:
   lui    $t0, %hi(_gp_disp)
-  addi   $t0, $t0, %lo(_gp_disp)
+  addiu   $t0, $t0, %lo(_gp_disp)
 
    c:  00000000        nop
 
 0+000010 <\$bar>:
-  10:  03e00008        jr      ra
+  10:  03e0000[89]     jr      ra
   14:  00000000        nop
        \.\.\.
 
 #name: MIPS jalx-1
-#source: jalx-1.s
+#source: jalx-1.s -march=from-abi
 #ld: -T jalx-1.ld
 #objdump: -d
 
 
        set asflags [regsub -- {-march=[^[:blank:]]*} $asflags {}]
        set args [lreplace $args 0 0]
     }
-    if !$has_abi($abi) {
+    set abi_r [regsub "l$" $abi {}]
+    if !$has_abi($abi_r) {
        lappend args {notarget *-*-*}
     }
     if { [llength $args] > 0 } {
 proc run_dump_test_o32 { name args } {
     run_dump_test_abi o32 $name [lindex $args 0]
 }
+proc run_dump_test_o32l { name args } {
+    if {[istarget *-linux*] || [istarget *-img-elf]} {
+      run_dump_test_abi o32l $name [lindex $args 0]
+    } else {
+      run_dump_test_abi o32 $name [lindex $args 0]
+    }
+}
 
 # run_dump_test_n32 NAME ARGS
 #
 proc run_dump_test_n32 { name args } {
     run_dump_test_abi n32 $name [lindex $args 0]
 }
+proc run_dump_test_n32l { name args } {
+    if {[istarget *-linux*] || [istarget *-img-elf]} {
+      run_dump_test_abi n32l $name [lindex $args 0]
+    } else {
+      run_dump_test_abi n32 $name [lindex $args 0]
+    }
+}
 
 # run_dump_test_n64 NAME ARGS
 #
 proc run_dump_test_n64 { name args } {
     run_dump_test_abi n64 $name [lindex $args 0]
 }
+proc run_dump_test_n64l { name args } {
+    if {[istarget *-linux*] || [istarget *-img-elf]} {
+      run_dump_test_abi n64l $name [lindex $args 0]
+    } else {
+      run_dump_test_abi n64 $name [lindex $args 0]
+    }
+}
 
 # run_dump_test_eabi NAME ARGS
 #
 set embedded_elf [expr [istarget mips*-*-elf]]
 
 # Set defaults.
+# ABI with l tail means legacy, aka pre-R6.
+# Please use them, if the test only suite for pre-R6,
+# such as mips16/micromips tests.
 set abi_asflags(o32) ""
+set abi_asflags(o32l) ""
 set abi_asflags(n32) ""
+set abi_asflags(n32l) ""
 set abi_asflags(n64) ""
+set abi_asflags(n64l) ""
 set abi_asflags(eabi) ""
 set abi_ldflags(o32) ""
+set abi_ldflags(o32l) ""
 set abi_ldflags(n32) ""
+set abi_ldflags(n32l) ""
 set abi_ldflags(n64) ""
+set abi_ldflags(n64l) ""
 set abi_ldflags(eabi) ""
 
 # Override as needed.
 if {[istarget *-*-openbsd*] } {
     set irixemul 0
-} elseif { [istarget mips64*-*-linux*] } {
+} elseif { [istarget mips*64*-*-linux*] } {
+    set abi_asflags(o32) -32
+    set abi_asflags(o32l) "-32 -march=from-abi"
+    set abi_asflags(n32) ""
+    set abi_asflags(n32l) "-n32 -march=from-abi"
+    set abi_asflags(n64) "-64"
+    set abi_asflags(n64l) "-march=from-abi -64"
     if [istarget *el-*-*] {
-       set abi_asflags(o32) -32
        set abi_ldflags(o32) -melf32ltsmip
-       set abi_asflags(n64) "-march=from-abi -64"
+       set abi_ldflags(o32l) -melf32ltsmip
        set abi_ldflags(n64) -melf64ltsmip
+       set abi_ldflags(n64l) -melf64ltsmip
     } else {
-       set abi_asflags(o32) -32
        set abi_ldflags(o32) -melf32btsmip
-       set abi_asflags(n64) "-march=from-abi -64"
+       set abi_ldflags(o32l) -melf32btsmip
        set abi_ldflags(n64) -melf64btsmip
+       set abi_ldflags(n64l) -melf64btsmip
     }
     set irixemul 0
-} elseif {[istarget *-*-linux*] } {
+} elseif {[istarget *-*-linux*] || [istarget *-img-elf] } {
+    set abi_asflags(o32) ""
+    set abi_asflags(o32l) "-march=from-abi"
+    set abi_asflags(n32) "-n32"
+    set abi_asflags(n32l) "-n32 -march=from-abi"
+    set abi_asflags(n64) "-64"
+    set abi_asflags(n64l) "-64 -march=from-abi"
     if [istarget *el-*-*] {
-       set abi_asflags(n32) "-march=from-abi -n32"
        set abi_ldflags(n32) -melf32ltsmipn32
-       set abi_asflags(n64) "-march=from-abi -64"
+       set abi_ldflags(n32l) -melf32ltsmipn32
        set abi_ldflags(n64) -melf64ltsmip
+       set abi_ldflags(n64l) -melf64ltsmip
     } else {
-       set abi_asflags(n32) "-march=from-abi -n32"
        set abi_ldflags(n32) -melf32btsmipn32
-       set abi_asflags(n64) "-march=from-abi -64"
+       set abi_ldflags(n32l) -melf32btsmipn32
        set abi_ldflags(n64) -melf64btsmip
+       set abi_ldflags(n64l) -melf64btsmip
     }
     set irixemul 0
 } elseif {[istarget *-img-elf*] \
      || [istarget *-mti-elf*] \
      || [istarget *-sde-elf*] \
      || [istarget *-*-netbsd*] \
-     || [istarget *-*-linux*] \
      || [istarget *-*-sysv4*] } {
     if [istarget *el-*-*] {
        set abi_asflags(o32) -32
 # 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"
+run_dump_test_o32l "branch-absolute"
+run_dump_test_o32l "branch-absolute-addend"
+run_dump_test_n32l "branch-absolute-n32"
+run_dump_test_n32l "branch-absolute-addend-n32"
+run_dump_test_n64l "branch-absolute-n64"
+run_dump_test_n64l "branch-absolute-addend-n64"
+
+run_dump_test_o32l "mips16-pcrel-0"
+run_dump_test_o32l "mips16-pcrel-1" noarch
+run_dump_test_o32l "mips16e2-pcrel-0" noarch
+run_dump_test_o32l "mips16e2-pcrel-1" noarch
+run_dump_test_o32l "mips16-pcrel-addend-2"
+run_dump_test_o32l "mips16-pcrel-addend-6" noarch
+run_dump_test_o32l "mips16e2-pcrel-addend-2" noarch
+run_dump_test_o32l "mips16e2-pcrel-addend-6" noarch
+run_dump_test_n32l "mips16-pcrel-n32-0"
+run_dump_test_n32l "mips16-pcrel-n32-1"
+run_dump_test_n64l "mips16-pcrel-n64-sym32-0"
+run_dump_test_n64l "mips16-pcrel-n64-sym32-1"
+run_dump_test_n32l "mips16e2-pcrel-n32-0" noarch
+run_dump_test_n32l "mips16e2-pcrel-n32-1" noarch
+run_dump_test_n64l "mips16e2-pcrel-n64-sym32-0" noarch
+run_dump_test_n64l "mips16e2-pcrel-n64-sym32-1" noarch
+
+run_dump_test_o32l "mips16-branch-2"
+run_dump_test_o32l "mips16-branch-3"
+run_dump_test_o32l "mips16-branch-addend-2"
+run_dump_test_o32l "mips16-branch-addend-3"
+run_dump_test_o32l "mips16-branch-absolute"
+run_dump_test_o32l "mips16-branch-absolute-1"
+run_dump_test_o32l "mips16-branch-absolute-2"
+run_dump_test_o32l "mips16-branch-absolute-addend"
+run_dump_test_o32l "mips16-branch-absolute-addend-1"
+run_dump_test_n32l "mips16-branch-absolute-n32"
+run_dump_test_n32l "mips16-branch-absolute-n32-1"
+run_dump_test_n32l "mips16-branch-absolute-n32-2"
+run_dump_test_n32l "mips16-branch-absolute-addend-n32"
+run_dump_test_n32l "mips16-branch-absolute-addend-n32-1"
+run_dump_test_n64l "mips16-branch-absolute-n64"
+run_dump_test_n64l "mips16-branch-absolute-n64-1"
+run_dump_test_n64l "mips16-branch-absolute-n64-2"
+run_dump_test_n64l "mips16-branch-absolute-addend-n64"
+run_dump_test_n64l "mips16-branch-absolute-addend-n64-1"
+
+run_dump_test_o32l "micromips-branch-absolute"
+run_dump_test_o32l "micromips-branch-absolute-addend"
+run_dump_test_n32l "micromips-branch-absolute-n32"
+run_dump_test_n32l "micromips-branch-absolute-addend-n32"
+run_dump_test_n64l "micromips-branch-absolute-n64"
+run_dump_test_n64l "micromips-branch-absolute-addend-n64"
 
 # Jalx test
 run_dump_test "jalx-1"
              "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"
+run_dump_test_o32l "jalx-addend"
+run_dump_test_o32l "jalx-local"
+run_dump_test_o32l "bal-jalx-addend"
+run_dump_test_o32l "bal-jalx-addend-micromips"
+run_dump_test_o32l "bal-jalx-local"
+run_dump_test_o32l "bal-jalx-local-micromips"
+run_dump_test_o32l "bal-jalx-pic"
+run_dump_test_o32l "bal-jalx-pic-micromips"
+run_dump_test_o32l "bal-jalx-pic-ignore"
+run_dump_test_o32l "bal-jalx-pic-ignore-micromips"
+run_dump_test_n32l "jalx-addend-n32"
+run_dump_test_n32l "jalx-local-n32"
+run_dump_test_n32l "bal-jalx-addend-n32"
+run_dump_test_n32l "bal-jalx-addend-micromips-n32"
+run_dump_test_n32l "bal-jalx-local-n32"
+run_dump_test_n32l "bal-jalx-local-micromips-n32"
+run_dump_test_n32l "bal-jalx-pic-n32"
+run_dump_test_n32l "bal-jalx-pic-micromips-n32"
+run_dump_test_n32l "bal-jalx-pic-ignore-n32"
+run_dump_test_n32l "bal-jalx-pic-ignore-micromips-n32"
+run_dump_test_n64l "jalx-addend-n64"
+run_dump_test_n64l "jalx-local-n64"
+run_dump_test_n64l "bal-jalx-addend-n64"
+run_dump_test_n64l "bal-jalx-addend-micromips-n64"
+run_dump_test_n64l "bal-jalx-local-n64"
+run_dump_test_n64l "bal-jalx-local-micromips-n64"
+run_dump_test_n64l "bal-jalx-pic-n64"
+run_dump_test_n64l "bal-jalx-pic-micromips-n64"
+run_dump_test_n64l "bal-jalx-pic-ignore-n64"
+run_dump_test_n64l "bal-jalx-pic-ignore-micromips-n64"
+
+run_dump_test_o32l "unaligned-jalx-0" [list [list ld $abi_ldflags(o32)]]
+run_dump_test_o32l "unaligned-jalx-1" [list [list ld $abi_ldflags(o32)]]
+run_dump_test_o32l "unaligned-jalx-2" [list [list ld $abi_ldflags(o32)]]
+run_dump_test_o32l "unaligned-jalx-3" [list [list ld $abi_ldflags(o32)]]
+run_dump_test_o32l "unaligned-jalx-mips16-0" [list [list ld $abi_ldflags(o32)]]
+run_dump_test_o32l "unaligned-jalx-mips16-1" [list [list ld $abi_ldflags(o32)]]
+run_dump_test_o32l "unaligned-jalx-micromips-0" [list [list ld $abi_ldflags(o32)]]
+run_dump_test_o32l "unaligned-jalx-micromips-1" [list [list ld $abi_ldflags(o32)]]
+
+run_dump_test_n32l "unaligned-jalx-addend-0"
+run_dump_test_n32l "unaligned-jalx-addend-1"
+run_dump_test_n32l "unaligned-jalx-addend-2"
+run_dump_test_n32l "unaligned-jalx-addend-3"
+run_dump_test_n32l "unaligned-jalx-addend-mips16-0"
+run_dump_test_n32l "unaligned-jalx-addend-mips16-1"
+run_dump_test_n32l "unaligned-jalx-addend-micromips-0"
+run_dump_test_n32l "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_n32l "unaligned-branch-2"
+run_dump_test_n32l "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"
+run_dump_test_n32l "unaligned-branch-mips16"
+run_dump_test_n32l "unaligned-branch-ignore-mips16"
+run_dump_test_n32l "unaligned-branch-micromips"
+run_dump_test_n32l "unaligned-branch-ignore-micromips"
+run_dump_test_n32l "unaligned-jump"
+run_dump_test_n32l "unaligned-jump-mips16"
+run_dump_test_n32l "unaligned-jump-micromips"
 
 run_dump_test_o32 "unaligned-lwpc-0" noarch
 run_dump_test_o32 "unaligned-lwpc-1" noarch
 }
 
 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}}
+    run_dump_test_n32l "elf-rel-got-n32-embed" {{as -EB} {ld -EB}}
+    run_dump_test_n32l "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}}
+    run_dump_test_n32l "elf-rel-got-n32" {{as -EB} {ld -EB}}
+    run_dump_test_n32l "elf-rel-xgot-n32" {{as -EB} {ld -EB}}
 }
 if { $irix } {
     run_dump_test_n64 "elf-rel-got-n64-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}}
+    run_dump_test_n64l "elf-rel-got-n64" {{as -EB} {ld -EB}}
+    run_dump_test_n64l "elf-rel-xgot-n64" {{as -EB} {ld -EB}}
 }
 
 run_dump_test_n32 "relax-jalr-n32" {{as -EB} {ld -EB}}
 
 run_dump_test "mode-change-error-1"
 
-run_dump_test_o32 "mips16-hilo"
-run_dump_test_n32 "mips16-hilo-n32"
+run_dump_test_o32l "mips16-hilo"
+run_dump_test_n32l "mips16-hilo-n32"
 
 if { $linux_gnu } {
     run_dump_test_n32 "textrel-1"
     set base_syms 1
     foreach { isa aflag lflag suffix } \
        { MIPS -march=mips1 "" "" \
-         microMIPS -mmicromips "" -micromips \
-         "microMIPS insn32" "-mmicromips -minsn32" --insn32 \
+         microMIPS "-mips32r2 -mmicromips" "" -micromips \
+         "microMIPS insn32" "-mips32r2 -mmicromips -minsn32" --insn32 \
              -micromips-insn32 } {
        foreach dynsym { 7fff 8000 fff0 10000 2fe80 } {
            run_ld_link_tests \
        [list \
            "MIPS JALR reloc unaligned/cross-mode link test ($abi)" \
            "$abi_ldflags($abi) -T jalr3.ld" "" \
-           "$abi_asflags($abi)" \
+           "$abi_asflags($abi) -march=from-abi" \
            [list ../../../gas/testsuite/gas/mips/jalr4.s] \
            [list "objdump {-d --prefix-addresses --show-raw-insn} jalr4.dd"] \
            "jalr4-${abi}"] \
     append as_flags " --defsym micromips=$micromips --defsym $abi=1"
     if {[string equal $abi o32]} {
        append as_flags " -march=mips2"
+    } else {
+       append as_flags " -march=mips3"
     }
     set ld_flags "$abi_ldflags($abi) -T compressed-plt-1.ld"
     set dynobj "tmpdir/compressed-plt-1-${abi}-dyn.so"
     run_ld_link_tests [list \
        [list \
            "PR ld/21334 MIPS GOT16 relocation in static binary" \
-           "$abi_ldflags(o32) -e foo -T pr21334.ld" "" "$abi_asflags(o32)" \
+           "$abi_ldflags(o32) -e foo -T pr21334.ld" "" "$abi_asflags(o32) -march=from-abi" \
            {pr21334.s} \
            {{objdump {-d --prefix-addresses} pr21334.dd} \
             {readelf -A pr21334.gd}} \
        [list \
            "microMIPS link PIC branch relaxation with offset" \
            "$abi_ldflags(o32) -shared -T relax-offset.ld" "" \
-           "$abi_asflags(o32) -relax-branch -mmicromips" \
+           "$abi_asflags(o32) -relax-branch -mips32r2 -mmicromips" \
            {../../../gas/testsuite/gas/mips/relax-offset.s} \
            {{objdump \
              {-d --prefix-addresses --show-raw-insn} \
                "$name" \
                "$abi_ldflags($abi) -e foo -T pr21375${scrsuf}.ld ${ldxtra}" \
                "" \
-               "$abi_asflags($abi) ${asxtra}" \
+               "$abi_asflags($abi) -march=from-abi ${asxtra}" \
                [list pr21375${srcsuf}.s] \
                [list \
                    [list objdump -d pr21375${objsuf}.dd] \
 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)] \
+run_dump_test_o32l "pic-reloc-5" [list [list name (microMIPS)] \
                                      [list as "-mmicromips"]]
-run_dump_test_o32 "pic-reloc-6"
+run_dump_test_o32l "pic-reloc-6"
 run_dump_test_n64 "pic-reloc-7"
-run_dump_test_n64 "pic-reloc-7" [list [list name (microMIPS)] \
+run_dump_test_n64l "pic-reloc-7" [list [list name (microMIPS)] \
                                      [list as "-mmicromips"]]
 
 run_dump_test_o32 "reloc-pcrel-r6"
 
-#source: mips16-1a.s -no-mips16
-#source: mips16-1b.s -mips16
+#source: mips16-1a.s -no-mips16 -march=from-abi
+#source: mips16-1b.s -mips16 -march=from-abi
 #ld: -r
 #objdump: -pd
 
 
 #name: MIPS16 and microMIPS interlink
-#source: ../../../gas/testsuite/gas/mips/nop.s -mips16
-#source: ../../../gas/testsuite/gas/mips/nop.s -mmicromips
+#source: ../../../gas/testsuite/gas/mips/nop.s -mips16 -march=from-abi
+#source: ../../../gas/testsuite/gas/mips/nop.s -mmicromips -march=from-abi
 #ld: -e0
 #error: \A.*: .*\.o: ASE mismatch: linking microMIPS module with previous MIPS16 modules[\n\r]+.*: failed to merge target specific data of file .*\.o\Z
 
 #name: Mode Change Error 1
-#source: mode-change-error-1a.s
-#source: mode-change-error-1b.s
+#source: mode-change-error-1a.s -march=from-abi
+#source: mode-change-error-1b.s -march=from-abi
 #ld: -e 0x8000000
 #error: \A[^\n]*: in function `main':\n
 #error:   \(\.text\+0x0\): unsupported jump between ISA modes; consider recompiling with interlinking enabled\n
 
 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:
 
 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:
 
 #source: nan-legacy.s
 #source: nan-legacy.s
+#as: -march=from-abi
 #ld: -r
 #objdump: -p
 
 
 #source: nan-legacy.s
 #source: nan-2008.s
+#as: -march=from-abi
 #ld: -r
 #error: \A[^\n]*: [^\n]* linking -mnan=2008 module with previous -mnan=legacy modules\n
 #error:   [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
 
 #source: nan-2008.s
 #source: nan-legacy.s
+#as: -march=from-abi
 #ld: -r
 #error: \A[^\n]*: [^\n]* linking -mnan=legacy module with previous -mnan=2008 modules\n
 #error:   [^\n]*: failed to merge target specific data of file [^\n]*\.o\Z
 
    4101c:      27391020        addiu   t9,t9,4128
 
 00041020 <foo2>:
-   41020:      03e00008        jr      ra
+   41020:      03e0000[89]     jr      ra
    41024:      00000000        nop
        \.\.\.
 
 #name: R_MIPS16_GPREL reloc
-#source: ../../../gas/testsuite/gas/mips/elf-rel6.s
+#source: ../../../gas/testsuite/gas/mips/elf-rel6.s -march=from-abi
 #objdump: --prefix-addresses -tdr --show-raw-insn
 #ld: -Ttext 0x20000000 -e 0x20000000 -N