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]

combine.c patch for pr 9255


This patch fixes PR 9255.  combine is taking
        (and:SI (subreg: SI (reg:SF) (const_int)))
and converting it to
        (subreg:SI (and:SF (reg:SF) (const_int)))
which is not a valid transformation, as SFmode isn't a meaningful mode
for the AND operator.  This patch fixes the problem by adding an
explicit check for a scalar integral mode before performing the
transformation.  Without the patch, we hit an abort in
trunc_int_for_mode.

I have added this patch to the trunk and gcc-3_3-branch.  This was
tested against the original m68k testcase in both trees, and with an
x86-linux bootstrap and make check in both trees.

2003-02-27  James E Wilson  <wilson at tuliptree dot org>

	* combine.c (simplify_comparison): Require integral mode when
	permuting SUBREG with AND.

Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.338
diff -p -r1.338 combine.c
*** combine.c	10 Feb 2003 10:56:05 -0000	1.338
--- combine.c	27 Feb 2003 02:57:55 -0000
*************** simplify_comparison (code, pop0, pop1)
*** 10991,10996 ****
--- 10991,10999 ----
  	     represents the low part, permute the SUBREG and the AND and
  	     try again.  */
  	  if (GET_CODE (XEXP (op0, 0)) == SUBREG
+ 	      /* Require an integral mode, to avoid creating something like
+ 		 (AND:SF ...).  */
+ 	      && SCALAR_INT_MODE_P (GET_MODE (SUBREG_REG (XEXP (op0, 0))))
  	      /* It is unsafe to commute the AND into the SUBREG if the SUBREG
  		 is paradoxical and WORD_REGISTER_OPERATIONS is not defined.
  		 As originally written the upper bits have a defined value



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