diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-11-06 14:47:43 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-11-06 14:47:43 +0000 |
commit | 9134df2c6c398e67f0cb5e008a6b84b7fbb029e6 (patch) | |
tree | df2bd2f49e457ed3f8d475a648f204ea8935d5e0 /gcc/tree-ssa-math-opts.c | |
parent | 962b96688689a73ddf5fb97d9c63514f98b49d27 (diff) | |
download | gcc-9134df2c6c398e67f0cb5e008a6b84b7fbb029e6.zip gcc-9134df2c6c398e67f0cb5e008a6b84b7fbb029e6.tar.gz gcc-9134df2c6c398e67f0cb5e008a6b84b7fbb029e6.tar.bz2 |
PR82816: Widening multiplies of bitfields
In this PR we tried to create a widening multiply of two 3-bit numbers,
but that isn't a widening multiply at the optab/rtl level, since both
the input and output still have the same mode.
We could trap this either in is_widening_mult_p or (as the patch does)
in the routines that actually ask for an optab. The latter seemed
more natural since is_widening_mult_p doesn't otherwise care about modes.
2017-11-03 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
PR tree-optimization/82816
* tree-ssa-math-opts.c (convert_mult_to_widen): Return false
if the modes of the two types are the same.
(convert_plusminus_to_widen): Likewise.
gcc/testsuite/
* gcc.c-torture/compile/pr82816.c: New test.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r254454
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 493f4e2..5986ac1 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -3259,6 +3259,9 @@ convert_mult_to_widen (gimple *stmt, gimple_stmt_iterator *gsi) to_mode = SCALAR_INT_TYPE_MODE (type); from_mode = SCALAR_INT_TYPE_MODE (type1); + if (to_mode == from_mode) + return false; + from_unsigned1 = TYPE_UNSIGNED (type1); from_unsigned2 = TYPE_UNSIGNED (type2); @@ -3449,6 +3452,9 @@ convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple *stmt, to_mode = SCALAR_TYPE_MODE (type); from_mode = SCALAR_TYPE_MODE (type1); + if (to_mode == from_mode) + return false; + from_unsigned1 = TYPE_UNSIGNED (type1); from_unsigned2 = TYPE_UNSIGNED (type2); optype = type1; |