[PATCH] x86/APX: drop %SW disassembler macro again

Jiang, Haochen haochen.jiang@intel.com
Tue Aug 27 07:08:44 GMT 2024


> From: Jan Beulich <jbeulich@suse.com>
> Sent: Monday, August 26, 2024 6:14 PM
> 
> On 26.08.2024 10:41, Jiang, Haochen wrote:
> >> From: Jan Beulich <jbeulich@suse.com>
> >> Sent: Friday, August 23, 2024 6:44 PM
> >>
> >> Not the least due to its extremely rare use I didn't really like that macro's
> >> introduction. Adjust swap_operand() accordingly instead.
> >>
> >> --- a/opcodes/i386-dis.c
> >> +++ b/opcodes/i386-dis.c
> >> @@ -1809,8 +1809,6 @@ struct dis386 {
> >>  	   in MAP4.
> >>     "ZU" => print 'zu' if EVEX.ZU=1.
> >>     "SC" => print suffix SCC for SCC insns
> >> -   "SW" => print '.s' to indicate operands were swapped when suffix_always
> is
> >> -	   true.
> >>     "YK" keep unused, to avoid ambiguity with the combined use of Y and K.
> >>     "YX" keep unused, to avoid ambiguity with the combined use of Y and X.
> >>     "LQ" => print 'l' ('d' in Intel mode) or 'q' for memory operand, cond @@ -
> >> 10251,9 +10249,21 @@ static const char *const scc_suffix[16]  static void
> >> swap_operand (instr_info *ins)  {
> >> -  ins->mnemonicendp[0] = '.';
> >> -  ins->mnemonicendp[1] = 's';
> >> -  ins->mnemonicendp[2] = '\0';
> >> +  char *p = ins->mnemonicendp;
> >> +
> >> +  if (p[-1] == '}')
> >> +    {
> >> +      while (*--p != '{')
> >
> > If I remember correctly, which is once mentioned in your review, moving
> > mnemonic pointer backwards is not recommended.
> >
> > Should we break this rule to eliminate the macro?
> 
> I wouldn't call this a "rule". To me the question is where this is done,
> and whether all special cases are covered. Doing so centrally in
> swap_operand() looks okay(ish) to me.

I c, then go ahead.

Thx,
Haochen

> 
> Jan


More information about the Binutils mailing list