[binutils-gdb] MIPS: Add Toshiba TX49 support

Maciej W. Rozycki macro@sourceware.org
Sun Nov 15 11:12:09 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=309c77ae69b43df396bad0a951730bf82a78a9a9

commit 309c77ae69b43df396bad0a951730bf82a78a9a9
Author: Nathan Sidwell <nathan@codesourcery.com>
Date:   Sun Nov 15 10:53:39 2026 +0000

    MIPS: Add Toshiba TX49 support
    
    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>

Diff:
---
 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(-)

diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 908fb062511..dfdfd8f5b56 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -795,6 +795,7 @@ NAME (aout, machine_type) (enum bfd_architecture 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:
diff --git a/bfd/archures.c b/bfd/archures.c
index 18472b820bc..d1fb3b27b28 100644
--- a/bfd/archures.c
+++ b/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
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index abb0d30f2e3..26e4d374ed0 100644
--- a/bfd/bfd-in2.h
+++ b/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
diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c
index e8163136fd5..90c52d71d50 100644
--- a/bfd/cpu-mips.c
+++ b/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_info_struct[] =
   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)),
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 8af886e17ed..2c3132a71b6 100644
--- a/bfd/elfxx-mips.c
+++ b/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 mips_mach_extensions[] =
   { 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_ext)
     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;
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 62a67dab851..42734f621c5 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -4690,6 +4690,9 @@ decode_MIPS_machine_flags (char *out, unsigned int e_flags)
     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);
     }
diff --git a/elfcpp/mips.h b/elfcpp/mips.h
index 6f1e9ff93ae..66df09abf31 100644
--- a/elfcpp/mips.h
+++ b/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.
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 5369866a050..1fa8b49f805 100644
--- a/gas/config/tc-mips.c
+++ b/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_cpu_info_table[] =
   { "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 },
diff --git a/gas/doc/c-mips.texi b/gas/doc/c-mips.texi
index 5c62969394a..c5111d0e06f 100644
--- a/gas/doc/c-mips.texi
+++ b/gas/doc/c-mips.texi
@@ -385,6 +385,7 @@ vr4181,
 4400,
 4600,
 4650,
+tx49,
 5000,
 rm5200,
 rm5230,
diff --git a/gas/testsuite/gas/mips/elf_mach_tx49.d b/gas/testsuite/gas/mips/elf_mach_tx49.d
new file mode 100644
index 00000000000..e2b6c1d8234
--- /dev/null
+++ b/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: .*
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index bff482dbae2..4b76d11df75 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/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"
diff --git a/gas/testsuite/gas/mips/tx49.d b/gas/testsuite/gas/mips/tx49.d
new file mode 100644
index 00000000000..580f37b0465
--- /dev/null
+++ b/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
+	\.\.\.
diff --git a/gas/testsuite/gas/mips/tx49.s b/gas/testsuite/gas/mips/tx49.s
new file mode 100644
index 00000000000..80193ea9572
--- /dev/null
+++ b/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
diff --git a/gold/mips.cc b/gold/mips.cc
index 26b2afbff7c..d10edfda7ac 100644
--- a/gold/mips.cc
+++ b/gold/mips.cc
@@ -3965,6 +3965,7 @@ class Target_mips : public Sized_target<size, big_endian>
     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<size, big_endian>
     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_mach(elfcpp::Elf_Word flags)
     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_ext_mach(unsigned int isa_ext)
     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_ext(unsigned int mips_mach)
     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_mach_name(elfcpp::Elf_Word e_flags)
       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:
diff --git a/include/elf/mips.h b/include/elf/mips.h
index 187585efc6d..8eabec641e3 100644
--- a/include/elf/mips.h
+++ b/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_v0_out
 #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.  */
diff --git a/include/opcode/mips.h b/include/opcode/mips.h
index 76a0f65fafc..3f45e600626 100644
--- a/include/opcode/mips.h
+++ b/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 mask)
     case CPU_ALLEGREX:
       return (mask & INSN_ALLEGREX) != 0;
 
+    case CPU_TX49:
+      return (mask & INSN_TX49) != 0;
+
     default:
       return false;
     }
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index c0e3509a1ba..87666980ff4 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -540,6 +540,9 @@ const struct mips_arch_choice mips_arch_choices[] =
   { "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 },
diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c
index 66a57dbd885..09e31c492b3 100644
--- a/opcodes/mips-opc.c
+++ b/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_opcodes[] =
 {"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-cvs mailing list