4910d4
--- binutils-2.25.1/gas/testsuite/gas/ppc/power7.s	2015-07-21 09:20:58.000000000 +0100
4910d4
+++ binutils-2.25.1.new/gas/testsuite/gas/ppc/power7.s	2016-03-01 14:08:17.020136029 +0000
4910d4
@@ -98,4 +98,4 @@ power7:
4910d4
 	mfppr32	  11
4910d4
 	mtppr	  12
4910d4
 	mtppr32	  13
4910d4
-	tlbie     10,11
4910d4
+	tlbie     10
4910d4
--- binutils-2.25.1/gas/testsuite/gas/ppc/power7.d	2015-07-21 09:20:58.000000000 +0100
4910d4
+++ binutils-2.25.1.new/gas/testsuite/gas/ppc/power7.d	2016-03-01 14:08:17.020136029 +0000
4910d4
@@ -107,5 +107,5 @@ Disassembly of section \.text:
4910d4
 .*:	(7d 62 e2 a6|a6 e2 62 7d) 	mfppr32 r11
4910d4
 .*:	(7d 80 e3 a6|a6 e3 80 7d) 	mtppr   r12
4910d4
 .*:	(7d a2 e3 a6|a6 e3 a2 7d) 	mtppr32 r13
4910d4
-.*:	(7d 60 52 64|64 52 60 7d) 	tlbie   r10,r11
4910d4
+.*:	(7c 00 52 64|64 52 00 7c) 	tlbie   r10
4910d4
 #pass
be6651
--- binutils.orig/opcodes/ppc-opc.c	2017-01-17 09:44:23.341397357 +0000
be6651
+++ binutils-2.27/opcodes/ppc-opc.c	2017-01-17 09:45:24.000684653 +0000
be6651
@@ -5182,8 +5182,7 @@ const struct powerpc_opcode powerpc_opco
be6651
 {"mfbhrbe",	X(31,302),	X_MASK,	     POWER8,	0,		{RT, BHRBE}},
be6651
 
be6651
 {"tlbie",	X(31,306),	X_MASK|1<<20,POWER9,	TITAN,		{RB, RS, RIC, PRS, X_R}},
be6651
-{"tlbie",	X(31,306),	XRA_MASK,    POWER7,	POWER9|TITAN,	{RB, RS}},
be6651
-{"tlbie",	X(31,306),	XRTLRA_MASK, PPC,    E500|POWER7|TITAN,	{RB, L}},
4910d4
+{"tlbie",	X(31,306),	XRTLRA_MASK, PPC,	POWER9|TITAN,  	{RB, L}},
be6651
 {"tlbi",	X(31,306),	XRT_MASK,    POWER,	0,		{RA0, RB}},
be6651
 
be6651
 {"mfvsrld",	X(31,307),	XX1RB_MASK,  PPCVSX3,	0,		{RA, XS6}},
be6651
--- binutils.orig/gas/testsuite/gas/ppc/e500-ill.s	2017-01-17 10:34:39.821866168 +0000
be6651
+++ binutils-2.27/gas/testsuite/gas/ppc/e500-ill.s	2017-01-17 10:56:56.766061777 +0000
be6651
@@ -7,4 +7,4 @@ start:
be6651
 	mfdcr   5, 234
be6651
 	mtdcr   432, 8
be6651
 	tlbia
be6651
-	tlbie  3
be6651
+
be6651
--- binutils.orig/gas/testsuite/gas/ppc/e500-ill.l	2017-01-17 10:34:39.821866168 +0000
be6651
+++ binutils-2.27/gas/testsuite/gas/ppc/e500-ill.l	2017-01-17 10:57:09.021915557 +0000
be6651
@@ -5,4 +5,3 @@
be6651
 .*: Error: unrecognized opcode: `mfdcr'
be6651
 .*: Error: unrecognized opcode: `mtdcr'
