[PATCH] ARM pre-indexing adress mode for absolute addresses

Nicolas Pitre nico@cam.org
Fri Sep 2 20:01:00 GMT 2005


On Tue, 30 Aug 2005, Mark Mitchell wrote:

> Nicolas Pitre wrote:
> > I'm therefore asking for confirmation that I still can commit this patch
> > now?  Thanks.
> 
> As long as you re-test, yes, that's fine.

Done.  However in my sleep or the like I realized that the committed 
patch has a minor flaw that can lead to suboptimal result when gcc is 
run on a 64 bit host in some cases.  I'm therefore committing this patch 
on top as well to which I'm sure no one will object.

2005-09-02  Nicolas Pitre <nico@cam.org>

	* config/arm/arm.c (arm_legitimize_address): Limit the value passed
	to bit_count to 32 bits.

Index: gcc/config/arm/arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.477
diff -u -r1.477 arm.c
--- gcc/config/arm/arm.c	1 Sep 2005 19:01:20 -0000	1.477
+++ gcc/config/arm/arm.c	2 Sep 2005 18:46:44 -0000
@@ -3772,7 +3772,7 @@
       mask = (1 << bits) - 1;
       base = INTVAL (x) & ~mask;
       index = INTVAL (x) & mask;
-      if (bit_count (base) > (32 - bits)/2)
+      if (bit_count (base & 0xffffffff) > (32 - bits)/2)
         {
 	  /* It'll most probably be more efficient to generate the base
 	     with more bits set and use a negative index instead. */



More information about the Gcc-patches mailing list