[2/2] gas: Add RXv3e instructions support

Message ID 20261029115244.1979808-3-yoshinori.sato@nifty.com
State New
Headers
Series Renesas RX Add RXv3e instruction support |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Yoshinori Sato Oct. 29, 2026, 11:52 a.m. UTC
  Add support for the instructions introduced in RXv3e.

gas/config/
* rx-defs.h(rx_cpu_type): Add type RXV3E and split RXDFPU.
* rx-parse.y(INT): Add RXv3e enhancement operand.
* (PUSHC): Add RXv3e control register.
* (POPC): Likewise.
* (MVFC): Likewise.
* (MVTC): Likewise.
* (MVTIPL): Expand interrupt level.
* (TRCALL): New.
* (TRMVFC): New.
* (TRMVTC): New.
* (TRRTE): New.
* (token_table): Add RXv3e new tokens.
* (rx_check_v3): Update for rx_cpu_type.
* (rx_check_v3e): New.
* (rx_valid_creg): New. check for vaild register in ISA version.
* (rx_check_dfpu): Update for rx_cpu_type.
* (rx_root_creg): New. handle root world control register.
* tc-rx.c(cpu_type_list): Add RXv3e and split DFPU.
* (md_show_usage): Add new cpu type.

gas/testcase/gas/rx/
* macros.inc(creg): Add new control regsiters.
* (rcreg): New. root world control registers.
* mvfc.d: Add RXv3e case.
* mvtc.d: Likewise.
* popc.d: Likewise.
* pushc.d: Likewise.
* mvtipl.d: New.
* mvtipl.sm: Likewise.
* trcall.d: Likewise.
* trcall.sm: Likewise.
* trmvfc.d: Likewise.
* trmvfc.sm: Likewise.
* trmvtc.d: Likewise.
* trmvtc.sm: Likewise.
* trrte.d: Likewise.
* trrte.sm: Likewise.

include/elf/
* rx.h(E_FLAG_RX_V3E): New.

Signed-off-by: Yoshinori Sato <yoshinori.sato@nifty.com>
---
 gas/config/rx-defs.h            |   4 +-
 gas/config/rx-parse.y           | 124 +++++++++++++++-----
 gas/config/tc-rx.c              |   6 +-
 gas/testsuite/gas/rx/macros.inc |   3 +-
 gas/testsuite/gas/rx/mvfc.d     |   7 +-
 gas/testsuite/gas/rx/mvtc.d     | 193 ++++++++++++++++++--------------
 gas/testsuite/gas/rx/mvtipl.d   |  11 ++
 gas/testsuite/gas/rx/mvtipl.sm  |   1 +
 gas/testsuite/gas/rx/popc.d     |   4 +-
 gas/testsuite/gas/rx/pushc.d    |   4 +-
 gas/testsuite/gas/rx/rx.exp     |   2 +-
 gas/testsuite/gas/rx/trcall.d   |  11 ++
 gas/testsuite/gas/rx/trcall.sm  |   1 +
 gas/testsuite/gas/rx/trmvfc.d   |  26 +++++
 gas/testsuite/gas/rx/trmvfc.sm  |   1 +
 gas/testsuite/gas/rx/trmvtc.d   |  41 +++++++
 gas/testsuite/gas/rx/trmvtc.sm  |   2 +
 gas/testsuite/gas/rx/trrte.d    |  10 ++
 gas/testsuite/gas/rx/trrte.sm   |   1 +
 include/elf/rx.h                |   1 +
 20 files changed, 338 insertions(+), 115 deletions(-)
 create mode 100644 gas/testsuite/gas/rx/mvtipl.d
 create mode 100644 gas/testsuite/gas/rx/mvtipl.sm
 create mode 100644 gas/testsuite/gas/rx/trcall.d
 create mode 100644 gas/testsuite/gas/rx/trcall.sm
 create mode 100644 gas/testsuite/gas/rx/trmvfc.d
 create mode 100644 gas/testsuite/gas/rx/trmvfc.sm
 create mode 100644 gas/testsuite/gas/rx/trmvtc.d
 create mode 100644 gas/testsuite/gas/rx/trmvtc.sm
 create mode 100644 gas/testsuite/gas/rx/trrte.d
 create mode 100644 gas/testsuite/gas/rx/trrte.sm
  

Patch

diff --git a/gas/config/rx-defs.h b/gas/config/rx-defs.h
index 8fa708df311..c0e155e55dc 100644
--- a/gas/config/rx-defs.h
+++ b/gas/config/rx-defs.h
@@ -41,7 +41,9 @@  enum rx_cpu_types
   RX100,
   RXV2,
   RXV3,
-  RXV3FPU,
+  RXV3E,
+  RXCPUMASK = 0x7f,
+  RXDFPU = 0x80,
 };
 
 extern int rx_pid_register;
diff --git a/gas/config/rx-parse.y b/gas/config/rx-parse.y
index 36a36ae011a..8ea30c0a4a2 100644
--- a/gas/config/rx-parse.y
+++ b/gas/config/rx-parse.y
@@ -120,7 +120,10 @@  static void        rtsd_immediate (expressionS);
 static void	   rx_range (expressionS, int, int);
 static void        rx_check_v2 (void);
 static void        rx_check_v3 (void);
+static void        rx_check_v3e (void);
 static void        rx_check_dfpu (void);
+static void        rx_valid_creg (int);
+static int         rx_root_creg (int);
 
 static int    need_flag = 0;
 static int    rx_in_brackets = 0;
@@ -146,7 +149,7 @@  static int    sub_op2;
 %type <regno> flag bwl bw memex
 %type <exp> EXPR disp
 
