Blame SOURCES/gdb-rhbz1320945-power9-36of38.patch

2c2fa1
commit a5721ba270ddf860e0e5a45bba456214e8eac2be
2c2fa1
Author: Alan Modra <amodra@gmail.com>
2c2fa1
Date:   Thu Sep 29 15:12:47 2016 +0930
2c2fa1
2c2fa1
    Disallow 3-operand cmp[l][i] for ppc64
2c2fa1
    
2c2fa1
    cmp[l][o] get an optional L field only when generating 32-bit code.
2c2fa1
    dcbf, tlbie and tlbiel keep their optional L field, ditto for R field
2c2fa1
    of tbegin.  cmprb, tsr., wlcr[all] and mtsle all change to a
2c2fa1
    compulsory L field.
2c2fa1
    
2c2fa1
    L field of dcbf and wclr is 2 bits.
2c2fa1
    
2c2fa1
            PR 20641
2c2fa1
    include/
2c2fa1
            * opcode/ppc.h (PPC_OPERAND_OPTIONAL32): Define.
2c2fa1
    opcodes/
2c2fa1
            * ppc-opc.c (L): Make compulsory.
2c2fa1
            (LOPT): New, optional form of L.
2c2fa1
            (HTM_R): Define as LOPT.
2c2fa1
            (L0, L1): Delete.
2c2fa1
            (L32OPT): New, optional for 32-bit L.
2c2fa1
            (L2OPT): New, 2-bit L for dcbf.
2c2fa1
            (SVC_LEC): Update.
2c2fa1
            (L2): Define.
2c2fa1
            (insert_l0, extract_l0, insert_l1, extract_l2): Delete.
2c2fa1
            (powerpc_opcodes <cmpli, cmpi, cmpl, cmp>): Use L32OPT.
2c2fa1
            <dcbf>: Use L2OPT.
2c2fa1
            <tlbiel, tlbie>: Use LOPT.
2c2fa1
            <wclr, wclrall>: Use L2.
2c2fa1
    gas/
2c2fa1
            * config/tc-ppc.c (md_assemble): Handle PPC_OPERAND_OPTIONAL32.
2c2fa1
            * testsuite/gas/ppc/power8.s: Provide tbegin. operand.
2c2fa1
            * testsuite/gas/ppc/power9.d: Update cmprb disassembly.
2c2fa1
2c2fa1
### a/include/ChangeLog
2c2fa1
### b/include/ChangeLog
2c2fa1
## -1,3 +1,7 @@
2c2fa1
+2016-09-29  Alan Modra  <amodra@gmail.com>
2c2fa1
+
2c2fa1
+	* opcode/ppc.h (PPC_OPERAND_OPTIONAL32): Define.
2c2fa1
+
2c2fa1
 2016-09-26  Claudiu Zissulescu  <claziss@synopsys.com>
2c2fa1
 
2c2fa1
 	* opcode/arc.h (insn_class_t): Add two new classes.
2c2fa1
--- a/include/opcode/ppc.h
2c2fa1
+++ b/include/opcode/ppc.h
2c2fa1
@@ -407,6 +407,10 @@ extern const unsigned int num_powerpc_operands;
2c2fa1
    is omitted, then the value it should use for the operand is stored
2c2fa1
    in the SHIFT field of the immediatly following operand field.  */
2c2fa1
 #define PPC_OPERAND_OPTIONAL_VALUE (0x400000)
2c2fa1
+
2c2fa1
+/* This flag is only used with PPC_OPERAND_OPTIONAL.  The operand is
2c2fa1
+   only optional when generating 32-bit code.  */
2c2fa1
+#define PPC_OPERAND_OPTIONAL32 (0x800000)
2c2fa1
 
