summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorams <ams@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-19 14:41:34 +0000
committerams <ams@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-19 14:41:34 +0000
commit287c271c16450be0a3690e13cd53771403fa2e6a (patch)
tree26a12e3f6880c3f74c043a86eb86c912e2b606fc
parent3f2ab71906412798529a11fbffb68348b1eb8f81 (diff)
downloadgcc-287c271c16450be0a3690e13cd53771403fa2e6a.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177906 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/arm/wmul-7.c11
-rw-r--r--gcc/tree-ssa-math-opts.c14
4 files changed, 31 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 75b3db4e0ad..a9e1be91004 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 96cb0946343..a495ef45041 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..2db4ad4e10d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/wmul-7.c
@@ -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" } } */
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 0505603ed2f..cc0da2982ec 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -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;
}