be6651
 .*: Error: unrecognized opcode: `tlbia'
be6651
-.*: Error: unrecognized opcode: `tlbie'
be6651
--- binutils.orig/gas/testsuite/gas/ppc/power6.s	2017-01-17 10:34:39.822866157 +0000
be6651
+++ binutils-2.27/gas/testsuite/gas/ppc/power6.s	2017-01-17 10:58:38.316849143 +0000
be6651
@@ -69,6 +69,5 @@ start:
be6651
 	slbia
be6651
 	slbia   0
be6651
 	slbia   7
be6651
-	tlbie   10
be6651
 	tlbie   10,0
be6651
 	tlbie   10,1
be6651
--- binutils.orig/gas/testsuite/gas/ppc/power6.d	2017-01-17 10:34:39.822866157 +0000
be6651
+++ binutils-2.27/gas/testsuite/gas/ppc/power6.d	2017-01-17 10:59:24.780294250 +0000
be6651
@@ -74,7 +74,6 @@ Disassembly of section \.text:
be6651
 .*:	(7c 00 03 e4|e4 03 00 7c) 	slbia   
be6651
 .*:	(7c 00 03 e4|e4 03 00 7c) 	slbia   
be6651
 .*:	(7c e0 03 e4|e4 03 e0 7c) 	slbia   7
be6651
-.*:	(7c 00 52 64|64 52 00 7c) 	tlbie   r10
be6651
-.*:	(7c 00 52 64|64 52 00 7c) 	tlbie   r10
be6651
+.*:	(7c 00 52 64|64 52 00 7c) 	tlbie   r10,0
be6651
 .*:	(7c 20 52 64|64 52 20 7c) 	tlbie   r10,1
be6651
 #pass
be6651
--- binutils.orig/gas/testsuite/gas/ppc/power7.s	2017-01-17 10:34:39.823866144 +0000
be6651
+++ binutils-2.27/gas/testsuite/gas/ppc/power7.s	2017-01-17 11:00:19.835636746 +0000
be6651
@@ -98,4 +98,4 @@ power7:
be6651
 	mfppr32	  11
be6651
 	mtppr	  12
be6651
 	mtppr32	  13
be6651
-	tlbie     10
be6651
+
be6651
--- binutils.orig/gas/testsuite/gas/ppc/power7.d	2017-01-17 10:34:39.822866157 +0000
be6651
+++ binutils-2.27/gas/testsuite/gas/ppc/power7.d	2017-01-17 11:00:27.995539295 +0000
be6651
@@ -107,5 +107,4 @@ Disassembly of section \.text:
be6651
 .*:	(7d 62 e2 a6|a6 e2 62 7d) 	mfppr32 r11
be6651
 .*:	(7d 80 e3 a6|a6 e3 80 7d) 	mtppr   r12
be6651
 .*:	(7d a2 e3 a6|a6 e3 a2 7d) 	mtppr32 r13
be6651
-.*:	(7c 00 52 64|64 52 00 7c) 	tlbie   r10
be6651
 #pass
be6651
diff -rup binutils.orig/gas/config/tc-ppc.c binutils-2.27/gas/config/tc-ppc.c
be6651
--- binutils.orig/gas/config/tc-ppc.c	2017-02-02 12:21:55.246930313 +0000
be6651
+++ binutils-2.27/gas/config/tc-ppc.c	2017-02-02 12:29:13.568862941 +0000
be6651
@@ -2672,7 +2672,7 @@ md_assemble (char *str)
be6651
 
be6651
       operand = &powerpc_operands[*opindex_ptr];
be6651
       if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
