[AArch64][SVE 20/32] Add support for tied operands
[deliverable/binutils-gdb.git] / opcodes / ppc-opc.c
index f3349e5ae2c44db040c7d1e2b9c68b55254000aa..1c6e9704d90c002b129aa4b66fe125c88fc19cdc 100644 (file)
@@ -238,7 +238,11 @@ const struct powerpc_operand powerpc_operands[] =
 #define BOE BO + 1
   { 0x1e, 21, insert_boe, extract_boe, 0 },
 
-#define BH BOE + 1
+  /* The RM field in an X form instruction.  */
+#define RM BOE + 1
+  { 0x3, 11, NULL, NULL, 0 },
+
+#define BH RM + 1
   { 0x3, 11, NULL, NULL, PPC_OPERAND_OPTIONAL },
 
   /* The BT field in an X or XL form instruction.  */
@@ -786,8 +790,9 @@ const struct powerpc_operand powerpc_operands[] =
 #define EVUIMM_8 EVUIMM_4 + 1
   { 0xf8, 8, NULL, NULL, PPC_OPERAND_PARENS },
 
-  /* The WS field.  */
+  /* The WS or DRM field in an X form instruction.  */
 #define WS EVUIMM_8 + 1
+#define DRM WS
   { 0x7, 11, NULL, NULL, 0 },
 
   /* PowerPC paired singles extensions.  */
@@ -2017,7 +2022,11 @@ insert_sh6 (unsigned long insn,
            ppc_cpu_t dialect ATTRIBUTE_UNUSED,
            const char **errmsg ATTRIBUTE_UNUSED)
 {
-  return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
+  /* SH6 operand in the rldixor instructions.  */
+  if (PPC_OP (insn) == 4)
+    return insn | ((value & 0x1f) << 6) | ((value & 0x20) >> 5);
+  else
+    return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
 }
 
 static long
@@ -2025,7 +2034,11 @@ extract_sh6 (unsigned long insn,
             ppc_cpu_t dialect ATTRIBUTE_UNUSED,
             int *invalid ATTRIBUTE_UNUSED)
 {
-  return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
+  /* SH6 operand in the rldixor instructions.  */
+  if (PPC_OP (insn) == 4)
+    return ((insn >> 6) & 0x1f) | ((insn << 5) & 0x20);
+  else
+    return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
 }
 
 /* The SPR field in an XFX form instruction.  This is flipped--the
@@ -2361,6 +2374,12 @@ extract_vleil (unsigned long insn,
 #define OPVUP(x,vup) (OP (x) | ((((unsigned long)(vup)) & 0xff) << 8))
 #define OPVUP_MASK OPVUP (0x3f,  0xff)
 
+/* The main opcode combined with an update code and the RT fields specified in
+   D form instruction.  Used for VLE volatile context save/restore
+   instructions.  */
+#define OPVUPRT(x,vup,rt) (OPVUP (x, vup) | ((((unsigned long)(rt)) & 0x1f) << 21))
+#define OPVUPRT_MASK OPVUPRT (0x3f, 0xff, 0x1f)
+
 /* An A form instruction.  */
 #define A(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1) | (((unsigned long)(rc)) & 1))
 #define A_MASK A (0x3f, 0x1f, 1)
