This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Committed] Canonicalize XOR of sign-bit as addition
- From: Richard Henderson <rth at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 12 Apr 2004 14:40:00 -0700
- Subject: Re: [Committed] Canonicalize XOR of sign-bit as addition
- References: <610A335D-7CA7-11D8-A085-000A95A4DC02@kernel.crashing.org> <Pine.LNX.4.44.0404091418090.4935-100000@www.eyesopen.com>
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~