This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PR 33089: Canonicalizing a + b != 0 as a != -b causes missed optimization
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Rask Ingemann Lambertsen <rask at sygehus dot dk>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 20 Aug 2007 17:54:11 -0400 (EDT)
- Subject: Re: PR 33089: Canonicalizing a + b != 0 as a != -b causes missed optimization
- References: <20070817140424.GM25795@sygehus.dk>
On Fri, 17 Aug 2007, Rask Ingemann Lambertsen wrote:
> We start out with (eq (plus X A) 0):
> I want to hear some opinions on which form we should choose as the
> canonical one. I'm proposing two forms:
>
> 1) (eq (neg X) Y) because the change to simplify_comparison will be simpler.
> 2) (eq (plus X Y) 0) because that's the least surpricing form and the same
> as used for other comparisons, avoiding needless insn pattern duplication.
>
> The arm and i386 back ends implement 1).
> The c4x, i386, frv, rs6000, s390, score and sparc back ends implement 2).
> The c4x back end also implements the (eq (X (neg Y)) form.
>
> I'm voting for 2).
Me-too, for the reasons you mentioned and so this case wouldn't
seem special anymore:
> Note that when combining two instructions, of which one is a comparison
> of the result of a previous instruction against zero and that result is
> still needed after the comparison, combine knows not to mess with the
> expression. What's special in this case is that we are really only
> interested in the comparison result, so combine goes ahead and does the
> simplifications. Unfortunately, the result is an expression which targets
> aren't likely to have an instruction pattern for.
brgds, H-P