2c2fa1
 /* The POWER and PowerPC assemblers use a few macros.  We keep them
2c2fa1
    with the operands table for simplicity.  The macro table is an
2c2fa1
### a/opcodes/ChangeLog
2c2fa1
### b/opcodes/ChangeLog
2c2fa1
## -1,3 +1,19 @@
2c2fa1
+2016-09-29  Alan Modra  <amodra@gmail.com>
2c2fa1
+
2c2fa1
+	* ppc-opc.c (L): Make compulsory.
2c2fa1
+	(LOPT): New, optional form of L.
2c2fa1
+	(HTM_R): Define as LOPT.
2c2fa1
+	(L0, L1): Delete.
2c2fa1
+	(L32OPT): New, optional for 32-bit L.
2c2fa1
+	(L2OPT): New, 2-bit L for dcbf.
2c2fa1
+	(SVC_LEC): Update.
2c2fa1
+	(L2): Define.
2c2fa1
+	(insert_l0, extract_l0, insert_l1, extract_l2): Delete.
2c2fa1
+	(powerpc_opcodes <cmpli, cmpi, cmpl, cmp>): Use L32OPT.
2c2fa1
+	<dcbf>: Use L2OPT.
2c2fa1
+	<tlbiel, tlbie>: Use LOPT.
2c2fa1
+	<wclr, wclrall>: Use L2.
2c2fa1
+
2c2fa1
 2016-09-26  Vlad Zakharov  <vzakhar@synopsys.com>
2c2fa1
 
2c2fa1
 	* Makefile.in: Regenerate.
2c2fa1
--- a/opcodes/ppc-opc.c
2c2fa1
+++ b/opcodes/ppc-opc.c
2c2fa1
@@ -62,10 +62,6 @@ static unsigned long insert_dxdn (unsigned long, long, ppc_cpu_t, const char **)
2c2fa1
 static long extract_dxdn (unsigned long, ppc_cpu_t, int *);
2c2fa1
 static unsigned long insert_fxm (unsigned long, long, ppc_cpu_t, const char **);
2c2fa1
 static long extract_fxm (unsigned long, ppc_cpu_t, int *);
2c2fa1
-static unsigned long insert_l0 (unsigned long, long, ppc_cpu_t, const char **);
2c2fa1
-static long extract_l0 (unsigned long, ppc_cpu_t, int *);
2c2fa1
-static unsigned long insert_l1 (unsigned long, long, ppc_cpu_t, const char **);
2c2fa1
-static long extract_l1 (unsigned long, ppc_cpu_t, int *);
2c2fa1
 static unsigned long insert_li20 (unsigned long, long, ppc_cpu_t, const char **);
2c2fa1
 static long extract_li20 (unsigned long, ppc_cpu_t, int *);
2c2fa1
 static unsigned long insert_ls (unsigned long, long, ppc_cpu_t, const char **);
2c2fa1
@@ -429,20 +425,24 @@ const struct powerpc_operand powerpc_operands[] =
2c2fa1
 
2c2fa1
   /* The L field in a D or X form instruction.  */
2c2fa1
 #define L IMM20 + 1
2c2fa1
+  { 0x1, 21, NULL, NULL, 0 },
2c2fa1
+
2c2fa1
+  /* The optional L field in tlbie and tlbiel instructions.  */
2c2fa1
+#define LOPT L + 1
2c2fa1
   /* The R field in a HTM X form instruction.  */
