Power4 should treat mftb as extended mfspr mnemonic

Alan Modra amodra@gmail.com
Sun Nov 30 03:08:00 GMT 2014


On Fri, Nov 28, 2014 at 02:34:54PM +1030, Alan Modra wrote:
> mftb is marked phased out in the architecture manual, but we can keep
> it as an extended mnemonic for mftbl.

On further reading of ISA manual it appears gas should have been
treating mftb and mftbu as extended mnemonics for mfspr, for ISA 2.03
and later.  The 31,371 opcode is phased out, not the mnemonic.

opcodes/
	* ppc-opc.c (powerpc_opcodes): Make mftb* generate mfspr for
	power4 and later.
gas/testsuite/
	* gas/ppc/a2.d: Update for mftb change.
	* gas/ppc/476.d: Likewise.

diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index 4427465..95802b0 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -4880,9 +4880,9 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 {"mfsprg5",	XSPR(31,339,261), XSPR_MASK, PPC405|BOOKE|PPCVLE, PPCNONE, {RT}},
 {"mfsprg6",	XSPR(31,339,262), XSPR_MASK, PPC405|BOOKE|PPCVLE, PPCNONE, {RT}},
 {"mfsprg7",	XSPR(31,339,263), XSPR_MASK, PPC405|BOOKE|PPCVLE, PPCNONE, {RT}},
-{"mftb",	XSPR(31,339,268), XSPR_MASK, BOOKE|PPCVLE, PPCNONE,	{RT}},
-{"mftbl",	XSPR(31,339,268), XSPR_MASK, BOOKE|PPCVLE, PPCNONE,	{RT}},
-{"mftbu",	XSPR(31,339,269), XSPR_MASK, BOOKE|PPCVLE, PPCNONE,	{RT}},
+{"mftbu",	XSPR(31,339,269), XSPR_MASK, POWER4|BOOKE|PPCVLE, PPCNONE, {RT}},
+{"mftb",	X(31,339),	  X_MASK,    POWER4|BOOKE|PPCVLE, PPCNONE, {RT, TBR}},
+{"mftbl",	XSPR(31,339,268), XSPR_MASK, POWER4|BOOKE|PPCVLE, PPCNONE, {RT}},
 {"mfsprg0",	XSPR(31,339,272), XSPR_MASK, PPC|PPCVLE, PPCNONE,	{RT}},
 {"mfsprg1",	XSPR(31,339,273), XSPR_MASK, PPC|PPCVLE, PPCNONE,	{RT}},
 {"mfsprg2",	XSPR(31,339,274), XSPR_MASK, PPC|PPCVLE, PPCNONE,	{RT}},
@@ -5051,9 +5051,9 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 
 {"tlbia",	X(31,370),	0xffffffff,  PPC,	TITAN,  	{0}},
 
-{"mftbl",	XSPR(31,371,268), XSPR_MASK, PPC,	NO371,		{RT}},
-{"mftbu",	XSPR(31,371,269), XSPR_MASK, PPC,	NO371,		{RT}},
-{"mftb",	X(31,371),	X_MASK,      PPC|PPCA2,	NO371,		{RT, TBR}},
+{"mftbu",	XSPR(31,371,269), XSPR_MASK, PPC,	NO371|POWER4,	{RT}},
+{"mftb",	X(31,371),	X_MASK,      PPC,	NO371|POWER4,	{RT, TBR}},
+{"mftbl",	XSPR(31,371,268), XSPR_MASK, PPC,	NO371|POWER4,	{RT}},
 
 {"lwaux",	X(31,373),	X_MASK,      PPC64|PPCVLE, PPCNONE,	{RT, RAL, RB}},
 
diff --git a/gas/testsuite/gas/ppc/476.d b/gas/testsuite/gas/ppc/476.d
index 23b5d6e..e59e2e9 100644
--- a/gas/testsuite/gas/ppc/476.d
+++ b/gas/testsuite/gas/ppc/476.d
@@ -308,7 +308,7 @@ Disassembly of section \.text:
  4a8:	(7e 60 00 a6|a6 00 60 7e) 	mfmsr   r19
  4ac:	(7c 78 00 26|26 00 78 7c) 	mfocrf  r3,128
  4b0:	(7c 60 22 a6|a6 22 60 7c) 	mfspr   r3,128
- 4b4:	(7c 6c 42 e6|e6 42 6c 7c) 	mftbl   r3
+ 4b4:	(7c 6c 42 a6|a6 42 6c 7c) 	mftb    r3
  4b8:	(7c 00 04 ac|ac 04 00 7c) 	msync
  4bc:	(7c 78 01 20|20 01 78 7c) 	mtocrf  128,r3
  4c0:	(7c 6f f1 20|20 f1 6f 7c) 	mtcr    r3
diff --git a/gas/testsuite/gas/ppc/a2.d b/gas/testsuite/gas/ppc/a2.d
index 8684ed7..a743402 100644
--- a/gas/testsuite/gas/ppc/a2.d
+++ b/gas/testsuite/gas/ppc/a2.d
@@ -360,8 +360,8 @@ Disassembly of section \.text:
  530:	(7c 70 10 26|26 10 70 7c) 	mfocrf  r3,1
  534:	(7c 78 00 26|26 00 78 7c) 	mfocrf  r3,128
  538:	(7d 4a 3a a6|a6 3a 4a 7d) 	mfspr   r10,234
- 53c:	(7d 4c 42 e6|e6 42 4c 7d) 	mftbl   r10
- 540:	(7d 4d 42 e6|e6 42 4d 7d) 	mftbu   r10
+ 53c:	(7d 4c 42 a6|a6 42 4c 7d) 	mftb    r10
+ 540:	(7d 4d 42 a6|a6 42 4d 7d) 	mftbu   r10
  544:	(7c 00 51 dc|dc 51 00 7c) 	msgclr  r10
  548:	(7c 00 51 9c|9c 51 00 7c) 	msgsnd  r10
  54c:	(7c 60 01 20|20 01 60 7c) 	mtcrf   0,r3

-- 
Alan Modra
Australia Development Lab, IB



More information about the Binutils mailing list