This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] fix a failure for ARM


Hi,

The testcase gcc.c-torture/compile/20000804-1.c fails with -mthumb
-fPIC -mpic-register=6.  It turned out to be a reload issue.

In order to reload the __complex__ long long variable from the stack
before the asm statement, gen_reload calls gen_move_insn which emits
one DI move for the real part and one for the imaginary part.  The
problem is that since the address itself has to be reloaded ((fp -
const_int) in not a legitimate address with Thumb), splitting the move
kills the substitution of the address part.

I applied Richard Kenner's solution with multi-word moves in the same
function, see http://gcc.gnu.org/ml/gcc-patches/2000-04/msg00554.html.

Regtested on arm-elf with -marm/-mthumb times /-fPIC/-fPIC
-mpic-register=6 .  It fixes one failure. 

Please apply if OK.

Should I add a test to dg with the original test but with explicitly
setting the options for ARM?

Adam

2002-08-05  Adam Nemet  <anemet@lnxw.com>

	* expr.c (emit_move_insn_1): Check for replacements in addresses
	in the multi-word __complex__ case.

Index: expr.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/expr.c,v
retrieving revision 1.467
diff -c -p -r1.467 expr.c
*** expr.c	18 Jun 2002 01:35:28 -0000	1.467
--- expr.c	5 Aug 2002 07:54:50 -0000
*************** emit_move_insn_1 (x, y)
*** 2962,2967 ****
--- 2962,2968 ----
  	{
  	  rtx realpart_x, realpart_y;
  	  rtx imagpart_x, imagpart_y;
+ 	  rtx inner;
  
  	  /* If this is a complex value with each part being smaller than a
  	     word, the usual calling sequence will likely pack the pieces into
*************** emit_move_insn_1 (x, y)
*** 3014,3019 ****
--- 3015,3029 ----
  		    }
  		}
  	    }
+ 
+ 	  /* If we are in reload, see if either operand is a MEM whose
+ 	     address is scheduled for replacement.  */
+ 	  if (reload_in_progress && GET_CODE (x) == MEM
+ 	      && (inner = find_replacement (&XEXP (x, 0))) != XEXP (x, 0))
+ 	    x = replace_equiv_address_nv (x, inner);
+ 	  if (reload_in_progress && GET_CODE (y) == MEM
+ 	      && (inner = find_replacement (&XEXP (y, 0))) != XEXP (y, 0))
+ 	    y = replace_equiv_address_nv (y, inner);
  
  	  realpart_x = gen_realpart (submode, x);
  	  realpart_y = gen_realpart (submode, y);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]