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 fp splitting for mmx


On lno-branch, with extra md changes, I managed to get the post-reload
splitter trying to hoist a constant load into an MMX register.  No idea
how to reproduce this on mainline, but the bug is latent there anyway.


r~


        * config/i386/i386.md (fp constant pool splitter): Reorg suppression
        for sse and 387; add suppression for mmx.

Index: i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.374.2.35
diff -u -p -r1.374.2.35 i386.md
--- i386.md	4 Dec 2003 20:21:11 -0000	1.374.2.35
+++ i386.md	3 Jan 2004 00:25:57 -0000
@@ -2881,18 +2977,30 @@
    && (GET_MODE (operands[0]) == XFmode
        || GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode)
    && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
-   && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))
-   && (!(SSE_REG_P (operands[0]) || 
-	 (GET_CODE (operands[0]) == SUBREG
-	  && SSE_REG_P (SUBREG_REG (operands[0]))))
-       || standard_sse_constant_p (get_pool_constant (XEXP (operands[1], 0))))
-   && (!(FP_REG_P (operands[0]) || 
-	 (GET_CODE (operands[0]) == SUBREG
-	  && FP_REG_P (SUBREG_REG (operands[0]))))
-       || standard_80387_constant_p (get_pool_constant (XEXP (operands[1], 0))))"
-  [(set (match_dup 0)
-	(match_dup 1))]
-  "operands[1] = get_pool_constant (XEXP (operands[1], 0));")
+   && CONSTANT_POOL_ADDRESS_P (XEXP (operands[1], 0))"
+  [(set (match_dup 0) (match_dup 1))]
+{
+  rtx c = get_pool_constant (XEXP (operands[1], 0));
+  rtx r = operands[0];
+
+  if (GET_CODE (r) == SUBREG)
+    r = SUBREG_REG (r);
+
+  if (SSE_REG_P (r))
+    {
+      if (!standard_sse_constant_p (c))
+	FAIL;
+    }
+  else if (FP_REG_P (r))
+    {
+      if (!standard_80387_constant_p (c))
+	FAIL;
+    }
+  else if (MMX_REG_P (r))
+    FAIL;
+
+  operands[1] = c;
+})
 
 (define_insn "swapxf"
   [(set (match_operand:XF 0 "register_operand" "+f")


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