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 05.11.2019 15:58, Michael Matz wrote:
> Hi,
> 
> On Mon, 4 Nov 2019, H.J. Lu wrote:
> 
>>>>> +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?
>>>
>>> Space savings - one bit per template, which sums up with the large
>>> number of templates there are.
>>>
>>
>> Is that really necessary?
> 
> If I may add an opinion: to me the memory space savings in the tables 
> aren't the important part, but rather the savings in textual clutter in 
> i386-opc.tbl.  The latter makes it so that it's very easy to overlook 
> something (either the attribute missing, or invalidly there for certain 
> instructions), so everything that can be instead computed (quickly) from 
> other information should be computed.

The memory space savings aren't the primary aspect when thinking of
space savings - it's rather the better cache utilization that I view
as relevant. (The memory size reduction is welcome to me nevertheless,
since I don't think software has to only ever grow in size.)

> FWIW, whenever I look at that file and see the usual marvel
> 
>   No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf
> 
> I cringe, and wonder why it isn't simply No_bwlsqldSuf (or, in this 
> specific case 'No_Suf' as these are all No_?Suf flags).  Now, back to 
> under my stone :)

I'd go a more radical (and sufficiently simple) step as a first move:
No instruction allowing for all suffixes, what about making i386-gen
simply set all 6 bits when it finds a template to not have any No_*Suf
at all? This would make for a significant readability improvement with
relatively little effort. Thoughts?

Jan


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