tree-ssa-math-opts.c (is_widening_mult_p): Remove FIXME.
authorAndrew Stubbs <ams@codesourcery.com>
Fri, 19 Aug 2011 14:41:34 +0000 (14:41 +0000)
committerAndrew Stubbs <ams@gcc.gnu.org>
Fri, 19 Aug 2011 14:41:34 +0000 (14:41 +0000)
2011-08-19  Andrew Stubbs  <ams@codesourcery.com>

gcc/
* tree-ssa-math-opts.c (is_widening_mult_p): Remove FIXME.
Ensure the the larger type is the first operand.

gcc/testsuite/
* gcc.target/arm/wmul-7.c: New file.

From-SVN: r177906

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/wmul-7.c [new file with mode: 0644]
gcc/tree-ssa-math-opts.c

index 75b3db4..a9e1be9 100644 (file)
@@ -1,5 +1,10 @@
 2011-08-19  Andrew Stubbs  <ams@codesourcery.com>
 
+       * tree-ssa-math-opts.c (is_widening_mult_p): Remove FIXME.
+       Ensure the the larger type is the first operand.
+
+2011-08-19  Andrew Stubbs  <ams@codesourcery.com>
+
        * tree-ssa-math-opts.c (convert_mult_to_widen): Convert
        unsupported unsigned multiplies to signed.
        (convert_plusminus_to_widen): Likewise.
index 96cb094..a495ef4 100644 (file)
@@ -1,5 +1,9 @@
 2011-08-19  Andrew Stubbs  <ams@codesourcery.com>
 
+       * gcc.target/arm/wmul-7.c: New file.
+
+2011-08-19  Andrew Stubbs  <ams@codesourcery.com>
+
        * gcc.target/arm/wmul-6.c: New file.
 
 2011-08-19  Andrew Stubbs  <ams@codesourcery.com>
diff --git a/gcc/testsuite/gcc.target/arm/wmul-7.c b/gcc/testsuite/gcc.target/arm/wmul-7.c
new file mode 100644 (file)
index 0000000..2db4ad4
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target arm_dsp } */
+
+unsigned long long
+foo (unsigned long long a, unsigned char *b, unsigned short *c)
+{
+  return a + *b * *c;
+}
+
+/* { dg-final { scan-assembler "umlal" } } */
index 0505603..cc0da29 100644 (file)
@@ -2054,9 +2054,17 @@ is_widening_mult_p (gimple stmt,
       *type2_out = *type1_out;
     }
 
-  /* FIXME: remove this restriction.  */
-  if (TYPE_PRECISION (*type1_out) != TYPE_PRECISION (*type2_out))
-    return false;
+  /* Ensure that the larger of the two operands comes first. */
+  if (TYPE_PRECISION (*type1_out) < TYPE_PRECISION (*type2_out))
+    {
+      tree tmp;
+      tmp = *type1_out;
+      *type1_out = *type2_out;
+      *type2_out = tmp;
+      tmp = *rhs1_out;
+      *rhs1_out = *rhs2_out;
+      *rhs2_out = tmp;
+    }
 
   return true;
 }