RFD: hookizing BITS_PER_UNIT in tree optimizers / frontends
Joern Rennecke
amylaar@spamcop.net
Wed Nov 24 14:33:00 GMT 2010
Quoting Pedro Alves <pedro@codesourcery.com>:
> On Tuesday 23 November 2010 20:09:52, Joern Rennecke wrote:
>> If we changed BITS_PER_UNIT into an ordinary piece-of-data 'hook', this
>> would not only cost a data load from the target vector, but would also
>> inhibit optimizations that replace division / modulo / multiply with shift
>> or mask operations.
>
> Have you done any sort of measurement, to see if what is lost
> is actually noticeable in practice?
No, I haven't.
On an i686 it's probably not measurable. On a host with a slow software
divide it might be, if the code paths that require these operations are
exercised a lot - that would also depend on the source code being compiled.
Also, these separate hooks for common operations can make the code more
readable, particularly in the bits_in_units_ceil case.
I.e.
foo_var = ((bitsize + targetm.bits_per_unit () - 1)
/ targetm.bits_per_unit ());
vs.
foo_var = targetm.bits_in_units_ceil (bitsize);
More information about the Gcc
mailing list