This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: minor code-quality regression vs. 2.95
- To: Clinton Popetz <cpopetz at cygnus dot com>
- Subject: Re: minor code-quality regression vs. 2.95
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 03 May 2000 10:20:22 -0600
- cc: Zack Weinberg <zack at wolery dot cumb dot org>, gcc-patches at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <20000413164849.B20251@cpopetz.com>you write:
> On Wed, Apr 12, 2000 at 04:08:23PM -0500, Clinton Popetz wrote:
> >
> > ix86_expand_branch is emitting the long long compare like this:
> >
> > * a < b =>
> > * if (hi(a) < hi(b)) goto true;
> > * if (hi(a) > hi(b)) goto false;
> > * if (lo(a) < lo(b)) goto true;
> >
> > In the above case, the third jump can be turned into an uncoditional jump
> by
> > cse, which means the first test/jump could be eliminated _if_ it were emi
> tted
> > directly before the last one (i.e. swap the first two statements above.)
>
> Here's the patch to swap the order. Again, I'm not sure this won't negativ
> ely
> effect jump optimizations for other (perhaps more common) cases; it generat
> es
> better code in this specific case.
>
> -Clint
>
> Thu Apr 13 15:05:04 CDT 2000 Clinton Popetz <cpopetz@cygnus.com>
>
> * i386.c (ix86_expand_branch): Switch the order of the
> first two branches for a DImode branch.
I did a bootstrap of the x86 port with a 64bit HOST_WIDE_INT of the 37
affected files, 24 had the same text size before/after the patch.
Of the 13 files where the text size changed, 9 got worse after the patch,
4 got better. I didn't do any analysis of the code differences.
However, text size is not a good indicator of whether or not the code is
better on the x86 due to a number of concerns. But in the absence of
further analysis my recommendation is to not install this patch.
On a related note, one might legitimately ask if there are any properties
of long long comparisons on the x86 target that we could take advantage of
to improve this code. ie, is it the case that the vast majority of the time
that the high parts are equal? if so, a longer code sequence might actually
improve performance. (for test for equality of high and if equal branch to
the low test).
jeff