This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH (5/7)] Widening multiplies for mis-matched mode inputs
- From: Andrew Stubbs <ams at codesourcery dot com>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org, patches at linaro dot org
- Date: Fri, 19 Aug 2011 15:42:58 +0100
- Subject: Re: [PATCH (5/7)] Widening multiplies for mis-matched mode inputs
- References: <4E034EF2.3070503@codesourcery.com> <4E0350B7.7080802@codesourcery.com> <4E09EE62.9070900@codesourcery.com> <4E11CE4F.1020102@codesourcery.com> <CAFiYyc1zu4v9bZinH+gAzNPc9-VSPjAu+2Fz+R83HNS5wrH3Lw@mail.gmail.com> <4E1EFCF3.9040809@codesourcery.com> <CAFiYyc2bEcMay74v+k5Bn=qGy_ck8G0g7UboXk24in7rJnVssQ@mail.gmail.com>
On 14/07/11 15:31, Richard Guenther wrote:
Ok.
I've just committed this patch with no real changes. I've just updated
the testcase.
Andrew
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.
--- /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" } } */
--- 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;
}