This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATH] AMD MWAITX enablement


PFA MWAITX fixed patch. OK to apply?

-----Original Message-----
From: H.J. Lu [mailto:hjl.tools@gmail.com] 
Sent: Thursday, June 25, 2015 2:56 PM
To: Pawar, Amit
Cc: binutils@sourceware.org; Jan Beulich
Subject: Re: [PATH] AMD MWAITX enablement

On Thu, Jun 25, 2015 at 12:55 AM, Pawar, Amit <Amit.Pawar@amd.com> wrote:
> PFA MWAITX rebase patch without generated header files. Is ok to apply?
>
> Regards,
> Amit

+  if (i.tm.cpu_flags.bitfield.cpumwaitx && i.operands > 0)
+    {
+      /* MONITORX/MWAITX instructions have fixed operands with an opcode
+         suffix which is coded in the same place as an 8-bit immediate field
+         would be.
+ Here we check those operands and remove them afterwards.  */
^^^^
Align it with "would be".

+      unsigned int x;
+
+      if (strcmp(i.tm.name, "mwaitx") == 0)
+      {
+        x = 0;
+        if (register_number (i.op[x].regs) != x)
+          as_bad (_("can't use register '%s%s' as operand %d in '%s'."),
+                  register_prefix, i.op[x].regs->reg_name, x + 1,
+                  i.tm.name);
+
+        x++;
+        if (register_number (i.op[x].regs) != x)
+          as_bad (_("can't use register '%s%s' as operand %d in '%s'."),
+                  register_prefix, i.op[x].regs->reg_name, x + 1,
+                  i.tm.name);
+
+        x++;
+        if (register_number (i.op[x].regs) != x+1)
+          as_bad (_("can't use register '%s%s' as operand %d in '%s'."),
+                  register_prefix, i.op[x].regs->reg_name, x + 1,
+                  i.tm.name);
+
+      }
+      else
+      {
+        for (x = 0; x < i.operands; x++)
+          if (register_number (i.op[x].regs) != x)
+            as_bad (_("can't use register '%s%s' as operand %d in '%s'."),
+                    register_prefix, i.op[x].regs->reg_name, x + 1,
+                    i.tm.name);
+      }
+
+      i.operands = 0;
+    }
+

Please use a single for loop and fix indentation like

if (
  {
     if (
       {


H.J.
static void
+OP_Mwaitx (int bytemode ATTRIBUTE_UNUSED,
+  int sizeflag ATTRIBUTE_UNUSED)
+{
+  /* mwait %eax,%ecx  */
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Please fix comments.

+  if (!intel_syntax)
+    {
+      const char **names = (address_mode == mode_64bit
+    ? names64 : names32);
+      strcpy (op_out[0], names[0]);
+      strcpy (op_out[1], names[1]);
+      strcpy (op_out[2], names[3]);
+      two_source_ops = 1;
+    }
+  /* Skip mod/rm byte.  */
+  MODRM_CHECK;
+  codep++;
+}
+

-- 
H.J.

Attachment: mwaitx_v3.patch.bz2
Description: mwaitx_v3.patch.bz2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]