]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/37731 (long long may not work correctly on 32bit host)
authorH.J. Lu <hongjiu.lu@intel.com>
Tue, 7 Oct 2008 18:45:56 +0000 (18:45 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Tue, 7 Oct 2008 18:45:56 +0000 (11:45 -0700)
gcc/

2008-10-07  H.J. Lu  <hongjiu.lu@intel.com>

PR middle-end/37731
* expmed.c (expand_mult): Properly check DImode constant in
CONST_DOUBLE.

gcc/testsuite/

2008-10-07  H.J. Lu  <hongjiu.lu@intel.com>

PR middle-end/37731
* gcc.dg/torture/pr37731-1.c: New.
* gcc.dg/torture/pr37731-2.c: Likewise.

From-SVN: r140947

gcc/ChangeLog
gcc/expmed.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr37731-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr37731-2.c [new file with mode: 0644]

index 5582866162aa64571204f6c61c13f8ae1708b4d1..18911a224f4a32323a7a8a4d33e9f749d90e55b8 100644 (file)
@@ -1,3 +1,9 @@
+2008-10-07  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR middle-end/37731
+       * expmed.c (expand_mult): Properly check DImode constant in
+       CONST_DOUBLE.
+
 2008-10-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/37738
index ae5ad0a2f12f2cfe676c47324fcf4c2246b11f1f..5e8d7f30324ed814d9928bba6b6ae4138e9bb59a 100644 (file)
@@ -3075,7 +3075,8 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
        {
          /* If we are multiplying in DImode, it may still be a win
             to try to work with shifts and adds.  */
-         if (CONST_DOUBLE_HIGH (op1) == 0)
+         if (CONST_DOUBLE_HIGH (op1) == 0
+             && CONST_DOUBLE_LOW (op1) > 0)
            coeff = CONST_DOUBLE_LOW (op1);
          else if (CONST_DOUBLE_LOW (op1) == 0
                   && EXACT_POWER_OF_2_OR_ZERO_P (CONST_DOUBLE_HIGH (op1)))
index d3fdf0042670c27b3926a51e39d807f419c07541..b33a77a0658e59667e7bf0a4561341c0e7ccdff1 100644 (file)
@@ -1,3 +1,9 @@
+2008-10-07  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR middle-end/37731
+       * gcc.dg/torture/pr37731-1.c: New.
+       * gcc.dg/torture/pr37731-2.c: Likewise.
+
 2008-10-07  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/37738
diff --git a/gcc/testsuite/gcc.dg/torture/pr37731-1.c b/gcc/testsuite/gcc.dg/torture/pr37731-1.c
new file mode 100644 (file)
index 0000000..5c156b1
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+
+extern void abort ();
+
+unsigned long long xh = 1;
+
+int
+main ()
+{
+  unsigned long long yh = 0xffffffffull;
+  unsigned long long z = xh * yh;
+
+  if (z != yh)
+    abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr37731-2.c b/gcc/testsuite/gcc.dg/torture/pr37731-2.c
new file mode 100644 (file)
index 0000000..a7f8f1e
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do run } */
+
+extern void abort ();
+
+long long xh = 1;
+
+int
+main ()
+{
+  long long yh = 0xffffffffll;
+  long long z = xh * yh;
+
+  if (z != yh)
+    abort ();
+
+  return 0;
+}