-%token REG FLAG CREG ACC DREG DREGH DREGL DCREG
+%token REG FLAG CREG ACC DREG DREGH DREGL DCREG CREG
 
 %token EXPR UNKNOWN_OPCODE IS_OPCODE
 
@@ -171,6 +174,7 @@  static int    sub_op2;
 %token   RSTR RTE RTFI RTS RTSD
 %token SAT SATR SAVE SBB SCCND SCMPU SETPSW SHAR SHLL SHLR SMOVB SMOVF
 %token   SMOVU SSTR STNZ STOP STZ SUB SUNTIL SWHILE
+%token TRCALL TRMVFC TRMVTC TRRTE
 %token TST
 %token UTOD UTOF
 %token WAIT
@@ -488,22 +492,20 @@  statement :
 /* ---------------------------------------------------------------------- */
 
 	| PUSHC CREG
-	  { if ($2 == 13)
-	      { rx_check_v2 (); }
-	    if ($2 < 16)
-	      { B2 (0x7e, 0xc0); F ($2, 12, 4); }
-	    else
-	      as_bad (_("PUSHC can only push the first 16 control registers")); }
+	{ rx_valid_creg($2);
+	  if ($2 < 16)
+	    { B2 (0x7e, 0xc0); F ($2, 12, 4); }
+	  else
+	    as_bad (_("PUSHC can only push the first 16 control registers")); }
 
 /* ---------------------------------------------------------------------- */
 
 	| POPC CREG
-	  { if ($2 == 13)
-	    { rx_check_v2 (); }
-	    if ($2 < 16)
-	      { B2 (0x7e, 0xe0); F ($2, 12, 4); }
-	    else
-	      as_bad (_("POPC can only pop the first 16 control registers")); }
+	{ rx_valid_creg($2);
+	  if ($2 < 16)
+	    { B2 (0x7e, 0xe0); F ($2, 12, 4); }
+	  else
+	    as_bad (_("POPC can only pop the first 16 control registers")); }
 
 /* ---------------------------------------------------------------------- */
 
@@ -562,7 +564,8 @@  statement :
 /* ---------------------------------------------------------------------- */
 
 	| MVTIPL '#' EXPR
-	  { B3 (0x75, 0x70, 0x00); FE ($3, 20, 4); }
+	  { if (exp_val($3) >= 16) { rx_check_v3e(); }
+	    B3 (0x75, 0x70, 0x00); FE ($3, 19, 5); }
 
 /* ---------------------------------------------------------------------- */
 
@@ -793,17 +796,15 @@  statement :
 /* ---------------------------------------------------------------------- */
 
 	| MVTC REG ',' CREG
