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: [PATCH 02/13] x86: drop ShortForm attribute


On Wed, Oct 30, 2019 at 1:23 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> It is very simple to derive from other template properties, and hence
> there's little point wasting storage for it.
>
> gas/
> 2019-10-XX  Jan Beulich  <jbeulich@suse.com>
>
>         * config/tc-i386.c (process_immext): Also set i.tm.operands to
>         zero.
>         (optimize_encoding): Drop use of shortform field.
>         (is_short_form): New.
>         (process_suffix, process_operands): Use it to replace use of
>         shortform field.
>
> opcodes/
> 2019-10-XX  Jan Beulich  <jbeulich@suse.com>
>
>         * i386-gen.c (opcode_modifiers): Remove ShortForm entry.
>         * i386-opc.h (ShortForm): Delete.
>         (struct i386_opcode_modifier): Remove shortform field.
>         * i386-opc.tbl (mov, movabs, push, pop, xchg, inc, dec, fld,
>         fst, fstp, fxch, fcom, fcomp, fucom, fucomp, fadd, faddp, fsub,
>         fsubp, fsubr, fsubrp, fmul, fmulp, fdiv, fdivp, fdivr, fdivrp,
>         ffreep, bswap, fcmov*, fcomi, fcomip, fucomi, fucomip, movq):
>         Drop ShortForm.
>         * i386-tbl.h: Re-generate.
>
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -3842,6 +3842,7 @@ process_immext (void)
>                   i.tm.name);
>
>        i.operands = 0;
> +      i.tm.operands = 0;
>      }
>
>    if (i.tm.cpu_flags.bitfield.cpumwaitx && i.operands > 0)
> @@ -3870,6 +3871,7 @@ bad_register_operand:
>         }
>
>        i.operands = 0;
> +      i.tm.operands = 0;
>      }
>
>    /* These AMD 3DNow! and SSE2 instructions have an opcode suffix
> @@ -4034,7 +4036,6 @@ optimize_encoding (void)
>               i.tm.base_opcode = 0xb8;
>               i.tm.extension_opcode = None;
>               i.tm.opcode_modifier.w = 0;
> -             i.tm.opcode_modifier.shortform = 1;
>               i.tm.opcode_modifier.modrm = 0;
>             }
>         }
> @@ -6208,6 +6209,21 @@ check_string (void)
>    return 1;
>  }
>
> +static bfd_boolean
> +is_short_form (const insn_template *t)
> +{
> +  unsigned int op, num_reg;
> +
> +  if (t->opcode_modifier.modrm || t->operands > 2)
> +    return FALSE;
> +
> +  for (num_reg = op = 0; op < t->operands; ++op)
> +    if (t->operand_types[op].bitfield.reg)
> +      ++num_reg;
> +
> +  return num_reg == 1;
> +}
> +

So this replaces a bit check with a function.   What is the real advantage?

-- 
H.J.


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