diff options
author | Yufeng Zhang <yufeng.zhang@arm.com> | 2013-10-25 17:25:08 +0000 |
---|---|---|
committer | Yufeng Zhang <yufeng@gcc.gnu.org> | 2013-10-25 17:25:08 +0000 |
commit | 42917d01c097938d626e4c9728455c7f5d822280 (patch) | |
tree | accdc86c368a7cdb19555cc714cf66b2b7c88f27 /gcc/tree-ssa-math-opts.c | |
parent | b02ef56d8d792059f39bef1d9b853d9a2af0aa3b (diff) | |
download | gcc-42917d01c097938d626e4c9728455c7f5d822280.zip gcc-42917d01c097938d626e4c9728455c7f5d822280.tar.gz gcc-42917d01c097938d626e4c9728455c7f5d822280.tar.bz2 |
tree-ssa-math-opts.c (convert_plusminus_to_widen): Call has_single_use () and not do the conversion if...
gcc/
* tree-ssa-math-opts.c (convert_plusminus_to_widen): Call
has_single_use () and not do the conversion if has_single_use ()
returns false for the multiplication result.
gcc/testsuite/
* gcc.dg/wmul-1.c: New test.
From-SVN: r204072
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 1817c20..9a29411 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -2432,20 +2432,25 @@ convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple stmt, It might also appear that it would be sufficient to use the existing operands of the widening multiply, but that would limit the choice of - multiply-and-accumulate instructions. */ + multiply-and-accumulate instructions. + + If the widened-multiplication result has more than one uses, it is + probably wiser not to do the conversion. */ if (code == PLUS_EXPR && (rhs1_code == MULT_EXPR || rhs1_code == WIDEN_MULT_EXPR)) { - if (!is_widening_mult_p (rhs1_stmt, &type1, &mult_rhs1, - &type2, &mult_rhs2)) + if (!has_single_use (rhs1) + || !is_widening_mult_p (rhs1_stmt, &type1, &mult_rhs1, + &type2, &mult_rhs2)) return false; add_rhs = rhs2; conv_stmt = conv1_stmt; } else if (rhs2_code == MULT_EXPR || rhs2_code == WIDEN_MULT_EXPR) { - if (!is_widening_mult_p (rhs2_stmt, &type1, &mult_rhs1, - &type2, &mult_rhs2)) + if (!has_single_use (rhs2) + || !is_widening_mult_p (rhs2_stmt, &type1, &mult_rhs1, + &type2, &mult_rhs2)) return false; add_rhs = rhs1; conv_stmt = conv2_stmt; |