minor code-quality regression vs. 2.95

Clinton Popetz cpopetz@cygnus.com
Thu Apr 13 14:49:00 GMT 2000


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 emitted
> 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 negatively
effect jump optimizations for other (perhaps more common) cases; it generates
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.

Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.156
diff -c -2 -p -r1.156 i386.c
*** i386.c	2000/04/13 04:11:52	1.156
--- i386.c	2000/04/13 19:01:18
*************** ix86_expand_branch (code, label)
*** 4911,4918 ****
  	ix86_compare_op1 = hi[1];
  
- 	if (code1 != NIL)
- 	  ix86_expand_branch (code1, label);
  	if (code2 != NIL)
  	  ix86_expand_branch (code2, label2);
  
  	ix86_compare_op0 = lo[0];
--- 4911,4918 ----
  	ix86_compare_op1 = hi[1];
  
  	if (code2 != NIL)
  	  ix86_expand_branch (code2, label2);
+ 	if (code1 != NIL)
+ 	  ix86_expand_branch (code1, label);
  
  	ix86_compare_op0 = lo[0];



More information about the Gcc-patches mailing list