[i386 PATCH] PR26600: SSE2 related ICE in reload (take 2)

Roger Sayle roger@eyesopen.com
Sat May 13 16:33:00 GMT 2006


On Fri, 12 May 2006, Richard Henderson wrote:
> Not ok.

The following patch is an alternate strategy for resolving PR target/26600
(which is a P1 ICE-on-valid regression on the 4.1 branch).

This fix is to tell reload that TImode and vector constants (other
than zero) are not LEGITIMATE_CONSTANT_P meaning that the i386 backend
doesn't provide instructions to load them into registers as immediate
operands.  This prevents reload from creating unrecognizable insns.

The following patch has been tested on i686-pc-linux-gnu, with a full
"make bootstrap", all default languages including Ada, and regression
tested with a top-level "make -k check" with no new failures.

Ok for mainline?  And the 4.1 branch after a while?



2006-05-13  Roger Sayle  <roger@eyesopen.com>

	PR target/26600
	* config/i386/i386.c (legitimate_constant_p) <CONST_DOUBLE>: TImode
	integer constants other than zero are only legitimate on TARGET_64BIT.
	<CONST_VECTOR> Only zero vectors are legitimate.
	(ix86_cannot_force_const_mem): Integral and vector constants can
	always be put in the constant pool.

        * gcc.target/i386/pr26600.c: New test case.


Index: config/i386/i386.c
===================================================================
*** config/i386/i386.c	(revision 113720)
--- config/i386/i386.c	(working copy)
*************** legitimate_constant_p (rtx x)
*** 5934,5939 ****
--- 5934,5951 ----
  	return false;
        break;

+     case CONST_DOUBLE:
+       if (GET_MODE (x) == TImode
+ 	  && x != CONST0_RTX (TImode)
+ 	  && !TARGET_64BIT)
+ 	return false;
+       break;
+
+     case CONST_VECTOR:
+       if (x == CONST0_RTX (GET_MODE (x)))
+ 	return true;
+       return false;
+
      default:
        break;
      }
*************** legitimate_constant_p (rtx x)
*** 5949,5954 ****
--- 5961,5977 ----
  static bool
  ix86_cannot_force_const_mem (rtx x)
  {
+   /* We can always put integral constants and vectors in memory.  */
+   switch (GET_CODE (x))
+     {
+     case CONST_INT:
+     case CONST_DOUBLE:
+     case CONST_VECTOR:
+       return false;
+
+     default:
+       break;
+     }
    return !legitimate_constant_p (x);
  }


Roger
--



More information about the Gcc-patches mailing list