be6651
-	  && !((operand->flags & PPC_OPERAND_OPTIONAL32) != 0 && ppc_obj64))
be6651
+	  || (operand->flags & PPC_OPERAND_OPTIONAL32))
be6651
 	{
be6651
 	  unsigned int opcount;
be6651
 	  unsigned int num_operands_expected;
be6651
@@ -2741,8 +2741,8 @@ md_assemble (char *str)
be6651
 
be6651
       /* If this is an optional operand, and we are skipping it, just
be6651
 	 insert a zero.  */
be6651
-      if ((operand->flags & PPC_OPERAND_OPTIONAL) != 0
be6651
-	  && !((operand->flags & PPC_OPERAND_OPTIONAL32) != 0 && ppc_obj64)
be6651
+      if (((operand->flags & PPC_OPERAND_OPTIONAL) != 0
be6651
+	   || (operand->flags & PPC_OPERAND_OPTIONAL32) != 0)
be6651
 	  && skip_optional)
be6651
 	{
be6651
 	  long val = ppc_optional_operand_value (operand);
be6651
diff -rup binutils-2.27.orig/gas/testsuite/gas/ppc/power6.d binutils-2.27/gas/testsuite/gas/ppc/power6.d
be6651
--- binutils-2.27.orig/gas/testsuite/gas/ppc/power6.d	2017-02-14 10:17:21.352033787 +0000
be6651
+++ binutils-2.27/gas/testsuite/gas/ppc/power6.d	2017-02-14 11:54:36.643091777 +0000
be6651
@@ -74,6 +74,6 @@ Disassembly of section \.text:
be6651
 .*:	(7c 00 03 e4|e4 03 00 7c) 	slbia   
be6651
 .*:	(7c 00 03 e4|e4 03 00 7c) 	slbia   
be6651
 .*:	(7c e0 03 e4|e4 03 e0 7c) 	slbia   7
be6651
-.*:	(7c 00 52 64|64 52 00 7c) 	tlbie   r10,0
be6651
+.*:	(7c 00 52 64|64 52 00 7c) 	tlbie   r10
be6651
 .*:	(7c 20 52 64|64 52 20 7c) 	tlbie   r10,1
be6651
 #pass
be6651
diff -rup binutils-2.27.orig/opcodes/ppc-opc.c binutils-2.27/opcodes/ppc-opc.c
be6651
--- binutils-2.27.orig/opcodes/ppc-opc.c	2017-02-14 10:17:22.281021961 +0000
be6651
+++ binutils-2.27/opcodes/ppc-opc.c	2017-02-14 11:58:50.035840144 +0000
be6651
@@ -576,9 +576,12 @@ const struct powerpc_operand powerpc_ope
be6651
 #define RD RS
be6651
   { 0x1f, 21, NULL, NULL, PPC_OPERAND_GPR },
be6651
 
be6651
+#define RSLL RS + 1
be6651
+  { 0x1f, 21, NULL, NULL, PPC_OPERAND_GPR | PPC_OPERAND_OPTIONAL32 },
be6651
+
be6651
   /* The RS and RT fields of the DS form stq and DQ form lq instructions,
be6651
      which have special value restrictions.  */
be6651
-#define RSQ RS + 1
be6651
+#define RSQ RSLL + 1
be6651
 #define RTQ RSQ
be6651
   { 0x1e, 21, NULL, NULL, PPC_OPERAND_GPR },
be6651
 
be6651
@@ -5132,7 +5135,8 @@ const struct powerpc_opcode powerpc_opco
be6651
 {"mfbhrbe",	X(31,302),	X_MASK,	     POWER8,	0,		{RT, BHRBE}},
be6651
 
be6651
 {"tlbie",	X(31,306),	X_MASK|1<<20,POWER9,	TITAN,		{RB, RS, RIC, PRS, X_R}},
be6651
-{"tlbie",	X(31,306),	XRTLRA_MASK, PPC,	POWER9|TITAN,  	{RB, L}},
be6651
+{"tlbie",	X(31,306),	XRA_MASK,    POWER7,	POWER9|TITAN,	{RB, RSLL}},
be6651
+{"tlbie",	X(31,306),	XRTLRA_MASK, PPC,    E500|POWER7|TITAN,	{RB, LOPT}},
be6651
 {"tlbi",	X(31,306),	XRT_MASK,    POWER,	0,		{RA0, RB}},
4910d4
 
be6651
 {"mfvsrld",	X(31,307),	XX1RB_MASK,  PPCVSX3,	0,		{RA, XS6}},