-	  { if ($4 == 13)
-	      rx_check_v2 ();
-	  id24 (2, 0x68, 0x00); F ($4 % 16, 20, 4); F ($4 / 16, 15, 1);
+	{ rx_valid_creg($4);
+	    id24 (2, 0x68, 0x00); F ($4 % 16, 20, 4); F ($4 / 16, 15, 1);
 	    F ($2, 16, 4); }
 
 /* ---------------------------------------------------------------------- */
 
 	| MVFC CREG ',' REG
-	  { if ($2 == 13)
-	    rx_check_v2 ();
-	  id24 (2, 0x6a, 0); F ($2, 15, 5); F ($4, 20, 4); }
+	  { rx_valid_creg($2);
+	    id24 (2, 0x6a, 0); F ($2, 15, 5); F ($4, 20, 4); }
 
 /* ---------------------------------------------------------------------- */
 
@@ -815,8 +816,7 @@  statement :
 /* ---------------------------------------------------------------------- */
 
 	| MVTC '#' EXPR ',' CREG
-	  { if ($5 == 13)
-	      rx_check_v2 ();
+	  { rx_valid_creg($5);
 	    id24 (2, 0x73, 0x00); F ($5, 19, 5); IMM ($3, 12); }
 
 /* ---------------------------------------------------------------------- */
@@ -915,6 +915,27 @@  statement :
 	| BFMOV { rx_check_v3(); sub_op = 1; } op_bfield
 	| BFMOVZ { rx_check_v3(); sub_op = 0; } op_bfield
 
+/* ---------------------------------------------------------------------- */
+	| TRCALL '#' EXPR
+	  { rx_check_v3e();
+	    B3 (0xfd, 0x75, 0x00); UO1 ($3); }
+	| TRMVFC CREG ',' REG
+	  { rx_check_v3e();
+	    B3 (0xfd, 0x5a, 0); F (rx_root_creg($2), 16, 4); F ($4, 20, 4); }
+	| TRMVTC REG ',' CREG
+	  { rx_check_v3e();
+	    B3 (0xfd, 0x58, 0); F ($2, 16, 4); F (rx_root_creg ($4), 20, 4);}
+	| TRMVTC '#' EXPR ',' CREG
+	  { rx_check_v3e();
+	    id24 (2, 0x73, 0x20); F (rx_root_creg ($5), 20, 4); IMM ($3, 12); }
+	| TRRTE
+	  { rx_check_v3e();
+	    B2 (0x7f, 0x97); }
+	| INT REG
+	  { rx_check_v3e();
+	    B4(0xfd, 0x75, 0x10, 0x00); F ($2, 20, 4); }
+
+	  
 /* ---------------------------------------------------------------------- */
 	| RSTR { rx_check_v3(); sub_op = 1; } op_save_rstr
 	| SAVE { rx_check_v3(); sub_op = 0; } op_save_rstr
@@ -1266,7 +1287,7 @@  token_table[] =
   { "usp", CREG, 2 },
   { "fpsw", CREG, 3 },
   /* reserved */
-  /* reserved */
+  { "ivc", CREG, 5 },
   /* reserved */
   { "wr", CREG, 7 },
 
@@ -1276,6 +1297,8 @@  token_table[] =
   { "fintv", CREG, 11 },
   { "intb", CREG, 12 },
   { "extb", CREG, 13 },
+  { "wpri", CREG, 14 },
+  { "wid", CREG, 15 },
 
   { "pbp", CREG, 16 },
   { "pben", CREG, 17 },
@@ -1283,6 +1306,9 @@  token_table[] =
   { "bbpsw", CREG, 24 },
   { "bbpc", CREG, 25 },
 
+  { "trctb", CREG, 30 },
+  { "wintb", CREG, 31 },
+
   { "dr0", DREG, 0 },
   { "dr1", DREG, 1 },
   { "dr2", DREG, 2 },
@@ -1498,6 +1524,10 @@  token_table[] =
   OPC(SUB),
   OPC(SUNTIL),
   OPC(SWHILE),
+  OPC(TRCALL),
+  OPC(TRMVFC),
+  OPC(TRMVTC),
+  OPC(TRRTE),
   OPC(TST),
   OPC(UTOD),
   OPC(UTOF),
@@ -2091,13 +2121,57 @@  rx_check_v2 (void)
 static void
 rx_check_v3 (void)
 {
-  if (rx_cpu < RXV3)
+  if ((rx_cpu & RXCPUMASK) < RXV3)
     rx_error (_("target CPU type does not support v3 instructions"));
 }
 
+static void
+rx_check_v3e (void)
+{
+  if ((rx_cpu & RXCPUMASK) < RXV3E)
+    rx_error (_("target CPU type does not support v3e instructions"));
+}
+
+static void
+rx_valid_creg (int creg)
+{
+  switch (creg)
+    {
+    case 14:
+    case 15:
+    case 5:
+      rx_check_v3e();
+      break;
+    case 13:
+      rx_check_v2();
+      break;
+    }
+}
+
 static void
 rx_check_dfpu (void)
 {
-  if (rx_cpu != RXV3FPU)
+  if (!(rx_cpu & RXDFPU))
     rx_error (_("target CPU type does not support double float instructions"));
 }
+
+static int
+rx_root_creg (int creg)
+{
+  switch (creg)
+    {
+    case 5:
+    case 8:
+    case 9:
+    case 10:
+    case 12:
+    case 13:
+      return creg;
+    case 30:
+    case 31:
+      return creg - 16;
+    default:
+      rx_error (_("Invalid root world register."));
+      return 0;
+    }
+}
diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index 794f64a54f4..ebc1c74a4a9 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -122,7 +122,9 @@  struct cpu_type  cpu_type_list[] =
   {"rx610", RX610, 0},
   {"rxv2",  RXV2,  E_FLAG_RX_V2},
   {"rxv3",  RXV3,  E_FLAG_RX_V3},
-  {"rxv3-dfpu",  RXV3FPU,  E_FLAG_RX_V3},
+  {"rxv3-dfpu",  RXV3 | RXDFPU,  E_FLAG_RX_V3},
+  {"rxv3e",  RXV3E,  E_FLAG_RX_V3E},
+  {"rxv3e-dfpu",  RXV3E | RXDFPU,  E_FLAG_RX_V3E},
 };
 
 int
@@ -217,7 +219,7 @@  md_show_usage (FILE * stream)
   fprintf (stream, _("  --mrelax\n"));
   fprintf (stream, _("  --mpid\n"));
   fprintf (stream, _("  --mint-register=<value>\n"));
-  fprintf (stream, _("  --mcpu=<rx100|rx200|rx600|rx610|rxv2|rxv3|rxv3-dfpu>\n"));
+  fprintf (stream, _("  --mcpu=<rx100|rx200|rx600|rx610|rxv2|rxv3|rxv3-dfpu|rxv3e|rxv3e-dfpu>\n"));
   fprintf (stream, _("  --mno-allow-string-insns"));
 }
 
diff --git a/gas/testsuite/gas/rx/macros.inc b/gas/testsuite/gas/rx/macros.inc
index 329850fbb00..f63d0629189 100644
--- a/gas/testsuite/gas/rx/macros.inc
+++ b/gas/testsuite/gas/rx/macros.inc
@@ -4,7 +4,8 @@  macro	reg2	{r0;r14}
 macro	reg7	{r0;r7}
 macro	regPlo	{r1;r7}
 macro	regPhi	{r8;r14}
-macro	creg	{psw;fpsw;usp;isp;intb;bpsw;bpc;fintv;extb}
+macro	creg	{psw;fpsw;usp;isp;intb;bpsw;bpc;fintv;extb;ivc;wpri;wid}
+macro	rcreg	{bpsw;bpc;isp;intb;extb;ivc;trctb;wintb}
 macro	pswf	{U;I;O;S;Z;C}
 macro	dreg	{dr0;dr15}
 macro	dregh	{drh0;drh15}
diff --git a/gas/testsuite/gas/rx/mvfc.d b/gas/testsuite/gas/rx/mvfc.d
index bab19253216..6f61b5eb848 100644
--- a/gas/testsuite/gas/rx/mvfc.d
+++ b/gas/testsuite/gas/rx/mvfc.d
@@ -25,4 +25,9 @@  Disassembly of section \.text:
   2d:	fd 6a bf                      	mvfc	fintv, r15
   30:	fd 6a d0                      	mvfc	extb, r0
   33:	fd 6a df                      	mvfc	extb, r15
