[PATCH v2] x86: Support ZHAOXIN GMI instructions

Jiang, Haochen haochen.jiang@intel.com
Tue Oct 15 03:02:36 GMT 2024


> From: mayshao-oc <mayshao-oc@zhaoxin.com>
> Sent: Tuesday, October 15, 2024 9:19 AM
> 
> Hi all:
> 
>         Thanks for the very insightful comments of Jan hand haochen, I refine the
> patch.
>         Test ok, ok for trunk?

@@ -1050,6 +1051,9 @@ enum
   PREFIX_0F7D,
   PREFIX_0F7E,
   PREFIX_0F7F,
+  PREFIX_0FA6_REG_0_MOD_3,
+  PREFIX_0FA6_REG_5_MOD_3,
+  PREFIX_0FA7_REG_6_MOD_3,
   PREFIX_0FAE_REG_0_MOD_3,
   PREFIX_0FAE_REG_1_MOD_3,
   PREFIX_0FAE_REG_2_MOD_3,

I suppose the table entries here do not need _MOD_3 suffix since it did not use
mod_table[].

+  /* PREFIX_0FA6_REG_5_MOD_3 */
+  {
+    { Bad_Opcode },
+    { "sm3",	{ Skip_MODRM }, 0 },
+    { Bad_Opcode },
+    { Bad_Opcode },
+  },
+
+  /* PREFIX_0FA7_REG_6_MOD_3 */
+  {
+    { Bad_Opcode },
+    { "sm4",	{ Skip_MODRM }, 0 },
+    { Bad_Opcode },
+    { Bad_Opcode },
+  },
+

The Bad_Opcode could be omitted if they are at the end of
a table.

@@ -13086,6 +13118,21 @@ OP_0f07 (instr_info *ins, int bytemode, int sizeflag)
   return OP_E (ins, bytemode, sizeflag);
 }
 
+/* montmul instruction need display repz and skip modrm */
+
+static bool
+MONTMUL_Fixup (instr_info *ins, int bytemode, int sizeflag)
+{
+  (void) bytemode;
+  (void) sizeflag;

What are these two lines for? And you will need MODRM_CHECK;
and modrm.mod invalid check. You could take OP_Skip_MODRM
as reference.

+  /* The 0xf3 prefix should be displayed as "repz" for montmul. */
+  if (ins->prefixes & PREFIX_REPZ)
+    ins->all_prefixes[ins->last_repz_prefix] = 0xf3;
+  ins->codep++;
+  ins->has_skipped_modrm = true;
+  return true;
+}
+

I still don't know why original montmul will display repz prefix although
the testcase does show that. I checked the PadLock doc but got no clue
and even more confused. Could you explain why?

Also, in gas/NEWS, could you put the entry at the very beginning?

Thx,
Haochen

> 
> BR
> Mayshao


More information about the Binutils mailing list