aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-math-opts.c
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2012-09-07 10:37:08 +0000
committerRichard Earnshaw <rearnsha@gcc.gnu.org>2012-09-07 10:37:08 +0000
commite919e5bffbc8acd81d795e5c5a50d3d785bcdf0f (patch)
treec6a5cc1bbe9e0d190e009cb18cb51b75417511aa /gcc/tree-ssa-math-opts.c
parent81ab73121e775ca961650a7eb4656b5075a492c5 (diff)
downloadgcc-e919e5bffbc8acd81d795e5c5a50d3d785bcdf0f.zip
gcc-e919e5bffbc8acd81d795e5c5a50d3d785bcdf0f.tar.gz
gcc-e919e5bffbc8acd81d795e5c5a50d3d785bcdf0f.tar.bz2
re PR tree-optimization/54295 (Widening multiply-accumulate operation uses wrong value extension)
PR tree-ssa/54295 * tree-ssa-math-opts.c (widening_mult_conversion_strippable_p): Sign-extension of a zero-extended value can be simplified to just zero-extension. testsuite: * gcc.target/arm/pr50318-1.c: Scan for smlal. * gcc.target/arm/smlaltb-1.c: XFAIL test. * gcc.target/arm/smlaltt-1.c: Likewise. From-SVN: r191066
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r--gcc/tree-ssa-math-opts.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index c3392fb..94d19af 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1985,7 +1985,11 @@ widening_mult_conversion_strippable_p (tree result_type, gimple stmt)
the operation and doesn't narrow the range. */
inner_op_type = TREE_TYPE (gimple_assign_rhs1 (stmt));
- if (TYPE_UNSIGNED (op_type) == TYPE_UNSIGNED (inner_op_type)
+ /* If the inner-most type is unsigned, then we can strip any
+ intermediate widening operation. If it's signed, then the
+ intermediate widening operation must also be signed. */
+ if ((TYPE_UNSIGNED (inner_op_type)
+ || TYPE_UNSIGNED (op_type) == TYPE_UNSIGNED (inner_op_type))
&& TYPE_PRECISION (op_type) > TYPE_PRECISION (inner_op_type))
return true;