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


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

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.

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