2c2fa1
-#define HTM_R L
2c2fa1
+#define HTM_R LOPT
2c2fa1
   { 0x1, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
2c2fa1
 
2c2fa1
-  /* The L field in an X form instruction which must be zero.  */
2c2fa1
-#define L0 L + 1
2c2fa1
-  { 0x1, 21, insert_l0, extract_l0, PPC_OPERAND_OPTIONAL },
2c2fa1
+  /* The optional (for 32-bit) L field in cmp[l][i] instructions.  */
2c2fa1
+#define L32OPT LOPT + 1
2c2fa1
+  { 0x1, 21, NULL, NULL, PPC_OPERAND_OPTIONAL | PPC_OPERAND_OPTIONAL32 },
2c2fa1
 
2c2fa1
-  /* The L field in an X form instruction which must be one.  */
2c2fa1
-#define L1 L0 + 1
2c2fa1
-  { 0x1, 21, insert_l1, extract_l1, 0 },
2c2fa1
+  /* The L field in dcbf instruction.  */
2c2fa1
+#define L2OPT L32OPT + 1
2c2fa1
+  { 0x3, 21, NULL, NULL, PPC_OPERAND_OPTIONAL },
2c2fa1
 
2c2fa1
   /* The LEV field in a POWER SVC form instruction.  */
2c2fa1
-#define SVC_LEV L1 + 1
2c2fa1
+#define SVC_LEV L2OPT + 1
2c2fa1
   { 0x7f, 5, NULL, NULL, 0 },
2c2fa1
 
2c2fa1
   /* The LEV field in an SC form instruction.  */
2c2fa1
@@ -688,6 +688,8 @@ const struct powerpc_operand powerpc_operands[] =
2c2fa1
 #define STRM SR + 1
2c2fa1
   /* The T field in a tlbilx form instruction.  */
2c2fa1
 #define T STRM
2c2fa1
+  /* The L field in wclr instructions.  */
2c2fa1
+#define L2 STRM
2c2fa1
   { 0x3, 21, NULL, NULL, 0 },
2c2fa1
 
2c2fa1
   /* The ESYNC field in an X (sync) form instruction.  */
2c2fa1
@@ -1483,58 +1485,6 @@ extract_fxm (unsigned long insn,
2c2fa1
   return mask;
2c2fa1
 }
2c2fa1
 
2c2fa1
-/* The L field in an X form instruction which must have the value zero.  */
2c2fa1
-
2c2fa1
-static unsigned long
2c2fa1
-insert_l0 (unsigned long insn,
2c2fa1
-	   long value,
2c2fa1
-	   ppc_cpu_t dialect ATTRIBUTE_UNUSED,
2c2fa1
-	   const char **errmsg)
2c2fa1
-{
2c2fa1
-  if (value != 0)
2c2fa1
-    *errmsg = _("invalid operand constant");
2c2fa1
-  return insn & ~(0x1 << 21);
2c2fa1
-}
2c2fa1
-
2c2fa1
-static long
2c2fa1
-extract_l0 (unsigned long insn,
2c2fa1
-	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
2c2fa1
-	    int *invalid)
2c2fa1
-{
2c2fa1
-  long value;
2c2fa1
-
2c2fa1
-  value = (insn >> 21) & 0x1;
2c2fa1
-  if (value != 0)
2c2fa1
-    *invalid = 1;
2c2fa1
-  return value;
2c2fa1
-}
2c2fa1
-
2c2fa1
-/* The L field in an X form instruction which must have the value one.  */
2c2fa1
-
2c2fa1
-static unsigned long
2c2fa1
-insert_l1 (unsigned long insn,
2c2fa1
-	   long value,
2c2fa1
-	   ppc_cpu_t dialect ATTRIBUTE_UNUSED,
2c2fa1
-	   const char **errmsg)
2c2fa1
-{
2c2fa1
-  if (value != 1)
2c2fa1
-    *errmsg = _("invalid operand constant");
2c2fa1
-  return insn | (0x1 << 21);
2c2fa1
-}
2c2fa1
-
2c2fa1
-static long
2c2fa1
-extract_l1 (unsigned long insn,
2c2fa1
-	    ppc_cpu_t dialect ATTRIBUTE_UNUSED,
2c2fa1
-	    int *invalid)
2c2fa1
-{
2c2fa1
-  long value;
2c2fa1
-
2c2fa1
-  value = (insn >> 21) & 0x1;
2c2fa1
-  if (value != 1)
2c2fa1
-    *invalid = 1;
2c2fa1
-  return value;
2c2fa1
-}
2c2fa1
-
2c2fa1
 static unsigned long
2c2fa1
 insert_li20 (unsigned long insn,
2c2fa1
 	     long value,
2c2fa1
@@ -3890,12 +3840,12 @@ const struct powerpc_opcode powerpc_opcodes[] = {
2c2fa1
 
2c2fa1
 {"cmplwi",	OPL(10,0),	OPL_MASK,    PPCCOM,	PPCVLE,		{OBF, RA, UISIGNOPT}},
2c2fa1
 {"cmpldi",	OPL(10,1),	OPL_MASK,    PPC64,	PPCVLE,		{OBF, RA, UISIGNOPT}},
2c2fa1
-{"cmpli",	OP(10),		OP_MASK,     PPC,	PPCVLE,		{BF, L, RA, UISIGNOPT}},
2c2fa1
+{"cmpli",	OP(10),		OP_MASK,     PPC,	PPCVLE,		{BF, L32OPT, RA, UISIGNOPT}},
2c2fa1
 {"cmpli",	OP(10),		OP_MASK,     PWRCOM,	PPC|PPCVLE,	{BF, RA, UISIGNOPT}},
2c2fa1
 
2c2fa1
 {"cmpwi",	OPL(11,0),	OPL_MASK,    PPCCOM,	PPCVLE,		{OBF, RA, SI}},
2c2fa1
 {"cmpdi",	OPL(11,1),	OPL_MASK,    PPC64,	PPCVLE,		{OBF, RA, SI}},
2c2fa1
-{"cmpi",	OP(11),		OP_MASK,     PPC,	PPCVLE,		{BF, L, RA, SI}},
2c2fa1
+{"cmpi",	OP(11),		OP_MASK,     PPC,	PPCVLE,		{BF, L32OPT, RA, SI}},
2c2fa1
 {"cmpi",	OP(11),		OP_MASK,     PWRCOM,	PPC|PPCVLE,	{BF, RA, SI}},
2c2fa1
 
2c2fa1
 {"addic",	OP(12),		OP_MASK,     PPCCOM,	PPCVLE,		{RT, RA, SI}},
2c2fa1
@@ -4713,7 +4663,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
2c2fa1
 
2c2fa1
 {"cmpw",	XOPL(31,0,0),	XCMPL_MASK,  PPCCOM,	0,		{OBF, RA, RB}},
2c2fa1
 {"cmpd",	XOPL(31,0,1),	XCMPL_MASK,  PPC64,	0,		{OBF, RA, RB}},
2c2fa1
-{"cmp",		X(31,0),	XCMP_MASK,   PPC,	0,		{BF, L, RA, RB}},
2c2fa1
+{"cmp",		X(31,0),	XCMP_MASK,   PPC,	0,		{BF, L32OPT, RA, RB}},
2c2fa1
 {"cmp",		X(31,0),	XCMPL_MASK,  PWRCOM,	PPC,		{BF, RA, RB}},
2c2fa1
 
2c2fa1
 {"twlgt",	XTO(31,4,TOLGT), XTO_MASK,   PPCCOM,	0,		{RA, RB}},
2c2fa1
@@ -4821,7 +4771,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
2c2fa1
 
2c2fa1
 {"cmplw",	XOPL(31,32,0),	XCMPL_MASK,  PPCCOM,	0,		{OBF, RA, RB}},
2c2fa1
 {"cmpld",	XOPL(31,32,1),	XCMPL_MASK,  PPC64,	0,		{OBF, RA, RB}},
2c2fa1
-{"cmpl",	X(31,32),	XCMP_MASK,   PPC,	0,		{BF, L, RA, RB}},
2c2fa1
+{"cmpl",	X(31,32),	XCMP_MASK,   PPC,	0,		{BF, L32OPT, RA, RB}},
2c2fa1
 {"cmpl",	X(31,32),	XCMPL_MASK,  PWRCOM,	PPC,		{BF, RA, RB}},
2c2fa1
 
2c2fa1
 {"lvsr",	X(31,38),	X_MASK,	     PPCVEC,	0,		{VD, RA0, RB}},
2c2fa1
@@ -4907,7 +4857,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
2c2fa1
 {"ldarx",	X(31,84),	XEH_MASK,    PPC64,	0,		{RT, RA0, RB, EH}},
2c2fa1
 
2c2fa1
 {"dcbfl",	XOPL(31,86,1),	XRT_MASK,    POWER5,	PPC476,		{RA0, RB}},
2c2fa1
-{"dcbf",	X(31,86),	XLRT_MASK,   PPC,	0,		{RA0, RB, L}},
2c2fa1
+{"dcbf",	X(31,86),	XLRT_MASK,   PPC,	0,		{RA0, RB, L2OPT}},
2c2fa1
 
2c2fa1
 {"lbzx",	X(31,87),	X_MASK,	     COM,	0,		{RT, RA0, RB}},
2c2fa1
 
2c2fa1
@@ -5149,7 +5099,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
2c2fa1
 {"ehpriv",	X(31,270),	0xffffffff,  E500MC|PPCA2, 0,		{0}},
2c2fa1
 
2c2fa1
 {"tlbiel",	X(31,274),	X_MASK|1<<20,POWER9,	PPC476,		{RB, RSO, RIC, PRS, X_R}},
2c2fa1
-{"tlbiel",	X(31,274),	XRTLRA_MASK, POWER4,	POWER9|PPC476,	{RB, L}},
2c2fa1
+{"tlbiel",	X(31,274),	XRTLRA_MASK, POWER4,	POWER9|PPC476,	{RB, LOPT}},
2c2fa1
 
2c2fa1
 {"mfapidi",	X(31,275),	X_MASK,	     BOOKE,	E500|TITAN,	{RT, RA}},
2c2fa1
 
2c2fa1
@@ -5183,7 +5133,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
2c2fa1
 
2c2fa1
 {"tlbie",	X(31,306),	X_MASK|1<<20,POWER9,	TITAN,		{RB, RS, RIC, PRS, X_R}},
2c2fa1
 {"tlbie",	X(31,306),	XRA_MASK,    POWER7,	POWER9|TITAN,	{RB, RS}},
2c2fa1
-{"tlbie",	X(31,306),	XRTLRA_MASK, PPC,    E500|POWER7|TITAN,	{RB, L}},
2c2fa1
+{"tlbie",	X(31,306),	XRTLRA_MASK, PPC,    E500|POWER7|TITAN,	{RB, LOPT}},
2c2fa1
 {"tlbi",	X(31,306),	XRT_MASK,    POWER,	0,		{RA0, RB}},
2c2fa1
 
2c2fa1
 {"mfvsrld",	X(31,307),	XX1RB_MASK,  PPCVSX3,	0,		{RA, XS6}},
2c2fa1
@@ -6234,8 +6184,8 @@ const struct powerpc_opcode powerpc_opcodes[] = {
2c2fa1
 {"stvfrxl",	X(31,933),	X_MASK,	     PPCVEC2,	0,		{VS, RA0, RB}},
2c2fa1
 
2c2fa1
 {"wclrone",	XOPL2(31,934,2),XRT_MASK,    PPCA2,	0,		{RA0, RB}},
2c2fa1
-{"wclrall",	X(31,934),	XRARB_MASK,  PPCA2,	0,		{L}},
2c2fa1
-{"wclr",	X(31,934),	X_MASK,	     PPCA2,	0,		{L, RA0, RB}},
2c2fa1
+{"wclrall",	X(31,934),	XRARB_MASK,  PPCA2,	0,		{L2}},
2c2fa1
+{"wclr",	X(31,934),	X_MASK,	     PPCA2,	0,		{L2, RA0, RB}},
2c2fa1
 
2c2fa1
 {"stvrxl",	X(31,935),	X_MASK,	     CELL,	0,		{VS, RA0, RB}},
2c2fa1