CSE fold_rtx subreg patch

Jeffrey A Law law@cygnus.com
Mon Jul 6 22:37:00 GMT 1998


  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




More information about the Gcc-patches mailing list