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 PR 39592 (excess precision ICE with -msse)


This patch fixes PR 39592, an ICE with -msse and C99-conforming excess
precision enabled.  The problem was some patterns for unsigned
conversion from SImode created a signed conversion from DImode, and
signed conversions from DImode to modes other than XFmode are disabled
when conforming excess precision is enabled.  In principle maybe the
compiler should know somehow that these DImode values are safe to
convert directly to DFmode even though others are not, but it seems
simplest instead to restrict these patterns (which use SSE for part of
the conversion sequence) so they don't apply for SImode-to-DFmode
conversions.

Bootstrapped with no regressions on i686-pc-linux-gnu.  OK to commit?

2009-03-31  Joseph Myers  <joseph@codesourcery.com>

	PR target/39592
	* config/i386/i386.md (*floatunssi<mode>2_1, two unnamed
	define_splits, floatunssi<mode>2): Require x87 conversions from
	DImode to be permitted.

testsuite:
2009-03-31  Joseph Myers  <joseph@codesourcery.com>

	PR target/39592
	* gcc.target/i386/pr39592-1.c: New test.

Index: gcc/config/i386/i386.md
===================================================================
--- gcc/config/i386/i386.md	(revision 145289)
+++ gcc/config/i386/i386.md	(working copy)
@@ -5654,7 +5654,7 @@
    (clobber (match_operand:DI 2 "memory_operand" "=m,m"))
    (clobber (match_scratch:SI 3 "=X,x"))]
   "!TARGET_64BIT
-   && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, SImode)
+   && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode)
    && TARGET_SSE"
   "#"
   [(set_attr "type" "multi")
@@ -5667,7 +5667,7 @@
    (clobber (match_operand:DI 2 "memory_operand" ""))
    (clobber (match_scratch:SI 3 ""))]
   "!TARGET_64BIT
-   && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, SImode)
+   && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode)
    && TARGET_SSE
    && reload_completed"
   [(set (match_dup 2) (match_dup 1))
@@ -5682,7 +5682,7 @@
    (clobber (match_operand:DI 2 "memory_operand" ""))
    (clobber (match_scratch:SI 3 ""))]
   "!TARGET_64BIT
-   && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, SImode)
+   && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode)
    && TARGET_SSE
    && reload_completed"
   [(set (match_dup 2) (match_dup 3))
@@ -5701,7 +5701,7 @@
       (clobber (match_dup 2))
       (clobber (match_scratch:SI 3 ""))])]
   "!TARGET_64BIT
-   && ((TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, SImode)
+   && ((TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode)
 	&& TARGET_SSE)
        || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH))"
 {
Index: gcc/testsuite/gcc.target/i386/pr39592-1.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr39592-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/i386/pr39592-1.c	(revision 0)
@@ -0,0 +1,10 @@
+/* Test for ICE with C99-conforming excess precision and -msse.  PR
+   39592.  */
+/* { dg-do compile } */
+/* { dg-options "-ansi -msse" } */
+
+double
+foo (unsigned long var)
+{
+  return var;
+}

-- 
Joseph S. Myers
joseph@codesourcery.com


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