[committed v4] MIPS: Add Toshiba TX49 support

Maciej W. Rozycki macro@orcam.me.uk
Sun Nov 15 11:12:56 GMT 2026


From: Nathan Sidwell <nathan@codesourcery.com>

The Toshiba TX49 processor implements the MIPS III ISA along with TX39 
extensions and additionally three-operand DMULT and DMULTU instruction 
variants plus the MIPS IV PREF instruction.

Just as with the TX39 the pipeline is fully interlocked except for the 
division instructions with respect to MFHI/MFLO instructions[1]:

"HI/LO registers are in undefined state within two instructions before 
the division instruction, such as, DIV/DIVU/DDIV/DDIVU instruction."

and the same restriction applies for division instructions with respect 
to MADD[2]:

"To guarantee correct operation even if an interrupt occurs, neither of 
the two instructions following MADD should be DIV or DIVU instructions 
which modify the HI and LO register contents."

and similarly MADDU[3], so use the same interlock logic as for the TX39.

Add coverage by also running some preexisting tests for `-march=tx49', 
however do this by hand for the HI/LO interlock tests only rather than 
adding a new test architecture, which would incur extra verification 
overhead while mostly duplicating R4000 tests.  Consequently refer the 
relevant "@" override tests directly from mips.exp, which may seem odd, 
but there is nothing wrong with it.

References:

[1] "64-Bit TX System RISC TX49/H2, TX49/H3, TX49/H4 Core Architecture", 
    Rev 1.0, Toshiba Corporation, September 2004, Section C.1.3 
    "Multiply, Multiply/Add and Division Instructions", p. C-3

[2] same, Section A.6 "CPU Instructions", p. A-103

[3] same, p. A-104

bfd/ChangeLog
	* aoutx.h (NAME (aout, machine_type)): Add bfd_mach_mips_tx49.
	* archures.c (bfd_mach_mips_tx49): New #define.
	* cpu-mips.h (I_mips_tx49): New enum value.
	(arch_info_struct): Add tx49.
	* elfxx-mips.c (_bfd_elf_mips_mach): Add EF_MIPS_MACH_TX49.
	(mips_set_isa_flags): Add bfd_mach_mips_tx49.
	(mips_mach_extensions): Likewise.
	(bfd_mips_isa_ext_mach, bfd_mips_isa_ext): Add AFL_EXT_TX49.
	* bfd-in2.h: Regenerate.

binutils/ChangeLog
	* readelf.c (decode_MIPS_machine_flags): Add EF_MIPS_MACH_TX49.
	(print_mips_isa_ext): Add AFL_EXT_TX49.

elfcpp/ChangeLog
	* mips.h (EF_MIPS_MACH_TX49, E_MIPS_MACH_TX49, AFL_EXT_TX49):
	New enum values.

gas/ChangeLog
	* config/tc-mips.c (hilo_nondiv_interlocks): Add CPU_TX49.
	(mips_cpu_info_table): Add tx49.
	* doc/c-mips.texi (-march=tx49): Document.

gas/testsuite/ChangeLog
	* gas/mips/elf_mach_tx49.d: Test ELF TX49 markings.
	* gas/mips/tx49.d: Test TX49 instructions.
	* gas/mips/tx49.s: Test TX49 instructions.
	* gas/mips/mips.exp: Add TX49 tests.

gold/ChangeLog
	* mips.cc (Target_mips::Mips_mach): Add mach_mips_tx49.
	(Target_mips::add_machine_extensions, Target_mips::mips_isa_ext):
	Handle mach_mips_tx49.
	(Target_mips::elf_mips_mach, Target_mips::elf_mips_mach_name):
	Handle EF_MIPS_MACH_TX49.
	(Target_mips::mips_isa_ext_mach): Handle AFL_EXT_TX49.

include/ChangeLog
 	* elf/mips.h (EF_MIPS_MACH_TX49): New machine variant.
	(E_MIPS_MACH_TX49): New compatibility alias.
	(AFL_EXT_TX49): New ISA extension.
	* opcode/mips.h (INSN_TX49): New variant mask.
	(CPU_TX49): New cpu number.
	(cpu_is_member): Adjust.

opcodes/ChangeLog
	* mips-dis.c (mips_arch_choices): Add bfd_mach_mips_tx49.
	* mips-opc.c (T4): New shorthand mask.
	(G1, G2, G3): Update accordingly.
	(mips_builtin_opcodes): Add TX49-specific "dmult" and "dmultu"
	variants.

Co-authored-by: Maciej W. Rozycki <macro@orcam.me.uk>
---
On Mon, 2 Dec 2002, Eric Christopher wrote:

> On Fri, 2002-11-29 at 09:58, Nathan Sidwell wrote:
> > Hi,
> > now with patch (not doing very well am I :)
> > 
> > here's an updated patch with typo fixed and using G1, G2 & G3 in mips-opc.c
> > as suggested.
> > 
> 
> OK.
> 
> -eric
> 
> -- 
> Yeah, I used to play basketball...

 This was OK'd[4], but never pushed.  Since an issue has been triggered 
in the Linux kernel with missing toolchain TX49 support[5], I have dusted 
this off and adapted to our repo contents and conventions as they are now, 
with further tests added/enabled too.

 Given the value of 0x008b0000 for EF_MIPS_MACH_TX49 has been since taken 
for EF_MIPS_MACH_OCTEON, I've instead picked Cygnus's original choice of 
0x00860000, still free, quoted by Jim Wilson upthread and verified with 
our copy of the Cygnus tree[6].

 Regtested across my usual set of MIPS targets.  Committed.

  Maciej

References:

[4] "Add Toshiba TX49 support",
    <https://inbox.sourceware.org/binutils/1038862356.23013.25.camel@hex/>.

[5] "MIPS: lib: prefetch ahead in csum_partial()",
    <https://lore.kernel.org/r/202610131201.wWk11MLy-lkp@intel.com/>.

[6] <https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d15f4fd0b12e>.
---
 bfd/aoutx.h                            |    1 +
 bfd/archures.c                         |    1 +
 bfd/bfd-in2.h                          |    1 +
 bfd/cpu-mips.c                         |    2 ++
 bfd/elfxx-mips.c                       |   10 ++++++++++
 binutils/readelf.c                     |    6 ++++++
 elfcpp/mips.h                          |    6 +++++-
 gas/config/tc-mips.c                   |    2 ++
 gas/doc/c-mips.texi                    |    1 +
 gas/testsuite/gas/mips/elf_mach_tx49.d |   22 ++++++++++++++++++++++
 gas/testsuite/gas/mips/mips.exp        |   22 ++++++++++++++++++++++
 gas/testsuite/gas/mips/tx49.d          |   26 ++++++++++++++++++++++++++
 gas/testsuite/gas/mips/tx49.s          |   33 +++++++++++++++++++++++++++++++++
 gold/mips.cc                           |   13 +++++++++++++
 include/elf/mips.h                     |    3 +++
 include/opcode/mips.h                  |    6 ++++++
 opcodes/mips-dis.c                     |    3 +++
 opcodes/mips-opc.c                     |   14 ++++++--------
 18 files changed, 163 insertions(+), 9 deletions(-)

binutils-nathan-mips-tx49.diff
Index: binutils-gdb/bfd/aoutx.h
===================================================================
--- binutils-gdb.orig/bfd/aoutx.h
+++ binutils-gdb/bfd/aoutx.h
@@ -795,6 +795,7 @@ NAME (aout, machine_type) (enum bfd_arch
 	case bfd_mach_mips4400:
 	case bfd_mach_mips4600:
 	case bfd_mach_mips4650:
+	case bfd_mach_mips_tx49:
 	case bfd_mach_mips8000:
 	case bfd_mach_mips9000:
 	case bfd_mach_mips10000:
Index: binutils-gdb/bfd/archures.c
===================================================================
--- binutils-gdb.orig/bfd/archures.c
+++ binutils-gdb/bfd/archures.c
@@ -159,6 +159,7 @@ DESCRIPTION
 .#define bfd_mach_mips4400		4400
 .#define bfd_mach_mips4600		4600
 .#define bfd_mach_mips4650		4650
+.#define bfd_mach_mips_tx49		4900 {* Toshiba TX49 *}
 .#define bfd_mach_mips5000		5000
 .#define bfd_mach_mips5400		5400
 .#define bfd_mach_mips5500		5500
Index: binutils-gdb/bfd/bfd-in2.h
===================================================================
--- binutils-gdb.orig/bfd/bfd-in2.h
+++ binutils-gdb/bfd/bfd-in2.h
@@ -1416,6 +1416,7 @@ enum bfd_architecture
 #define bfd_mach_mips4400              4400
 #define bfd_mach_mips4600              4600
 #define bfd_mach_mips4650              4650
+#define bfd_mach_mips_tx49             4900 /* Toshiba TX49 */
 #define bfd_mach_mips5000              5000
 #define bfd_mach_mips5400              5400
 #define bfd_mach_mips5500              5500
Index: binutils-gdb/bfd/cpu-mips.c
===================================================================
--- binutils-gdb.orig/bfd/cpu-mips.c
+++ binutils-gdb/bfd/cpu-mips.c
@@ -72,6 +72,7 @@ enum
   I_mips4400,
   I_mips4600,
   I_mips4650,
+  I_mips_tx49,
   I_mips5000,
   I_mips5400,
   I_mips5500,
@@ -127,6 +128,7 @@ static const bfd_arch_info_type arch_inf
   N (64, 64, bfd_mach_mips4400, "mips:4400",	  false, NN(I_mips4400)),
   N (64, 64, bfd_mach_mips4600, "mips:4600",	  false, NN(I_mips4600)),
   N (64, 64, bfd_mach_mips4650, "mips:4650",	  false, NN(I_mips4650)),
+  N (64, 64, bfd_mach_mips_tx49,"mips:tx49",	  false, NN(I_mips_tx49)),
   N (64, 64, bfd_mach_mips5000, "mips:5000",	  false, NN(I_mips5000)),
   N (64, 64, bfd_mach_mips5400, "mips:5400",	  false, NN(I_mips5400)),
   N (64, 64, bfd_mach_mips5500, "mips:5500",	  false, NN(I_mips5500)),
Index: binutils-gdb/bfd/elfxx-mips.c
===================================================================
--- binutils-gdb.orig/bfd/elfxx-mips.c
+++ binutils-gdb/bfd/elfxx-mips.c
@@ -7067,6 +7067,9 @@ _bfd_elf_mips_mach (flagword flags)
     case EF_MIPS_MACH_4650:
       return bfd_mach_mips4650;
 
+    case EF_MIPS_MACH_TX49:
+      return bfd_mach_mips_tx49;
+
     case EF_MIPS_MACH_5400:
       return bfd_mach_mips5400;
 
@@ -12472,6 +12475,10 @@ mips_set_isa_flags (bfd *abfd)
       val = EF_MIPS_ARCH_3 | EF_MIPS_MACH_4650;
       break;
 
+    case bfd_mach_mips_tx49:
+      val = EF_MIPS_ARCH_3 | EF_MIPS_MACH_TX49;
+      break;
+
     case bfd_mach_mips5400:
       val = EF_MIPS_ARCH_4 | EF_MIPS_MACH_5400;
       break;
@@ -14711,6 +14718,7 @@ static const struct mips_mach_extension
   { bfd_mach_mips_loongson_2e, bfd_mach_mips4000 },
   { bfd_mach_mips_loongson_2f, bfd_mach_mips4000 },
   { bfd_mach_mips8000, bfd_mach_mips4000 },
+  { bfd_mach_mips_tx49, bfd_mach_mips4000 },
   { bfd_mach_mips4650, bfd_mach_mips4000 },
   { bfd_mach_mips4600, bfd_mach_mips4000 },
   { bfd_mach_mips4400, bfd_mach_mips4000 },
@@ -14789,6 +14797,7 @@ bfd_mips_isa_ext_mach (unsigned int isa_
     case AFL_EXT_4111:	      return bfd_mach_mips4111;
     case AFL_EXT_4120:	      return bfd_mach_mips4120;
     case AFL_EXT_4650:	      return bfd_mach_mips4650;
+    case AFL_EXT_TX49:	      return bfd_mach_mips_tx49;
     case AFL_EXT_5400:	      return bfd_mach_mips5400;
     case AFL_EXT_5500:	      return bfd_mach_mips5500;
     case AFL_EXT_5900:	      return bfd_mach_mips5900;
@@ -14820,6 +14829,7 @@ bfd_mips_isa_ext (bfd *abfd)
     case bfd_mach_mips4111:	    return AFL_EXT_4111;
     case bfd_mach_mips4120:	    return AFL_EXT_4120;
     case bfd_mach_mips4650:	    return AFL_EXT_4650;
+    case bfd_mach_mips_tx49:	    return AFL_EXT_TX49;
     case bfd_mach_mips5400:	    return AFL_EXT_5400;
     case bfd_mach_mips5500:	    return AFL_EXT_5500;
     case bfd_mach_mips5900:	    return AFL_EXT_5900;
Index: binutils-gdb/binutils/readelf.c
===================================================================
--- binutils-gdb.orig/binutils/readelf.c
+++ binutils-gdb/binutils/readelf.c
@@ -4690,6 +4690,9 @@ decode_MIPS_machine_flags (char *out, un
     case EF_MIPS_MACH_4650:
       out = stpcpy (out, ", 4650");
       break;
+    case EF_MIPS_MACH_TX49:
+      out = stpcpy (out, ", tx49");
+      break;
     case EF_MIPS_MACH_5400:
       out = stpcpy (out, ", 5400");
       break;
@@ -20129,6 +20132,9 @@ print_mips_isa_ext (unsigned int isa_ext
     case AFL_EXT_ALLEGREX:
       fputs ("Sony PSP Allegrex", stdout);
       break;
+    case AFL_EXT_TX49:
+      fputs ("Toshiba TX49", stdout);
+      break;
     default:
       fprintf (stdout, "%s (%d)", _("Unknown"), isa_ext);
     }
Index: binutils-gdb/elfcpp/mips.h
===================================================================
--- binutils-gdb.orig/elfcpp/mips.h
+++ binutils-gdb/elfcpp/mips.h
@@ -220,6 +220,7 @@ enum
   EF_MIPS_MACH_4100 = 0x00830000,
   EF_MIPS_MACH_ALLEGREX = 0x00840000,
   EF_MIPS_MACH_4650 = 0x00850000,
+  EF_MIPS_MACH_TX49 = 0x00860000,
   EF_MIPS_MACH_4120 = 0x00870000,
   EF_MIPS_MACH_4111 = 0x00880000,
   EF_MIPS_MACH_SB1 = 0x008a0000,
@@ -245,6 +246,7 @@ enum
   E_MIPS_MACH_4100    = EF_MIPS_MACH_4100,
   E_MIPS_MACH_ALLEGREX = EF_MIPS_MACH_ALLEGREX,
   E_MIPS_MACH_4650    = EF_MIPS_MACH_4650,
+  E_MIPS_MACH_TX49    = EF_MIPS_MACH_TX49,
   E_MIPS_MACH_4120    = EF_MIPS_MACH_4120,
   E_MIPS_MACH_4111    = EF_MIPS_MACH_4111,
   E_MIPS_MACH_SB1     = EF_MIPS_MACH_SB1,
@@ -395,7 +397,9 @@ enum
   // Imagination interAptiv MR2.
   AFL_EXT_INTERAPTIV_MR2 = 20,
   // Sony PSP Allegrex.
-  AFL_EXT_ALLEGREX = 21
+  AFL_EXT_ALLEGREX = 21,
+  // Toshiba TX49 instruction.
+  AFL_EXT_TX49 = 22
 };
 
 // Masks for the flags1 word of an ABI flags structure.
Index: binutils-gdb/gas/config/tc-mips.c
===================================================================
--- binutils-gdb.orig/gas/config/tc-mips.c
+++ binutils-gdb/gas/config/tc-mips.c
@@ -589,6 +589,7 @@ static int mips_32bitmode = 0;
 #define hilo_nondiv_interlocks				\
   (hilo_interlocks					\
    || mips_opts.arch == CPU_R3900			\
+   || mips_opts.arch == CPU_TX49			\
    )
 
 /* Whether the processor uses hardware interlocks to protect reads
@@ -20376,6 +20377,7 @@ static const struct mips_cpu_info mips_c
   { "r4600",          0, 0,			ISA_MIPS3,    CPU_R4600 },
   { "orion",          0, 0,			ISA_MIPS3,    CPU_R4600 },
   { "r4650",          0, 0,			ISA_MIPS3,    CPU_R4650 },
+  { "tx49",           0, 0,			ISA_MIPS3,    CPU_TX49 },
   { "r5900",          0, 0,			ISA_MIPS3,    CPU_R5900 },
   /* ST Microelectronics Loongson 2E and 2F cores.  */
   { "loongson2e",     0, 0,			ISA_MIPS3,    CPU_LOONGSON_2E },
Index: binutils-gdb/gas/doc/c-mips.texi
===================================================================
--- binutils-gdb.orig/gas/doc/c-mips.texi
+++ binutils-gdb/gas/doc/c-mips.texi
@@ -385,6 +385,7 @@ vr4181,
 4400,
 4600,
 4650,
+tx49,
 5000,
 rm5200,
 rm5230,
Index: binutils-gdb/gas/testsuite/gas/mips/elf_mach_tx49.d
===================================================================
--- /dev/null
+++ binutils-gdb/gas/testsuite/gas/mips/elf_mach_tx49.d
@@ -0,0 +1,22 @@
+#readelf: -Ah
+#name: ELF TX49 markings
+#as: -32 -march=tx49
+#source: empty.s
+
+ELF Header:
+#...
+  Flags: +0x..86...., .*tx49.*
+#...
+
+MIPS ABI Flags Version: 0
+
+ISA: MIPS3
+GPR size: 32
+CPR1 size: 32
+CPR2 size: 0
+FP ABI: .*
+ISA Extension: Toshiba TX49
+ASEs:
+	None
+FLAGS 1: .*
+FLAGS 2: .*
Index: binutils-gdb/gas/testsuite/gas/mips/mips.exp
===================================================================
--- binutils-gdb.orig/gas/testsuite/gas/mips/mips.exp
+++ binutils-gdb/gas/testsuite/gas/mips/mips.exp
@@ -742,12 +742,20 @@ if { [istarget mips*-*-vxworks*] } {
 
     run_dump_test_arches "div"		[mips_arch_list_matching mips1 \
 						!mips32r6]
+    run_dump_test "mips1@div"		[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
     run_dump_test_arches "div-trap"	[mips_arch_list_matching mips1 \
 						!mips32r6]
+    run_dump_test "mips2@div-trap"	[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
     run_dump_test_arches "div64"	[mips_arch_list_matching mips3 !r5900 \
 						!mips64r6]
+    run_dump_test "mips3@div64"		[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
     run_dump_test_arches "div64-trap"	[mips_arch_list_matching mips3 !r5900 \
 						!mips64r6]
+    run_dump_test "mips3@div64-trap"	[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
 
     if { !$addr32 && $has_newabi } {
 	run_dump_test_arches "dli"	[mips_arch_list_matching mips3]
@@ -797,6 +805,8 @@ if { [istarget mips*-*-vxworks*] } {
 
     run_dump_test_arches "hilo"		[mips_arch_list_matching mips1 \
 						!mips32r6]
+    run_dump_test "hilo"		[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
 
     run_dump_test_arches "jal-svr4pic${imips}" \
 					[mips_arch_list_matching mips1]
@@ -899,6 +909,8 @@ if { [istarget mips*-*-vxworks*] } {
 
     run_dump_test "madd"		[list [list name (r3900)] \
 					      [list as "-march=r3900"]]
+    run_dump_test "madd"		[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
 
     run_dump_test_arches "mips4"	[mips_arch_list_matching mips4]
     run_dump_test_arches "mips4-fp" "-32" \
@@ -917,12 +929,20 @@ if { [istarget mips*-*-vxworks*] } {
 					[mips_arch_list_matching fpisa5 gpr64]
     run_dump_test_arches "mul"		[mips_arch_list_matching mips1 \
 						!mips32r6]
+    run_dump_test "r3900@mul"		[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
     run_dump_test_arches "mul-trap"	[mips_arch_list_matching mips1 \
 						!mips32r6]
+    run_dump_test "r10000@mul-trap"	[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
     run_dump_test_arches "mul64"	[mips_arch_list_matching mips3 !r5900 \
 						!mips64r6]
+    run_dump_test "mul64"		[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
     run_dump_test_arches "mul64-trap"	[mips_arch_list_matching mips3 !r5900 \
 						!mips64r6]
+    run_dump_test "mul64-trap"		[list [list name (tx49)] \
+					      [list as "-march=tx49"]]
 
     run_dump_test_arches "rol"		[mips_arch_list_matching mips1 !ror]
     run_dump_test_arches "rol-hw" 	[mips_arch_list_matching ror]
@@ -1081,6 +1101,7 @@ if { [istarget mips*-*-vxworks*] } {
     run_dump_test "vr4120"
     run_dump_test "vr4120-2"
     run_dump_test "vr4130"
+    run_dump_test "tx49"
     run_dump_test "vr5400"
     run_list_test "vr5400-ill" "-march=vr5400"
     run_dump_test "vr5500"
@@ -1207,6 +1228,7 @@ if { [istarget mips*-*-vxworks*] } {
     # Verify that machine markings are handled properly.
     run_dump_test "elf_mach_allegrex"
     run_dump_test "elf_mach_5900"
+    run_dump_test "elf_mach_tx49"
     run_dump_test "elf_mach_interaptiv-mr2"
     run_dump_test "elf_mach_p6600"
     run_dump_test "elf_mach_i6400"
Index: binutils-gdb/gas/testsuite/gas/mips/tx49.d
===================================================================
--- /dev/null
+++ binutils-gdb/gas/testsuite/gas/mips/tx49.d
@@ -0,0 +1,26 @@
+#objdump: -dr --prefix-addresses --show-raw-insn -mmips:tx49 -M gpr-names=32
+#name: MIPS TX49 instructions
+#as: -march=tx49
+
+# Check MIPS TX49 instruction assembly
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+0+0000 <[^>]*> 70220000 	madd	at,v0
+0+0004 <[^>]*> 70851800 	madd	v1,a0,a1
+0+0008 <[^>]*> 70c70001 	maddu	a2,a3
+0+000c <[^>]*> 712a4001 	maddu	t0,t1,t2
+0+0010 <[^>]*> 018d5818 	mult	t3,t4,t5
+0+0014 <[^>]*> 01f07019 	multu	t6,t7,s0
+0+0018 <[^>]*> 0253881c 	dmult	s1,s2,s3
+0+001c <[^>]*> 02b6a01d 	dmultu	s4,s5,s6
+0+0020 <[^>]*> cee40000 	pref	0x4,0\(s7\)
+0+0024 <[^>]*> cf047fff 	pref	0x4,32767\(t8\)
+0+0028 <[^>]*> 40d9d000 	ctc0	t9,\$26
+0+002c <[^>]*> 405be000 	cfc0	k1,\$28
+0+0030 <[^>]*> 42000020 	wait
+0+0034 <[^>]*> 0000000e 	sdbbp
+0+0038 <[^>]*> 0056000e 	sdbbp	0x56
+0+003c <[^>]*> 4200001f 	deret
+	\.\.\.
Index: binutils-gdb/gas/testsuite/gas/mips/tx49.s
===================================================================
--- /dev/null
+++ binutils-gdb/gas/testsuite/gas/mips/tx49.s
@@ -0,0 +1,33 @@
+# Test TX49 extensions.
+	.set	noreorder
+	.set	noat
+	.globl	text_label .text
+text_label:
+	madd	$1,$2
+	madd	$3,$4,$5
+
+	maddu	$6,$7
+	maddu	$8,$9,$10
+
+	mult	$11,$12,$13
+	multu	$14,$15,$16
+
+	dmult	$17,$18,$19
+	dmultu	$20,$21,$22
+
+	pref	4,($23)
+	pref	4,32767($24)
+
+	ctc0	$25,$26
+	cfc0	$27,$28
+
+	wait
+
+	sdbbp
+	sdbbp	0x56
+
+	deret
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+	.align	4, 0
+	.space	16
Index: binutils-gdb/gold/mips.cc
===================================================================
--- binutils-gdb.orig/gold/mips.cc
+++ binutils-gdb/gold/mips.cc
@@ -3965,6 +3965,7 @@ class Target_mips : public Sized_target<
     mach_mips4400             = 4400,
     mach_mips4600             = 4600,
     mach_mips4650             = 4650,
+    mach_mips_tx49            = 4900,
     mach_mips5000             = 5000,
     mach_mips5400             = 5400,
     mach_mips5500             = 5500,
@@ -4191,6 +4192,7 @@ class Target_mips : public Sized_target<
     this->add_extension(mach_mips_loongson_2e, mach_mips4000);
     this->add_extension(mach_mips_loongson_2f, mach_mips4000);
     this->add_extension(mach_mips8000, mach_mips4000);
+    this->add_extension(mach_mips_tx49, mach_mips4000);
     this->add_extension(mach_mips4650, mach_mips4000);
     this->add_extension(mach_mips4600, mach_mips4000);
     this->add_extension(mach_mips4400, mach_mips4000);
@@ -8887,6 +8889,9 @@ Target_mips<size, big_endian>::elf_mips_
     case elfcpp::EF_MIPS_MACH_4650:
       return mach_mips4650;
 
+    case elfcpp::EF_MIPS_MACH_TX49:
+      return mach_mips_tx49;
+
     case elfcpp::EF_MIPS_MACH_5400:
       return mach_mips5400;
 
@@ -9003,6 +9008,9 @@ Target_mips<size, big_endian>::mips_isa_
     case elfcpp::AFL_EXT_4650:
       return mach_mips4650;
 
+    case elfcpp::AFL_EXT_TX49:
+      return mach_mips_tx49;
+
     case elfcpp::AFL_EXT_5400:
       return mach_mips5400;
 
@@ -9076,6 +9084,9 @@ Target_mips<size, big_endian>::mips_isa_
     case mach_mips4650:
       return elfcpp::AFL_EXT_4650;
 
+    case mach_mips_tx49:
+      return elfcpp::AFL_EXT_TX49;
+
     case mach_mips5400:
       return elfcpp::AFL_EXT_5400;
 
@@ -12594,6 +12605,8 @@ Target_mips<size, big_endian>::elf_mips_
       return "mips:4120";
     case elfcpp::EF_MIPS_MACH_4650:
       return "mips:4650";
+    case elfcpp::EF_MIPS_MACH_TX49:
+      return "mips:tx49";
     case elfcpp::EF_MIPS_MACH_5400:
       return "mips:5400";
     case elfcpp::EF_MIPS_MACH_5500:
Index: binutils-gdb/include/elf/mips.h
===================================================================
--- binutils-gdb.orig/include/elf/mips.h
+++ binutils-gdb/include/elf/mips.h
@@ -304,6 +304,7 @@ END_RELOC_NUMBERS (R_MIPS_maxext)
 #define EF_MIPS_MACH_4100	0x00830000
 #define EF_MIPS_MACH_ALLEGREX	0x00840000
 #define EF_MIPS_MACH_4650	0x00850000
+#define EF_MIPS_MACH_TX49	0x00860000
 #define EF_MIPS_MACH_4120	0x00870000
 #define EF_MIPS_MACH_4111	0x00880000
 #define EF_MIPS_MACH_SB1         0x008a0000
@@ -329,6 +330,7 @@ END_RELOC_NUMBERS (R_MIPS_maxext)
 #define E_MIPS_MACH_4100      EF_MIPS_MACH_4100 
 #define E_MIPS_MACH_ALLEGREX  EF_MIPS_MACH_ALLEGREX 
 #define E_MIPS_MACH_4650      EF_MIPS_MACH_4650 
+#define E_MIPS_MACH_TX49      EF_MIPS_MACH_TX49
 #define E_MIPS_MACH_4120      EF_MIPS_MACH_4120 
 #define E_MIPS_MACH_4111      EF_MIPS_MACH_4111 
 #define E_MIPS_MACH_SB1       EF_MIPS_MACH_SB1 
@@ -1323,6 +1325,7 @@ extern void bfd_mips_elf_swap_abiflags_v
 #define AFL_EXT_OCTEON3      19  /* Cavium Networks Octeon3.  */
 #define AFL_EXT_INTERAPTIV_MR2 20  /* Imagination interAptiv MR2.  */
 #define AFL_EXT_ALLEGREX     21  /* Sony PSP Allegrex.  */
+#define AFL_EXT_TX49         22  /* Toshiba TX49 instruction.  */
 
 /* Masks for the flags1 word of an ABI flags structure.  */
 #define AFL_FLAGS1_ODDSPREG   1	 /* Uses odd single-precision registers.  */
Index: binutils-gdb/include/opcode/mips.h
===================================================================
--- binutils-gdb.orig/include/opcode/mips.h
+++ binutils-gdb/include/opcode/mips.h
@@ -1014,6 +1014,8 @@ static const unsigned int mips_isa_table
 #define INSN_INTERAPTIV_MR2	0x00800000
 /* Sony PSP Allegrex instruction.  */
 #define INSN_ALLEGREX		0x01000000
+/* Toshiba TX49 instruction.  */
+#define INSN_TX49		0x02000000
 
 /* DSP ASE */
 #define ASE_DSP			0x00000001
@@ -1102,6 +1104,7 @@ static const unsigned int mips_isa_table
 #define CPU_R4400	4400
 #define CPU_R4600	4600
 #define CPU_R4650	4650
+#define CPU_TX49	4900
 #define CPU_R5000	5000
 #define CPU_VR5400	5400
 #define CPU_VR5500	5500
@@ -1212,6 +1215,9 @@ cpu_is_member (int cpu, unsigned int mas
     case CPU_ALLEGREX:
       return (mask & INSN_ALLEGREX) != 0;
 
+    case CPU_TX49:
+      return (mask & INSN_TX49) != 0;
+
     default:
       return false;
     }
Index: binutils-gdb/opcodes/mips-dis.c
===================================================================
--- binutils-gdb.orig/opcodes/mips-dis.c
+++ binutils-gdb/opcodes/mips-dis.c
@@ -540,6 +540,9 @@ const struct mips_arch_choice mips_arch_
   { "r4650",	1, bfd_mach_mips4650, CPU_R4650, ISA_MIPS3, 0,
     mips_cp0_names_numeric, NULL, 0, mips_cp1_names_mips,
     mips_hwr_names_numeric },
+  { "tx49",	1, bfd_mach_mips_tx49, CPU_TX49, ISA_MIPS3, 0,
+    mips_cp0_names_numeric, NULL, 0, mips_cp1_names_mips,
+    mips_hwr_names_numeric },
   { "r5000",	1, bfd_mach_mips5000, CPU_R5000, ISA_MIPS4, 0,
     mips_cp0_names_numeric, NULL, 0, mips_cp1_names_mips,
     mips_hwr_names_numeric },
Index: binutils-gdb/opcodes/mips-opc.c
===================================================================
--- binutils-gdb.orig/opcodes/mips-opc.c
+++ binutils-gdb/opcodes/mips-opc.c
@@ -315,6 +315,7 @@ decode_mips_operand (const char *p)
 #define L1	INSN_4010
 #define V1	(INSN_4100 | INSN_4111 | INSN_4120)
 #define T3      INSN_3900
+#define T4	INSN_TX49
 /* Emotion Engine MIPS r5900. */
 #define EE      INSN_5900
 #define M1	INSN_10000
@@ -334,14 +335,9 @@ decode_mips_operand (const char *p)
 #define IVIRT	ASE_VIRT
 #define IVIRT64	ASE_VIRT64
 
-#define G1      (T3             \
-                 |EE            \
-                 )
-
-#define G2      (T3             \
-                 )
-
-#define G3      EE
+#define G1	(T3 | T4 | EE)
+#define G2	(T3 | T4)
+#define G3	(T4 | EE)
 
 /* CPU without 64 bit FPU support (single float only). */
 #define SF      (ALX            \
@@ -1129,9 +1125,11 @@ const struct mips_opcode mips_builtin_op
 {"dmulou",		"d,v,t",	0,    (int) M_DMULOU,	INSN_MACRO,		0,		I3,		0,	M32|I69 },
 {"dmulou",		"d,v,I",	0,    (int) M_DMULOU_I,	INSN_MACRO,		0,		I3,		0,	M32|I69 },
 {"dmult",		"s,t",		0x0000001c, 0xfc00ffff, RD_1|RD_2|WR_HILO,      0,		I3,		0,	M32|I69 },
+{"dmult",		"d,s,t",	0x0000001c, 0xfc0007ff, WR_1|RD_2|RD_3|WR_HILO,	0,		T4,		0,	0 },
 {"dmulu",		"d,s,t",	0x0000009d, 0xfc0007ff, WR_1|RD_2|RD_3,      	0,		I69,		0,	0 },
 {"dmuhu",		"d,s,t",	0x000000dd, 0xfc0007ff, WR_1|RD_2|RD_3,      	0,		I69,		0,	0 },
 {"dmultu",		"s,t",		0x0000001d, 0xfc00ffff, RD_1|RD_2|WR_HILO,      0,		I3,		0,	M32|I69 },
+{"dmultu",		"d,s,t",	0x0000001d, 0xfc0007ff, WR_1|RD_2|RD_3|WR_HILO,	0,		T4,		0,	0 },
 {"dneg",		"d,w",		0x0000002e, 0xffe007ff,	WR_1|RD_2,		0,		I3,		0,	0 }, /* dsub 0 */
 {"dnegu",		"d,w",		0x0000002f, 0xffe007ff,	WR_1|RD_2,		0,		I3,		0,	0 }, /* dsubu 0*/
 {"dpop",		"d,v",		0x7000002d, 0xfc1f07ff, WR_1|RD_2,		0,		IOCT,		0,	0 },


More information about the Binutils mailing list