-
+  36:	fd 6a 50                      	mvfc	ivc, r0
+  39:	fd 6a 5f                      	mvfc	ivc, r15
+  3c:	fd 6a e0                      	mvfc	wpri, r0
+  3f:	fd 6a ef                      	mvfc	wpri, r15
+  42:	fd 6a f0                      	mvfc	wid, r0
+  45:	fd 6a ff                      	mvfc	wid, r15
diff --git a/gas/testsuite/gas/rx/mvtc.d b/gas/testsuite/gas/rx/mvtc.d
index f5a4ce90213..78ec774eb08 100644
--- a/gas/testsuite/gas/rx/mvtc.d
+++ b/gas/testsuite/gas/rx/mvtc.d
@@ -16,85 +16,114 @@  Disassembly of section \.text:
   18:	fd 77 09 80                   	mvtc	#-128, bpc
   1c:	fd 77 0b 80                   	mvtc	#-128, fintv
   20:	fd 77 0d 80                   	mvtc	#-128, extb
-  24:	fd 77 00 7f                   	mvtc	#127, psw
-  28:	fd 77 03 7f                   	mvtc	#127, fpsw
-  2c:	fd 77 02 7f                   	mvtc	#127, usp
-  30:	fd 77 0a 7f                   	mvtc	#127, isp
-  34:	fd 77 0c 7f                   	mvtc	#127, intb
-  38:	fd 77 08 7f                   	mvtc	#127, bpsw
-  3c:	fd 77 09 7f                   	mvtc	#127, bpc
-  40:	fd 77 0b 7f                   	mvtc	#127, fintv
-  44:	fd 77 0d 7f                   	mvtc	#127, extb
-  ..:	fd 7b 00 00 80                	mvtc	#0xffff8000, psw
-  ..:	fd 7b 03 00 80                	mvtc	#0xffff8000, fpsw
-  ..:	fd 7b 02 00 80                	mvtc	#0xffff8000, usp
-  ..:	fd 7b 0a 00 80                	mvtc	#0xffff8000, isp
-  ..:	fd 7b 0c 00 80                	mvtc	#0xffff8000, intb
-  ..:	fd 7b 08 00 80                	mvtc	#0xffff8000, bpsw
-  ..:	fd 7b 09 00 80                	mvtc	#0xffff8000, bpc
-  ..:	fd 7b 0b 00 80                	mvtc	#0xffff8000, fintv
-  ..:	fd 7b 0d 00 80                	mvtc	#0xffff8000, extb
-  ..:	fd 7f 00 00 80 00             	mvtc	#0x8000, psw
-  ..:	fd 7f 03 00 80 00             	mvtc	#0x8000, fpsw
-  ..:	fd 7f 02 00 80 00             	mvtc	#0x8000, usp
-  ..:	fd 7f 0a 00 80 00             	mvtc	#0x8000, isp
-  ..:	fd 7f 0c 00 80 00             	mvtc	#0x8000, intb
-  ..:	fd 7f 08 00 80 00             	mvtc	#0x8000, bpsw
-  ..:	fd 7f 09 00 80 00             	mvtc	#0x8000, bpc
-  ..:	fd 7f 0b 00 80 00             	mvtc	#0x8000, fintv
-  ..:	fd 7f 0d 00 80 00             	mvtc	#0x8000, extb
-  ..:	fd 7f 00 00 00 80             	mvtc	#0xff800000, psw
-  ..:	fd 7f 03 00 00 80             	mvtc	#0xff800000, fpsw
-  ..:	fd 7f 02 00 00 80             	mvtc	#0xff800000, usp
-  ..:	fd 7f 0a 00 00 80             	mvtc	#0xff800000, isp
-  ..:	fd 7f 0c 00 00 80             	mvtc	#0xff800000, intb
-  ..:	fd 7f 08 00 00 80             	mvtc	#0xff800000, bpsw
-  ..:	fd 7f 09 00 00 80             	mvtc	#0xff800000, bpc
-  ..:	fd 7f 0b 00 00 80             	mvtc	#0xff800000, fintv
-  ..:	fd 7f 0d 00 00 80             	mvtc	#0xff800000, extb
-  ..:	fd 7f 00 ff ff 7f             	mvtc	#0x7fffff, psw
-  ..:	fd 7f 03 ff ff 7f             	mvtc	#0x7fffff, fpsw
-  ..:	fd 7f 02 ff ff 7f             	mvtc	#0x7fffff, usp
-  ..:	fd 7f 0a ff ff 7f             	mvtc	#0x7fffff, isp
-  ..:	fd 7f 0c ff ff 7f             	mvtc	#0x7fffff, intb
- ...:	fd 7f 08 ff ff 7f             	mvtc	#0x7fffff, bpsw
- ...:	fd 7f 09 ff ff 7f             	mvtc	#0x7fffff, bpc
- ...:	fd 7f 0b ff ff 7f             	mvtc	#0x7fffff, fintv
- ...:	fd 7f 0d ff ff 7f             	mvtc	#0x7fffff, extb
- ...:	fd 73 00 00 00 00 80          	mvtc	#0x80000000, psw
- ...:	fd 73 03 00 00 00 80          	mvtc	#0x80000000, fpsw
- ...:	fd 73 02 00 00 00 80          	mvtc	#0x80000000, usp
- ...:	fd 73 0a 00 00 00 80          	mvtc	#0x80000000, isp
- ...:	fd 73 0c 00 00 00 80          	mvtc	#0x80000000, intb
- ...:	fd 73 08 00 00 00 80          	mvtc	#0x80000000, bpsw
- ...:	fd 73 09 00 00 00 80          	mvtc	#0x80000000, bpc
- ...:	fd 73 0b 00 00 00 80          	mvtc	#0x80000000, fintv
- ...:	fd 73 0d 00 00 00 80          	mvtc	#0x80000000, extb
- ...:	fd 73 00 ff ff ff 7f          	mvtc	#0x7fffffff, psw
- ...:	fd 73 03 ff ff ff 7f          	mvtc	#0x7fffffff, fpsw
- ...:	fd 73 02 ff ff ff 7f          	mvtc	#0x7fffffff, usp
- ...:	fd 73 0a ff ff ff 7f          	mvtc	#0x7fffffff, isp
- ...:	fd 73 0c ff ff ff 7f          	mvtc	#0x7fffffff, intb
- ...:	fd 73 08 ff ff ff 7f          	mvtc	#0x7fffffff, bpsw
- ...:	fd 73 09 ff ff ff 7f          	mvtc	#0x7fffffff, bpc
- ...:	fd 73 0b ff ff ff 7f          	mvtc	#0x7fffffff, fintv
- ...:	fd 73 0d ff ff ff 7f          	mvtc	#0x7fffffff, extb
- ...:	fd 68 00                      	mvtc	r0, psw
- ...:	fd 68 03                      	mvtc	r0, fpsw
- ...:	fd 68 02                      	mvtc	r0, usp
- ...:	fd 68 0a                      	mvtc	r0, isp
- ...:	fd 68 0c                      	mvtc	r0, intb
- ...:	fd 68 08                      	mvtc	r0, bpsw
- ...:	fd 68 09                      	mvtc	r0, bpc
- ...:	fd 68 0b                      	mvtc	r0, fintv
- ...:	fd 68 0d                      	mvtc	r0, extb
- ...:	fd 68 f0                      	mvtc	r15, psw
- ...:	fd 68 f3                      	mvtc	r15, fpsw
- ...:	fd 68 f2                      	mvtc	r15, usp
- ...:	fd 68 fa                      	mvtc	r15, isp
- ...:	fd 68 fc                      	mvtc	r15, intb
- ...:	fd 68 f8                      	mvtc	r15, bpsw
- ...:	fd 68 f9                      	mvtc	r15, bpc
- ...:	fd 68 fb                      	mvtc	r15, fintv
- ...:	fd 68 fd                      	mvtc	r15, extb
-
+  24:	fd 77 05 80                   	mvtc	#-128, ivc
+  28:	fd 77 0e 80                   	mvtc	#-128, wpri
+  2c:	fd 77 0f 80                   	mvtc	#-128, wid
+  30:	fd 77 00 7f                   	mvtc	#127, psw
+  34:	fd 77 03 7f                   	mvtc	#127, fpsw
+  38:	fd 77 02 7f                   	mvtc	#127, usp
+  3c:	fd 77 0a 7f                   	mvtc	#127, isp
+  40:	fd 77 0c 7f                   	mvtc	#127, intb
+  44:	fd 77 08 7f                   	mvtc	#127, bpsw
+  48:	fd 77 09 7f                   	mvtc	#127, bpc
+  4c:	fd 77 0b 7f                   	mvtc	#127, fintv
+  50:	fd 77 0d 7f                   	mvtc	#127, extb
+  54:	fd 77 05 7f                   	mvtc	#127, ivc
+  58:	fd 77 0e 7f                   	mvtc	#127, wpri
+  5c:	fd 77 0f 7f                   	mvtc	#127, wid
+  60:	fd 7b 00 00 80                	mvtc	#0xffff8000, psw
+  65:	fd 7b 03 00 80                	mvtc	#0xffff8000, fpsw
+  6a:	fd 7b 02 00 80                	mvtc	#0xffff8000, usp
+  6f:	fd 7b 0a 00 80                	mvtc	#0xffff8000, isp
+  74:	fd 7b 0c 00 80                	mvtc	#0xffff8000, intb
+  79:	fd 7b 08 00 80                	mvtc	#0xffff8000, bpsw
+  7e:	fd 7b 09 00 80                	mvtc	#0xffff8000, bpc
+  83:	fd 7b 0b 00 80                	mvtc	#0xffff8000, fintv
+  88:	fd 7b 0d 00 80                	mvtc	#0xffff8000, extb
+  8d:	fd 7b 05 00 80                	mvtc	#0xffff8000, ivc
+  92:	fd 7b 0e 00 80                	mvtc	#0xffff8000, wpri
+  97:	fd 7b 0f 00 80                	mvtc	#0xffff8000, wid
+  9c:	fd 7f 00 00 80 00             	mvtc	#0x8000, psw
+  a2:	fd 7f 03 00 80 00             	mvtc	#0x8000, fpsw
+  a8:	fd 7f 02 00 80 00             	mvtc	#0x8000, usp
+  ae:	fd 7f 0a 00 80 00             	mvtc	#0x8000, isp
+  b4:	fd 7f 0c 00 80 00             	mvtc	#0x8000, intb
+  ba:	fd 7f 08 00 80 00             	mvtc	#0x8000, bpsw
+  c0:	fd 7f 09 00 80 00             	mvtc	#0x8000, bpc
+  c6:	fd 7f 0b 00 80 00             	mvtc	#0x8000, fintv
+  cc:	fd 7f 0d 00 80 00             	mvtc	#0x8000, extb
+  d2:	fd 7f 05 00 80 00             	mvtc	#0x8000, ivc
+  d8:	fd 7f 0e 00 80 00             	mvtc	#0x8000, wpri
+  de:	fd 7f 0f 00 80 00             	mvtc	#0x8000, wid
+  e4:	fd 7f 00 00 00 80             	mvtc	#0xff800000, psw
+  ea:	fd 7f 03 00 00 80             	mvtc	#0xff800000, fpsw
+  f0:	fd 7f 02 00 00 80             	mvtc	#0xff800000, usp
+  f6:	fd 7f 0a 00 00 80             	mvtc	#0xff800000, isp
+  fc:	fd 7f 0c 00 00 80             	mvtc	#0xff800000, intb
+ 102:	fd 7f 08 00 00 80             	mvtc	#0xff800000, bpsw
+ 108:	fd 7f 09 00 00 80             	mvtc	#0xff800000, bpc
+ 10e:	fd 7f 0b 00 00 80             	mvtc	#0xff800000, fintv
+ 114:	fd 7f 0d 00 00 80             	mvtc	#0xff800000, extb
+ 11a:	fd 7f 05 00 00 80             	mvtc	#0xff800000, ivc
+ 120:	fd 7f 0e 00 00 80             	mvtc	#0xff800000, wpri
+ 126:	fd 7f 0f 00 00 80             	mvtc	#0xff800000, wid
+ 12c:	fd 7f 00 ff ff 7f             	mvtc	#0x7fffff, psw
+ 132:	fd 7f 03 ff ff 7f             	mvtc	#0x7fffff, fpsw
+ 138:	fd 7f 02 ff ff 7f             	mvtc	#0x7fffff, usp
+ 13e:	fd 7f 0a ff ff 7f             	mvtc	#0x7fffff, isp
+ 144:	fd 7f 0c ff ff 7f             	mvtc	#0x7fffff, intb
+ 14a:	fd 7f 08 ff ff 7f             	mvtc	#0x7fffff, bpsw
+ 150:	fd 7f 09 ff ff 7f             	mvtc	#0x7fffff, bpc
+ 156:	fd 7f 0b ff ff 7f             	mvtc	#0x7fffff, fintv
+ 15c:	fd 7f 0d ff ff 7f             	mvtc	#0x7fffff, extb
+ 162:	fd 7f 05 ff ff 7f             	mvtc	#0x7fffff, ivc
+ 168:	fd 7f 0e ff ff 7f             	mvtc	#0x7fffff, wpri
+ 16e:	fd 7f 0f ff ff 7f             	mvtc	#0x7fffff, wid
+ 174:	fd 73 00 00 00 00 80          	mvtc	#0x80000000, psw
+ 17b:	fd 73 03 00 00 00 80          	mvtc	#0x80000000, fpsw
+ 182:	fd 73 02 00 00 00 80          	mvtc	#0x80000000, usp
+ 189:	fd 73 0a 00 00 00 80          	mvtc	#0x80000000, isp
+ 190:	fd 73 0c 00 00 00 80          	mvtc	#0x80000000, intb
+ 197:	fd 73 08 00 00 00 80          	mvtc	#0x80000000, bpsw
+ 19e:	fd 73 09 00 00 00 80          	mvtc	#0x80000000, bpc
+ 1a5:	fd 73 0b 00 00 00 80          	mvtc	#0x80000000, fintv
+ 1ac:	fd 73 0d 00 00 00 80          	mvtc	#0x80000000, extb
+ 1b3:	fd 73 05 00 00 00 80          	mvtc	#0x80000000, ivc
+ 1ba:	fd 73 0e 00 00 00 80          	mvtc	#0x80000000, wpri
+ 1c1:	fd 73 0f 00 00 00 80          	mvtc	#0x80000000, wid
+ 1c8:	fd 73 00 ff ff ff 7f          	mvtc	#0x7fffffff, psw
+ 1cf:	fd 73 03 ff ff ff 7f          	mvtc	#0x7fffffff, fpsw
+ 1d6:	fd 73 02 ff ff ff 7f          	mvtc	#0x7fffffff, usp
+ 1dd:	fd 73 0a ff ff ff 7f          	mvtc	#0x7fffffff, isp
+ 1e4:	fd 73 0c ff ff ff 7f          	mvtc	#0x7fffffff, intb
+ 1eb:	fd 73 08 ff ff ff 7f          	mvtc	#0x7fffffff, bpsw
+ 1f2:	fd 73 09 ff ff ff 7f          	mvtc	#0x7fffffff, bpc
+ 1f9:	fd 73 0b ff ff ff 7f          	mvtc	#0x7fffffff, fintv
+ 200:	fd 73 0d ff ff ff 7f          	mvtc	#0x7fffffff, extb
+ 207:	fd 73 05 ff ff ff 7f          	mvtc	#0x7fffffff, ivc
+ 20e:	fd 73 0e ff ff ff 7f          	mvtc	#0x7fffffff, wpri
+ 215:	fd 73 0f ff ff ff 7f          	mvtc	#0x7fffffff, wid
+ 21c:	fd 68 00                      	mvtc	r0, psw
+ 21f:	fd 68 03                      	mvtc	r0, fpsw
+ 222:	fd 68 02                      	mvtc	r0, usp
+ 225:	fd 68 0a                      	mvtc	r0, isp
+ 228:	fd 68 0c                      	mvtc	r0, intb
+ 22b:	fd 68 08                      	mvtc	r0, bpsw
+ 22e:	fd 68 09                      	mvtc	r0, bpc
+ 231:	fd 68 0b                      	mvtc	r0, fintv
+ 234:	fd 68 0d                      	mvtc	r0, extb
+ 237:	fd 68 05                      	mvtc	r0, ivc
+ 23a:	fd 68 0e                      	mvtc	r0, wpri
+ 23d:	fd 68 0f                      	mvtc	r0, wid
+ 240:	fd 68 f0                      	mvtc	r15, psw
+ 243:	fd 68 f3                      	mvtc	r15, fpsw
+ 246:	fd 68 f2                      	mvtc	r15, usp
+ 249:	fd 68 fa                      	mvtc	r15, isp
+ 24c:	fd 68 fc                      	mvtc	r15, intb
+ 24f:	fd 68 f8                      	mvtc	r15, bpsw
+ 252:	fd 68 f9                      	mvtc	r15, bpc
+ 255:	fd 68 fb                      	mvtc	r15, fintv
+ 258:	fd 68 fd                      	mvtc	r15, extb
+ 25b:	fd 68 f5                      	mvtc	r15, ivc
+ 25e:	fd 68 fe                      	mvtc	r15, wpri
+ 261:	fd 68 ff                      	mvtc	r15, wid
diff --git a/gas/testsuite/gas/rx/mvtipl.d b/gas/testsuite/gas/rx/mvtipl.d
new file mode 100644
index 00000000000..6538084ca71
--- /dev/null
+++ b/gas/testsuite/gas/rx/mvtipl.d
@@ -0,0 +1,11 @@ 
+#source: ./mvtipl.s
+#objdump: -dr
+
+.*:     file format .*
+
+
+Disassembly of section \.text:
+
+00000000 <\.text>:
+   0:	75 70 00                      	mvtipl	#0
+   3:	75 70 1f                      	mvtipl	#31
diff --git a/gas/testsuite/gas/rx/mvtipl.sm b/gas/testsuite/gas/rx/mvtipl.sm
new file mode 100644
index 00000000000..b61e4aef2bc
--- /dev/null
+++ b/gas/testsuite/gas/rx/mvtipl.sm
@@ -0,0 +1 @@ 
+	mvtipl	#{uimm5}
diff --git a/gas/testsuite/gas/rx/popc.d b/gas/testsuite/gas/rx/popc.d
index e83116aef35..9db21bba8a5 100644
--- a/gas/testsuite/gas/rx/popc.d
+++ b/gas/testsuite/gas/rx/popc.d
@@ -16,4 +16,6 @@  Disassembly of section \.text:
    c:	7e e9                         	popc	bpc
    e:	7e eb                         	popc	fintv
   10:	7e ed                         	popc	extb
