]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/37544 (Conversion double -> unsigned long long -> unsigned...
authorUros Bizjak <ubizjak@gmail.com>
Fri, 19 Sep 2008 10:04:46 +0000 (12:04 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Fri, 19 Sep 2008 10:04:46 +0000 (12:04 +0200)
PR rtl-optimization/37544
* regrename.c (maybe_mode_change): Exit early when copy_mode
is narrower than orig_mode and narrower than new_mode.

testsuite/ChangeLog:

PR rtl-optimization/37544
* gcc.dg/pr37544.c: New test.

From-SVN: r140487

gcc/ChangeLog
gcc/regrename.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr37544.c [new file with mode: 0644]

index 7faf2a9ae212096fb797639593a5521f3d32012b..3bf0db75333777a1b32fac0c2f5c64d4d86a6769 100644 (file)
@@ -1,3 +1,12 @@
+2008-09-19  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline:
+       2008-09-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR rtl-optimization/37544
+       * regrename.c (maybe_mode_change): Exit early when copy_mode
+       is narrower than orig_mode and narrower than new_mode.
+
 2008-08-29  Uros Bizjak  <ubizjak@gmail.com>
 
        Backport from mainline:
index f7b5a68da8cf1865b4d002582cb10e87b95167ed..da8ca1ec1bafb913d9ef59c18791e25198dc6e5c 100644 (file)
@@ -1335,6 +1335,10 @@ maybe_mode_change (enum machine_mode orig_mode, enum machine_mode copy_mode,
                   enum machine_mode new_mode, unsigned int regno,
                   unsigned int copy_regno ATTRIBUTE_UNUSED)
 {
+  if (GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (orig_mode)
+      && GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (new_mode))
+    return NULL_RTX;
+
   if (orig_mode == new_mode)
     return gen_rtx_raw_REG (new_mode, regno);
   else if (mode_change_ok (orig_mode, new_mode, regno))
index 9581a72d6edbc2aed50dd5829ec6f985198f3ca7..cc306b59e0f75b47548cf38c6cdcd940e5605034 100644 (file)
@@ -1,3 +1,11 @@
+2008-09-19  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline:
+       2008-09-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR rtl-optimization/37544
+       * gcc.dg/pr37544.c: New test.
+
 2008-08-29  Uros Bizjak  <ubizjak@gmail.com>
 
        Backport from mainline:
diff --git a/gcc/testsuite/gcc.dg/pr37544.c b/gcc/testsuite/gcc.dg/pr37544.c
new file mode 100644 (file)
index 0000000..9dba8c4
--- /dev/null
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -msse2 -mtune=nocona -mfpmath=387" { target { i?86-*-* x86_64-*-* } } } */
+
+#ifdef __i386__
+#include "i386-cpuid.h"
+#endif
+
+extern void abort (void);
+
+int main(void)
+{
+  double arr[1000];
+  double a, b;
+
+  int i;
+
+#ifdef __i386__
+  unsigned long cpu_facilities;
+
+  cpu_facilities = i386_cpuid_edx ();
+  /* Run SSE2 test only if host has SSE2 support.  */
+  if (!(cpu_facilities & bit_SSE2))
+    return 0;
+#endif
+
+  for (i = 0; i < 1000; i++)
+    arr[i] = 4294967296.0 + (double)i;
+
+  a = arr[0];
+  b = (unsigned int)((unsigned long long int)a % 4294967296ULL);
+
+  if (b >= 4294967296.0)
+    abort ();
+
+  return 0;
+}