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

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