@@ -2608,6 +2627,9 @@ extract_vleil (unsigned long insn,
 /* A VX form instruction with a VA tertiary opcode.  */
 #define VXVA(op, xop, vaop) (VX(op,xop) | (((vaop) & 0x1f) << 16))
 
+#define VXASH(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1))
+#define VXASH_MASK VXASH (0x3f, 0x1f)
+
 /* An X form instruction.  */
 #define X(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1))
 
@@ -2644,6 +2666,9 @@ extract_vleil (unsigned long insn,
 /* A X form instruction for Quad-Precision FP Instructions with RC bit.  */
 #define XVARC(op, xop, vaop, rc) (XVA ((op), (xop), (vaop)) | ((rc) & 1))
 
+/* An X form instruction with the RA bits specified as two ops.  */
+#define XMMF(op, xop, mop0, mop1) (X ((op), (xop)) | ((mop0) & 3) << 19 | ((mop1) & 7) << 16)
+
 /* A Z form instruction with the RC bit specified.  */
 #define ZRC(op, xop, rc) (Z ((op), (xop)) | ((rc) & 1))
 
@@ -2696,6 +2721,9 @@ extract_vleil (unsigned long insn,
 /* An X form wait instruction with everything filled in except the WC field.  */
 #define XWC_MASK (XRC (0x3f, 0x3ff, 1) | (7 << 23) | RA_MASK | RB_MASK)
 
+/* The mask for an XMMF form instruction.  */
+#define XMMF_MASK (XMMF (0x3f, 0x3ff, 3, 7) | (1))
+
 /* The mask for a Z form instruction.  */
 #define Z_MASK ZRC (0x3f, 0x1ff, 1)
 #define Z2_MASK ZRC (0x3f, 0xff, 1)
@@ -3033,6 +3061,7 @@ extract_vleil (unsigned long insn,
 #define E6500  PPC_OPCODE_E6500
 #define PPCVLE  PPC_OPCODE_VLE
 #define PPCHTM  PPC_OPCODE_HTM
+#define E200Z4  PPC_OPCODE_E200Z4
 /* The list of embedded processors that use the embedded operand ordering
    for the 3 operand dcbt and dcbtst instructions.  */
 #define DCBT_EO        (PPC_OPCODE_E500 | PPC_OPCODE_E500MC | PPC_OPCODE_476 \
@@ -4918,7 +4947,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 
 {"dcbfep",     XRT(31,127,0),  XRT_MASK, E500MC|PPCA2, 0,              {RA0, RB}},
 
-{"setb",       X(31,128),    XRB_MASK|(3<<16), POWER9, 0,              {RT, BFA}},
+{"setb",       X(31,128),      XRB_MASK|(3<<16), POWER9, 0,            {RT, BFA}},
 
 {"wrtee",      X(31,131), XRARB_MASK, PPC403|BOOKE|PPCA2|PPC476, 0,    {RS}},
 
@@ -4980,7 +5009,6 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 {"sthfcmx",    APU(31,167,0),  APU_MASK,    PPC405,    0,              {FCRT, RA, RB}},
 
 {"addex",      ZRC(31,170,0),  Z2_MASK,     POWER9,    0,              {RT, RA, RB, CY}},
-{"addex.",     ZRC(31,170,1),  Z2_MASK,     POWER9,    0,              {RT, RA, RB, CY}},
 
 {"msgclrp",    XRTRA(31,174,0,0), XRTRA_MASK, POWER8,  0,              {RB}},
 {"dcbtlse",    X(31,174),      X_MASK,      PPCCHLK,   E500MC,         {CT, RA0, RB}},
@@ -5509,8 +5537,6 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 
 {"mtvsrdd",    X(31,435),      XX1_MASK,    PPCVSX3,   0,              {XT6, RA0, RB}},
 
-{"lwzmx",      X(31,437),      X_MASK,      POWER9,    0,              {RT, RA0, RB}},
-
 {"ecowx",      X(31,438),      X_MASK,      PPC,       E500|TITAN,     {RT, RA0, RB}},
 
 {"sthux",      X(31,439),      X_MASK,      COM,       0,              {RS, RAS, RB}},
@@ -5783,6 +5809,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 
 {"mcrxr",      X(31,512),      XBFRARB_MASK, COM,      POWER7,         {BF}},
 
+{"lbdcbx",     X(31,514),      X_MASK,      E200Z4,    0,              {RT, RA, RB}},
 {"lbdx",       X(31,515),      X_MASK,      E500MC,    0,              {RT, RA, RB}},
 
 {"bblels",     X(31,518),      X_MASK,      PPCBRLK,   0,              {0}},
@@ -5833,6 +5860,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 {"maskir",     XRC(31,541,0),  X_MASK,      M601,      0,              {RA, RS, RB}},
 {"maskir.",    XRC(31,541,1),  X_MASK,      M601,      0,              {RA, RS, RB}},
 
+{"lhdcbx",     X(31,546),      X_MASK,      E200Z4,    0,              {RT, RA, RB}},
 {"lhdx",       X(31,547),      X_MASK,      E500MC,    0,              {RT, RA, RB}},
 
 {"lvtrx",      X(31,549),      X_MASK,      PPCVEC2,   0,              {VD, RA0, RB}},
@@ -5856,6 +5884,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 
 {"mcrxrx",     X(31,576),     XBFRARB_MASK, POWER9,    0,              {BF}},
 
+{"lwdcbx",     X(31,578),      X_MASK,      E200Z4,    0,              {RT, RA, RB}},
 {"lwdx",       X(31,579),      X_MASK,      E500MC,    0,              {RT, RA, RB}},
 
 {"lvtlx",      X(31,581),      X_MASK,      PPCVEC2,   0,              {VD, RA0, RB}},
@@ -5874,8 +5903,8 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 {"hwsync",     XSYNC(31,598,0), 0xffffffff, POWER4,    BOOKE|PPC476,   {0}},
 {"lwsync",     XSYNC(31,598,1), 0xffffffff, PPC,       E500,           {0}},
 {"ptesync",    XSYNC(31,598,2), 0xffffffff, PPC64,     0,              {0}},
-{"sync",       X(31,598),     XSYNCLE_MASK, POWER9|E6500, 0,           {LS, ESYNC}},
-{"sync",       X(31,598),     XSYNC_MASK, PPCCOM, BOOKE|PPC476|POWER9, {LS}},
+{"sync",       X(31,598),     XSYNCLE_MASK, E6500,     0,              {LS, ESYNC}},
+{"sync",       X(31,598),     XSYNC_MASK,   PPCCOM,    BOOKE|PPC476,   {LS}},
 {"msync",      X(31,598),     0xffffffff, BOOKE|PPCA2|PPC476, 0,       {0}},
 {"sync",       X(31,598),     0xffffffff,   BOOKE|PPC476, E6500,       {0}},
 {"lwsync",     X(31,598),     0xffffffff,   E500,      0,              {0}},
@@ -5906,6 +5935,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 
 {"lfdux",      X(31,631),      X_MASK,      COM,       PPCEFS,         {FRT, RAS, RB}},
 
+{"stbdcbx",    X(31,642),      X_MASK,      E200Z4,    0,              {RS, RA, RB}},
 {"stbdx",      X(31,643),      X_MASK,      E500MC,    0,              {RS, RA, RB}},
 
 {"stvlx",      X(31,647),      X_MASK,      CELL,      0,              {VS, RA0, RB}},
@@ -5943,6 +5973,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 {"sre",                XRC(31,665,0),  X_MASK,      M601,      0,              {RA, RS, RB}},
 {"sre.",       XRC(31,665,1),  X_MASK,      M601,      0,              {RA, RS, RB}},
 
+{"sthdcbx",    X(31,674),      X_MASK,      E200Z4,    0,              {RS, RA, RB}},
 {"sthdx",      X(31,675),      X_MASK,      E500MC,    0,              {RS, RA, RB}},
 
 {"stvfrx",     X(31,677),      X_MASK,      PPCVEC2,   0,              {VS, RA0, RB}},
@@ -5960,6 +5991,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 {"sriq",       XRC(31,696,0),  X_MASK,      M601,      0,              {RA, RS, SH}},
 {"sriq.",      XRC(31,696,1),  X_MASK,      M601,      0,              {RA, RS, SH}},
 
+{"stwdcbx",    X(31,706),      X_MASK,      E200Z4,    0,              {RS, RA, RB}},
 {"stwdx",      X(31,707),      X_MASK,      E500MC,    0,              {RS, RA, RB}},
 
 {"stvflx",     X(31,709),      X_MASK,      PPCVEC2,   0,              {VS, RA0, RB}},
@@ -6040,8 +6072,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 
 {"lvsm",       X(31,773),      X_MASK,      PPCVEC2,   0,              {VD, RA0, RB}},
 
-{"copy_first", XOPL(31,774,1), XRT_MASK,    POWER9,    0,              {RA0, RB}},
-{"copy",       X(31,774),      XLRT_MASK,   POWER9,    0,              {RA0, RB, L}},
+{"copy",       XOPL(31,774,1), XRT_MASK,    POWER9,    0,              {RA0, RB}},
 
 {"stvepxl",    X(31,775),      X_MASK,      PPCVEC2,   0,              {VS, RA0, RB}},
 {"lvlxl",      X(31,775),      X_MASK,      CELL,      0,              {VD, RA0, RB}},
@@ -6111,7 +6142,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 
 {"lvtlxl",     X(31,837),      X_MASK,      PPCVEC2,   0,              {VD, RA0, RB}},
 
-{"cp_abort",   X(31,838),      XRTRARB_MASK,POWER9,    0,              {0}},
+{"cpabort",    X(31,838),      XRTRARB_MASK,POWER9,    0,              {0}},
 
 {"divo",       XO(31,331,1,0), XO_MASK,     M601,      0,              {RT, RA, RB}},
 {"divo.",      XO(31,331,1,1), XO_MASK,     M601,      0,              {RT, RA, RB}},
@@ -6123,6 +6154,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 
 {"tlbsrx.",    XRC(31,850,1),  XRT_MASK,    PPCA2,     0,              {RA0, RB}},
 
+{"slbiag",     X(31,850),      XRARB_MASK,  POWER9,    0,              {RS}},
 {"slbmfev",    X(31,851),      XRLA_MASK,   POWER9,    0,              {RT, RB, A_L}},
 {"slbmfev",    X(31,851),      XRA_MASK,    PPC64,     POWER9,         {RT, RB}},
 
@@ -6158,9 +6190,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 {"extswsli",   XS(31,445,0),   XS_MASK,     POWER9,    0,              {RA, RS, SH6}},
 {"extswsli.",  XS(31,445,1),   XS_MASK,     POWER9,    0,              {RA, RS, SH6}},
 
-{"paste",      XRC(31,902,0),  XLRT_MASK,   POWER9,    0,              {RA0, RB, L0}},
-{"paste_last", XRCL(31,902,1,1),XRT_MASK,   POWER9,    0,              {RA0, RB}},
-{"paste.",     XRC(31,902,1),  XLRT_MASK,   POWER9,    0,              {RA0, RB, L1}},
+{"paste.",     XRCL(31,902,1,1),XRT_MASK,   POWER9,    0,              {RA0, RB}},
 
 {"stvlxl",     X(31,903),      X_MASK,      CELL,      0,              {VS, RA0, RB}},
 {"stdfcmux",   APU(31,903,0),  APU_MASK,    PPC405,    0,              {FCRT, RA, RB}},
@@ -6914,6 +6944,13 @@ const struct powerpc_opcode powerpc_opcodes[] = {
 {"mffs",       XRC(63,583,0),  XRARB_MASK,  COM,       PPCEFS|PPCVLE,  {FRT}},
 {"mffs.",      XRC(63,583,1),  XRARB_MASK,  COM,       PPCEFS|PPCVLE,  {FRT}},
 
+{"mffsce",     XMMF(63,583,0,1), XMMF_MASK|RB_MASK, POWER9, PPCVLE,    {FRT}},
+{"mffscdrn",   XMMF(63,583,2,4), XMMF_MASK,         POWER9, PPCVLE,    {FRT, FRB}},
+{"mffscdrni",  XMMF(63,583,2,5), XMMF_MASK|(3<<14), POWER9, PPCVLE,    {FRT, DRM}},
+{"mffscrn",    XMMF(63,583,2,6), XMMF_MASK,         POWER9, PPCVLE,    {FRT, FRB}},
+{"mffscrni",   XMMF(63,583,2,7), XMMF_MASK|(7<<13), POWER9, PPCVLE,    {FRT, RM}},
+{"mffsl",      XMMF(63,583,3,0), XMMF_MASK|RB_MASK, POWER9, PPCVLE,    {FRT}},
+
 {"dcmpuq",     X(63,642),      X_MASK,      POWER6,    PPCVLE,         {BF, FRAp, FRBp}},
 
 {"xscmpuqp",   X(63,644),      XBF_MASK,    PPCVSX3,   PPCVLE,         {BF, VA, VB}},
@@ -7031,7 +7068,9 @@ const struct powerpc_opcode vle_opcodes[] = {
 {"se_cmphl",   SE_RR(3,3),     SE_RR_MASK,     PPCVLE, 0,              {RX, RY}},
 
 {"e_cmpi",     SCI8BF(6,0,21), SCI8BF_MASK,    PPCVLE, 0,              {CRD32, RA, SCLSCI8}},
+{"e_cmpwi",    SCI8BF(6,0,21), SCI8BF_MASK,    PPCVLE, 0,              {CRD32, RA, SCLSCI8}},
 {"e_cmpli",    SCI8BF(6,1,21), SCI8BF_MASK,    PPCVLE, 0,              {CRD32, RA, SCLSCI8}},
+{"e_cmplwi",   SCI8BF(6,1,21), SCI8BF_MASK,    PPCVLE, 0,              {CRD32, RA, SCLSCI8}},
 {"e_addi",     SCI8(6,16),     SCI8_MASK,      PPCVLE, 0,              {RT, RA, SCLSCI8}},
 {"e_subi",     SCI8(6,16),     SCI8_MASK,      PPCVLE, 0,              {RT, RA, SCLSCI8N}},
 {"e_addi.",    SCI8(6,17),     SCI8_MASK,      PPCVLE, 0,              {RT, RA, SCLSCI8}},
@@ -7058,6 +7097,16 @@ const struct powerpc_opcode vle_opcodes[] = {
 {"e_sthu",     OPVUP(6,5),     OPVUP_MASK,     PPCVLE, 0,              {RT, D8, RA0}},
 {"e_stwu",     OPVUP(6,6),     OPVUP_MASK,     PPCVLE, 0,              {RT, D8, RA0}},
 {"e_stmw",     OPVUP(6,9),     OPVUP_MASK,     PPCVLE, 0,              {RT, D8, RA0}},
+{"e_ldmvgprw", OPVUPRT(6,16,0),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
+{"e_stmvgprw", OPVUPRT(6,17,0),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
+{"e_ldmvsprw", OPVUPRT(6,16,1),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
+{"e_stmvsprw", OPVUPRT(6,17,1),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
+{"e_ldmvsrrw", OPVUPRT(6,16,4),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
+{"e_stmvsrrw", OPVUPRT(6,17,4),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
+{"e_ldmvcsrrw",        OPVUPRT(6,16,5),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
+{"e_stmvcsrrw",        OPVUPRT(6,17,5),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
+{"e_ldmvdsrrw",        OPVUPRT(6,16,6),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
+{"e_stmvdsrrw",        OPVUPRT(6,17,6),OPVUPRT_MASK,   PPCVLE, 0,              {D8, RA0}},
 {"e_add16i",   OP(7),          OP_MASK,        PPCVLE, 0,              {RT, RA, SI}},
 {"e_la",       OP(7),          OP_MASK,        PPCVLE, 0,              {RT, D, RA0}},
 {"e_sub16i",   OP(7),          OP_MASK,        PPCVLE, 0,              {RT, RA, NSI}},
@@ -7105,10 +7154,8 @@ const struct powerpc_opcode vle_opcodes[] = {
 {"e_cmphl16i", IA16(28,23),    IA16_MASK,      PPCVLE, 0,              {RA, VLEUIMM}},
 {"e_cmph16i",  IA16(28,22),    IA16_MASK,      PPCVLE, 0,              {RA, VLESIMM}},
 {"e_cmpl16i",  I16A(28,21),    I16A_MASK,      PPCVLE, 0,              {RA, VLEUIMM}},
-{"e_cmplwi",   I16A(28,21),    I16A_MASK,      PPCVLE, 0,              {RA, VLESIMM}},
 {"e_mull2i",   I16A(28,20),    I16A_MASK,      PPCVLE, 0,              {RA, VLESIMM}},
 {"e_cmp16i",   IA16(28,19),    IA16_MASK,      PPCVLE, 0,              {RA, VLESIMM}},
-{"e_cmpwi",    IA16(28,19),    IA16_MASK,      PPCVLE, 0,              {RA, VLESIMM}},
 {"e_sub2is",   I16A(28,18),    I16A_MASK,      PPCVLE, 0,              {RA, VLENSIMM}},
 {"e_add2is",   I16A(28,18),    I16A_MASK,      PPCVLE, 0,              {RA, VLESIMM}},
 {"e_sub2i.",   I16A(28,17),    I16A_MASK,      PPCVLE, 0,              {RA, VLENSIMM}},
This page took 0.031899 seconds and 4 git commands to generate.