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: reject incompatible classes in simplify_subreg


Hi Richard.  More subreg nutiness.

simplify_subreg() will transform:

	(subreg:DI (reg:DF 120 [ a ]) 0)

...into the invalid:

	(subreg:SI (reg:DF 120 [ a ]) 0)

This creates all sorts of havoc by the time we get hard registers.

It's trying to be too clever when creating subregs of subregs.  The
patch below fixes this.  In the case of the caller being 
operand_subword_force, we'll now be forced to dump the subreg into
a pseudo.

OK?


	* simplify-rtx.c (simplify_subreg): Reject class incompatability,
	and avoid making invalid subregs.

Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.206
diff -c -p -r1.206 simplify-rtx.c
*** simplify-rtx.c	18 Oct 2004 18:46:06 -0000	1.206
--- simplify-rtx.c	4 Nov 2004 19:28:55 -0000
*************** simplify_subreg (enum machine_mode outer
*** 3590,3595 ****
--- 3590,3598 ----
  	  && byte == 0 && SUBREG_BYTE (op) == 0)
  	return SUBREG_REG (op);
  
+       if (GET_MODE_CLASS (outermode) != GET_MODE_CLASS (innermostmode))
+ 	return 0;
+ 
        /* The SUBREG_BYTE represents offset, as if the value were stored
  	 in memory.  Irritating exception is paradoxical subreg, where
  	 we define SUBREG_BYTE to be 0.  On big endian machines, this


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