-
+  12:	7e e5                         	popc	ivc
+  14:	7e ee                         	popc	wpri
+  16:	7e ef                         	popc	wid
diff --git a/gas/testsuite/gas/rx/pushc.d b/gas/testsuite/gas/rx/pushc.d
index 16603135875..0edfb019b64 100644
--- a/gas/testsuite/gas/rx/pushc.d
+++ b/gas/testsuite/gas/rx/pushc.d
@@ -16,4 +16,6 @@  Disassembly of section \.text:
    c:	7e c9                         	pushc	bpc
    e:	7e cb                         	pushc	fintv
   10:	7e cd                         	pushc	extb
-
+  12:	7e c5                         	pushc	ivc
+  14:	7e ce                         	pushc	wpri
+  16:	7e cf                         	pushc	wid
diff --git a/gas/testsuite/gas/rx/rx.exp b/gas/testsuite/gas/rx/rx.exp
index 4bafc6b82a3..d2f1c92646c 100644
--- a/gas/testsuite/gas/rx/rx.exp
+++ b/gas/testsuite/gas/rx/rx.exp
@@ -21,7 +21,7 @@  if { ! [istarget rx-*-*] } {
     return
 }
 
-set ASFLAGS "--mcpu=rxv3-dfpu"
+set ASFLAGS "--mcpu=rxv3e-dfpu"
 
 foreach test [lsort [glob $srcdir/$subdir/*.sm]] {
     regexp ".*/(.*)\.sm" $test rxjunk rxbase
diff --git a/gas/testsuite/gas/rx/trcall.d b/gas/testsuite/gas/rx/trcall.d
new file mode 100644
index 00000000000..bc08cd99e3c
--- /dev/null
+++ b/gas/testsuite/gas/rx/trcall.d
@@ -0,0 +1,11 @@ 
+#source: ./trcall.s
+#objdump: -dr
+
+.*:     file format .*
+
+
+Disassembly of section \.text:
+
+00000000 <\.text>:
+   0:	fd 75 00 00                   	trcall	#0
+   4:	fd 75 00 ff                   	trcall	#255
diff --git a/gas/testsuite/gas/rx/trcall.sm b/gas/testsuite/gas/rx/trcall.sm
new file mode 100644
index 00000000000..3e538e155fa
--- /dev/null
+++ b/gas/testsuite/gas/rx/trcall.sm
@@ -0,0 +1 @@ 
+	trcall	#{uimm8}
diff --git a/gas/testsuite/gas/rx/trmvfc.d b/gas/testsuite/gas/rx/trmvfc.d
new file mode 100644
index 00000000000..de602e8bbae
--- /dev/null
+++ b/gas/testsuite/gas/rx/trmvfc.d
@@ -0,0 +1,26 @@ 
+#source: ./trmvfc.s
+#objdump: -dr
+
+.*:     file format .*
+
+
+Disassembly of section \.text:
+
+00000000 <\.text>:
+   0:	fd 5a 80                      	trmvfc	bpsw, r0
+   3:	fd 5a 8f                      	trmvfc	bpsw, r15
+   6:	fd 5a 90                      	trmvfc	bpc, r0
+   9:	fd 5a 9f                      	trmvfc	bpc, r15
+   c:	fd 5a a0                      	trmvfc	isp, r0
+   f:	fd 5a af                      	trmvfc	isp, r15
+  12:	fd 5a c0                      	trmvfc	intb, r0
+  15:	fd 5a cf                      	trmvfc	intb, r15
+  18:	fd 5a d0                      	trmvfc	extb, r0
+  1b:	fd 5a df                      	trmvfc	extb, r15
+  1e:	fd 5a 50                      	trmvfc	ivc, r0
+  21:	fd 5a 5f                      	trmvfc	ivc, r15
+  24:	fd 5a e0                      	trmvfc	trctb, r0
+  27:	fd 5a ef                      	trmvfc	trctb, r15
+  2a:	fd 5a f0                      	trmvfc	wintb, r0
+  2d:	fd 5a ff                      	trmvfc	wintb, r15
+
diff --git a/gas/testsuite/gas/rx/trmvfc.sm b/gas/testsuite/gas/rx/trmvfc.sm
new file mode 100644
index 00000000000..0993530e792
--- /dev/null
+++ b/gas/testsuite/gas/rx/trmvfc.sm
@@ -0,0 +1 @@ 
+	trmvfc	{rcreg},{reg}
diff --git a/gas/testsuite/gas/rx/trmvtc.d b/gas/testsuite/gas/rx/trmvtc.d
new file mode 100644
index 00000000000..2604a8cc335
--- /dev/null
+++ b/gas/testsuite/gas/rx/trmvtc.d
@@ -0,0 +1,41 @@ 
+#source: ./trmvtc.s
+#objdump: -dr
+
+.*:     file format .*
+
+
+Disassembly of section \.text:
+
+00000000 <\.text>:
+   0:	fd 58 08                      	trmvtc	r0, bpsw
+   3:	fd 58 09                      	trmvtc	r0, bpc
+   6:	fd 58 0a                      	trmvtc	r0, isp
+   9:	fd 58 0c                      	trmvtc	r0, intb
+   c:	fd 58 0d                      	trmvtc	r0, extb
+   f:	fd 58 05                      	trmvtc	r0, ivc
+  12:	fd 58 0e                      	trmvtc	r0, trctb
+  15:	fd 58 0f                      	trmvtc	r0, wintb
+  18:	fd 58 f8                      	trmvtc	r15, bpsw
+  1b:	fd 58 f9                      	trmvtc	r15, bpc
+  1e:	fd 58 fa                      	trmvtc	r15, isp
+  21:	fd 58 fc                      	trmvtc	r15, intb
+  24:	fd 58 fd                      	trmvtc	r15, extb
+  27:	fd 58 f5                      	trmvtc	r15, ivc
+  2a:	fd 58 fe                      	trmvtc	r15, trctb
+  2d:	fd 58 ff                      	trmvtc	r15, wintb
+  30:	fd 77 28 00                   	trmvtc	#0, bpsw
+  34:	fd 77 29 00                   	trmvtc	#0, bpc
+  38:	fd 77 2a 00                   	trmvtc	#0, isp
+  3c:	fd 77 2c 00                   	trmvtc	#0, intb
+  40:	fd 77 2d 00                   	trmvtc	#0, extb
+  44:	fd 77 25 00                   	trmvtc	#0, ivc
+  48:	fd 77 2e 00                   	trmvtc	#0, trctb
+  4c:	fd 77 2f 00                   	trmvtc	#0, wintb
+  50:	fd 77 28 ff                   	trmvtc	#-1, bpsw
+  54:	fd 77 29 ff                   	trmvtc	#-1, bpc
+  58:	fd 77 2a ff                   	trmvtc	#-1, isp
+  5c:	fd 77 2c ff                   	trmvtc	#-1, intb
+  60:	fd 77 2d ff                   	trmvtc	#-1, extb
+  64:	fd 77 25 ff                   	trmvtc	#-1, ivc
+  68:	fd 77 2e ff                   	trmvtc	#-1, trctb
+  6c:	fd 77 2f ff                   	trmvtc	#-1, wintb
diff --git a/gas/testsuite/gas/rx/trmvtc.sm b/gas/testsuite/gas/rx/trmvtc.sm
new file mode 100644
index 00000000000..db99c4337e7
--- /dev/null
+++ b/gas/testsuite/gas/rx/trmvtc.sm
@@ -0,0 +1,2 @@ 
+	trmvtc	{reg},{rcreg}
+	trmvtc	#{uimm32},{rcreg}
diff --git a/gas/testsuite/gas/rx/trrte.d b/gas/testsuite/gas/rx/trrte.d
new file mode 100644
index 00000000000..3b3f6278e72
--- /dev/null
+++ b/gas/testsuite/gas/rx/trrte.d
@@ -0,0 +1,10 @@ 
+#source: ./trrte.s
+#objdump: -dr
+
+.*:     file format .*
+
+
+Disassembly of section \.text:
+
+00000000 <\.text>:
+   0:	7f 97                         	trrte
diff --git a/gas/testsuite/gas/rx/trrte.sm b/gas/testsuite/gas/rx/trrte.sm
new file mode 100644
index 00000000000..f83301336e0
--- /dev/null
+++ b/gas/testsuite/gas/rx/trrte.sm
@@ -0,0 +1 @@ 
+	trrte
diff --git a/include/elf/rx.h b/include/elf/rx.h
index a79ac26f080..71cd12f4f76 100644
--- a/include/elf/rx.h
+++ b/include/elf/rx.h
@@ -125,6 +125,7 @@  END_RELOC_NUMBERS (R_RX_max)
 #define E_FLAG_RX_SINSNS_MASK		(3 << 6) /* Mask of bits used to determine string instruction use.  */
 #define E_FLAG_RX_V2			(1 << 8) /* RX v2 instructions */
 #define E_FLAG_RX_V3			(1 << 9) /* RX v3 instructions */
+#define E_FLAG_RX_V3E			(1 << 10) /* RX v3 instructions */
 
 /* These define the addend field of R_RX_RH_RELAX relocations.  */
 #define	RX_RELAXA_IMM6	0x00000010	/* Imm8/16/24/32 at bit offset 6.  */