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]

fix arm constant generation on 64-bit hosts


Seen building libgcc.  The case at hand was ~0xff000000 == 0xffffffff00ffffff
not 0x00ffffff as expected.  The former is not a valid SImode constant
and so we can't recognize the movsi insn we generated.

Loosely tested on alphaev6 cross arm-elf.  I think there's something
wrong in the simulator as well, since not one execute test passed.


r~


        * config/arm/arm.c (arm_gen_constant): Use trunc_int_for_mode.
        Unify code from various alternatives.

Index: config/arm/arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.182
diff -c -p -d -r1.182 arm.c
*** arm.c	2002/01/03 17:40:00	1.182
--- arm.c	2002/01/09 20:58:29
*************** arm_gen_constant (code, mode, val, targe
*** 1626,1659 ****
  
  	    if (generate)
  	      {
! 		rtx new_src;
  
  		if (code == SET)
! 		  emit_insn (gen_rtx_SET (VOIDmode,
! 					  new_src = (subtargets
! 						     ? gen_reg_rtx (mode)
! 						     : target),
! 					  GEN_INT (can_invert
! 						   ? ~temp1 : temp1)));
  		else if (code == MINUS)
! 		  emit_insn (gen_rtx_SET (VOIDmode,
! 					  new_src = (subtargets
! 						     ? gen_reg_rtx (mode)
! 						     : target),
! 					  gen_rtx (code, mode, GEN_INT (temp1),
! 						   source)));
  		else
! 		  emit_insn (gen_rtx_SET (VOIDmode,
! 					  new_src = (remainder
! 						     ? (subtargets
! 							? gen_reg_rtx (mode)
! 							: target)
! 						     : target),
! 					  gen_rtx (code, mode, source,
! 						   GEN_INT (can_invert ? ~temp1
! 							    : (can_negate
! 							       ? -temp1
! 							       : temp1)))));
  		source = new_src;
  	      }
  
--- 1626,1662 ----
  
  	    if (generate)
  	      {
! 		rtx new_src, temp1_rtx;
! 
! 		if (code == SET || code == MINUS)
! 		  {
! 		    new_src = (subtargets ? gen_reg_rtx (mode) : target);
! 		    if (can_invert)
! 		      temp1 = ~temp1;
! 		  }
! 		else
! 		  {
! 		    if (remainder || !subtargets)
! 		      new_src = target;
! 		    else
! 		      new_src = gen_reg_rtx (mode);
! 		    if (can_invert)
! 		      temp1 = ~temp1;
! 		    else if (can_negate)
! 		      temp1 = -temp1;
! 		  }
  
+ 		temp1 = trunc_int_for_mode (temp1, mode);
+ 		temp1_rtx = GEN_INT (temp1);
+ 
  		if (code == SET)
! 		  ;
  		else if (code == MINUS)
! 		  temp1_rtx = gen_rtx_MINUS (mode, temp1_rtx, source);
  		else
! 		  temp1_rtx = gen_rtx_fmt_ee (code, mode, source, temp1_rtx);
! 
! 		emit_insn (gen_rtx_SET (VOIDmode, new_src, temp1_rtx));
  		source = new_src;
  	      }
  


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