public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Pawar, Amit" <Amit.Pawar@amd.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: "binutils@sourceware.org" <binutils@sourceware.org>,
	Jan Beulich	<JBeulich@suse.com>
Subject: RE: [PATH] AMD MWAITX enablement
Date: Fri, 26 Jun 2015 16:26:00 -0000	[thread overview]
Message-ID: <0428E25D138CAA4D819A6FED9429E51AF4CC6E@SCYBEXDAG02.amd.com> (raw)
In-Reply-To: <CAMe9rOp0ELpkHcapKMEid7Egr0+N70L9TscitPXNg0od3OffJw@mail.gmail.com>



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

Please don't top post.
[Pawar, Amit] Thank you and will take care. Please check inline comments.

On Fri, Jun 26, 2015 at 8:00 AM, Pawar, Amit <Amit.Pawar@amd.com> wrote:
>
> Comments are fixed and please suggest how to allow following instructions without operands
>
> --- Required ----
> label:
> monitorx
> mwaitx
> --------------------
>
> ---- Accepted----
> monitorx %eax, %ecx, %edx
> mwaitx %eax, %ecx, %ebx
> --------------------
> by adding following code
>
> if (i.operands != 3)
>   abort ();
>
>
> -----Original Message-----
> From: H.J. Lu [mailto:hjl.tools@gmail.com]
> Sent: Friday, June 26, 2015 5:26 PM
> To: Pawar, Amit
> Cc: binutils@sourceware.org; Jan Beulich
> Subject: Re: [PATH] AMD MWAITX enablement
>
> On Fri, Jun 26, 2015 at 4:09 AM, Pawar, Amit <Amit.Pawar@amd.com> wrote:
>>
>> Operand check is required at that line as instructions MONITORX/MWAITX are accepted without operands also.
>
> Add

You have

if (i.tm.cpu_flags.bitfield.cpumwaitx && i.operands > 0)
  {
....
  }
[Pawar, Amit] This condition was included to handle mwaitx cpu instructions with more than zero 
operands and skips for zero operands.

If i.operands == 0, you won't reach
>[Pawar, Amit] Zero operands instruction are allowed but should not enter here as it will get 
handled by normal code.

if (i.operands != 3)
  abort ();
[Pawar, Amit] Will throw error for zero operand instructions, as this is inside if case and which is 
not required here.

Am I missing something?
[Pawar, Amit] Please let me know if you need any more information.

> if (i.operands != 3)
> abort ();
>
> +      for (x = 0; x < 2; x++)
> +        {
>           ^^^ Remove it.
>
> +          if (register_number (i.op[x].regs) != x)
>
> Use
>                 goto bad_register_operand;
>
> +            {
> +              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);
> +            }
> +        }
> +
> +      /* Check for third operand for mwaitx/monitorx insn*/
> +      if ( register_number (i.op[2].regs) != 2 +
> (i.tm.extension_opcode == 0xfb))
>             ^ Remove extra space.
>
> This line is too lone. Please break it into 2 lines:
>
> if (register_number (i.op[x].regs)
>     != x + (i.tm.extension_opcode == 0xfb))
>
> +        {
>
> Add a label here
>
> bad_register_operand:
> +          as_bad (_("can't use register '%s%s' as operand %d in '%s'."),
> +                  register_prefix, i.op[x].regs->reg_name, 3,
>
>         ^^^ Change it to x + 1.
> +                  i.tm.name);
> +        }
> +
> +      i.operands = 0;
> +    }
>
>>
>> -----Original Message-----
>> From: H.J. Lu [mailto:hjl.tools@gmail.com]
>> Sent: Friday, June 26, 2015 3:34 PM
>> To: Pawar, Amit
>> Cc: binutils@sourceware.org; Jan Beulich
>> Subject: Re: [PATH] AMD MWAITX enablement
>>
>> On Thu, Jun 25, 2015 at 10:46 PM, Pawar, Amit <Amit.Pawar@amd.com> wrote:
>>> PFA MWAITX fixed patch. OK to apply?
>>>
>>
>> Please change the operand check to
>>
>> if (i.tm.cpu_flags.bitfield.cpumwaitx)
>> {
>>   if ( i.operands != 3)
>> abort
>>
>> for (i = 0, i< 2; i++)
>> ...
>>
>> if (register_number (i.op[2].regs) != 2 + (opcode ==mwaitx ) ...
>> }
>>
>> --
>> H.J.
>
>
>
> --
> H.J.



-- 
H.J.

  reply	other threads:[~2015-06-26 16:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02  6:56 Pawar, Amit
2015-06-02  8:22 ` Jan Beulich
2015-06-02 13:35   ` Pawar, Amit
2015-06-08  6:16   ` Pawar, Amit
2015-06-08  7:05     ` Jan Beulich
2015-06-10  9:37       ` Pawar, Amit
2015-06-25  7:55       ` Pawar, Amit
2015-06-25  9:26         ` H.J. Lu
2015-06-26  5:46           ` Pawar, Amit
2015-06-26 10:04             ` H.J. Lu
2015-06-26 11:09               ` Pawar, Amit
2015-06-26 11:55                 ` H.J. Lu
2015-06-26 15:00                   ` Pawar, Amit
2015-06-26 15:04                     ` H.J. Lu
2015-06-26 16:26                       ` Pawar, Amit [this message]
2015-06-26 16:30                         ` H.J. Lu
2015-06-26 16:33                           ` Pawar, Amit
2015-06-26 16:39                           ` Pawar, Amit
2015-06-26 16:43                             ` H.J. Lu
2015-06-26 16:52                               ` Pawar, Amit
2015-06-26 18:02                                 ` Andreas Schwab
2015-06-27  5:20                                   ` Pawar, Amit
2015-06-30  6:58                                   ` Pawar, Amit
2015-06-30 14:53                                     ` H.J. Lu
2015-06-30 15:39                                       ` Pawar, Amit
2015-06-26 17:06                               ` Pawar, Amit
2015-06-26 17:08                                 ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0428E25D138CAA4D819A6FED9429E51AF4CC6E@SCYBEXDAG02.amd.com \
    --to=amit.pawar@amd.com \
    --cc=JBeulich@suse.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).