This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: [Committed] Canonicalize XOR of sign-bit as addition


On Fri, Apr 09, 2004 at 02:38:15PM -0600, Roger Sayle wrote:
> I believe the correct approach is to recognize that "x ^ 0x80000000",
> "x + 0x80000000" and "x - 0x80000000" all represent same operation and
> should be canonicalized to the same thing.  My preference is to use the
> addition as the preferred canonical form: (i) there are far more
> optimizations of plus than there are for xor, (ii) many architectures
> may perform multiple additions in a single cycle, or even a single
> instruction but fewer handle multiple xors and (iii) GCC already
> canonicalizes misnus of the "sign bit" or "most significant bit"
> into an addition.

I would think ^ might be the preferred canonical form, since ^ is 
trivially eliminated when applied twice.


r~


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