Your 64x32 problem

Jeffrey A Law law@cygnus.com
Tue Jul 27 02:54:00 GMT 1999


You might try the attached patch and see if it fixes your problem.

I'm almost certain you're running into the same bug I tried (and originally
failed) to tackle in expr.c

I mis-read immed_const_double and thought it would give back a sign extended
value.  It does so, but only in specific circumstances.

I still think calling immed_double_const is still the right thing to do, but
to ensure the value gets properly extended we need another call.  gen_lowpart
seems to be doing the trick on my testcase (from cr101356).

BTW, Jason sez it is possible for both operands to be constants and thus we
should not use GET_MODE (...), but instead TYPE_MODE (exp).  I suspect he'll
be checking in that change shortly.

Anyway, let me know if this fixes your problem.  I'm going to run it through
a battery of tests tomorrow so that I can get get 101356 closed once and for
all.

Index: expr.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/expr.c,v
retrieving revision 1.385.4.3
diff -c -3 -p -r1.385.4.3 expr.c
*** expr.c	1999/07/13 22:54:27	1.385.4.3
--- expr.c	1999/07/27 09:48:13
*************** expand_expr (exp, target, tmode, modifie
*** 6926,6931 ****
--- 6926,6932 ----
  		= immed_double_const (TREE_INT_CST_LOW (TREE_OPERAND (exp, 0)),
  				      (HOST_WIDE_INT) 0,
  				      GET_MODE (op1));
+ 	      constant_part = gen_lowpart (GET_MODE (op1), constant_part);
  	      op1 = plus_constant (op1, INTVAL (constant_part));
  	      if (modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  		op1 = force_operand (op1, target);
*************** expand_expr (exp, target, tmode, modifie
*** 6958,6963 ****
--- 6959,6965 ----
  		= immed_double_const (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)),
  				      (HOST_WIDE_INT) 0,
  				      GET_MODE (op0));
+ 	      constant_part = gen_lowpart (GET_MODE (op0), constant_part);
  	      op0 = plus_constant (op0, INTVAL (constant_part));
  	      if (modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
  		op0 = force_operand (op0, target);












More information about the Gcc-patches mailing list