This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATH] AMD MWAITX enablement
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: "Pawar, Amit" <Amit dot Pawar at amd dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>, Jan Beulich <JBeulich at suse dot com>
- Date: Thu, 25 Jun 2015 02:26:06 -0700
- Subject: Re: [PATH] AMD MWAITX enablement
- Authentication-results: sourceware.org; auth=none
- References: <0428E25D138CAA4D819A6FED9429E51AF4A29C at SCYBEXDAG02 dot amd dot com> <556D83DE02000078000800CE at mail dot emea dot novell dot com> <0428E25D138CAA4D819A6FED9429E51AF4A96C at SCYBEXDAG02 dot amd dot com> <55755AD50200007800081CE1 at mail dot emea dot novell dot com> <0428E25D138CAA4D819A6FED9429E51AF4CB28 at SCYBEXDAG02 dot amd dot com>
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.