This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: CSE fold_rtx subreg patch
- To: john at feith dot com (John Wehle)
- Subject: Re: CSE fold_rtx subreg patch
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 06 Jul 1998 23:33:23 -0600
- cc: egcs-patches at cygnus dot com
- Reply-To: law at cygnus dot com
In message <199807040436.AAA00938@jwlab.FEITH.COM>you write:
> This patch allows gcc to produce better assembly code in some situations
> when configured for i386. For example:
>
> unsigned char c;
>
> int
> func(unsigned char a)
> {
> unsigned char b;
>
> b = a;
> c = b;
>
> return b;
> }
>
> compiles better with this patch installed.
>
> ChangeLog:
>
> Fri Jul 3 23:44:00 EDT 1998 John Wehle (john@feith.com)
>
> * cse.c (fold_rtx): Try using an equivalent subreg if
> it isn't more expensive than the current reg.
I note that "mode_arg" is used outside the switch statement -- do we
need to fix it, or is its value correct?
I'm also a little worried about the < to <= changes, particularly for
SUBREGS since they are not optimized as well as REGs in other passes
and thus "cost more". Presumably you added it because the cases you
tried had equal cost.
You might consider changing RTX_COSTS for the x86 to make SUBREGS
which narrow an expression cheaper than the inner expression since
narrowing may allow byte/half sized instructions to be used.
jeff