aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-math-opts.c
diff options
context:
space:
mode:
authorAndrew Stubbs <ams@codesourcery.com>2011-08-19 14:12:32 +0000
committerAndrew Stubbs <ams@gcc.gnu.org>2011-08-19 14:12:32 +0000
commita484f6bae00618d6482bdaf1740bb32663d96d24 (patch)
tree79e47d7fd79f8a22d857e9e104cac40825bc24b0 /gcc/tree-ssa-math-opts.c
parentc4b3a0a0b9566dcd63e4a35ddcafa4b93055aa96 (diff)
downloadgcc-a484f6bae00618d6482bdaf1740bb32663d96d24.zip
gcc-a484f6bae00618d6482bdaf1740bb32663d96d24.tar.gz
gcc-a484f6bae00618d6482bdaf1740bb32663d96d24.tar.bz2
expr.c (expand_expr_real_2): Use widening_optab_handler.
2011-08-19 Andrew Stubbs <ams@codesourcery.com> gcc/ * expr.c (expand_expr_real_2): Use widening_optab_handler. * genopinit.c (optabs): Use set_widening_optab_handler for $N. (gen_insn): $N now means $a must be wider than $b, not consecutive. * optabs.c (widened_mode): New function. (expand_widen_pattern_expr): Use widening_optab_handler. (expand_binop_directly): Likewise. (expand_binop): Likewise. * optabs.h (widening_optab_handlers): New struct. (optab_d): New member, 'widening'. (widening_optab_handler): New function. (set_widening_optab_handler): New function. * tree-ssa-math-opts.c (convert_mult_to_widen): Use widening_optab_handler. (convert_plusminus_to_widen): Likewise. From-SVN: r177901
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r--gcc/tree-ssa-math-opts.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index db4ec44..e6bc2ae 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -2056,6 +2056,8 @@ convert_mult_to_widen (gimple stmt)
{
tree lhs, rhs1, rhs2, type, type1, type2;
enum insn_code handler;
+ enum machine_mode to_mode, from_mode;
+ optab op;
lhs = gimple_assign_lhs (stmt);
type = TREE_TYPE (lhs);
@@ -2065,12 +2067,17 @@ convert_mult_to_widen (gimple stmt)
if (!is_widening_mult_p (stmt, &type1, &rhs1, &type2, &rhs2))
return false;
+ to_mode = TYPE_MODE (type);
+ from_mode = TYPE_MODE (type1);
+
if (TYPE_UNSIGNED (type1) && TYPE_UNSIGNED (type2))
- handler = optab_handler (umul_widen_optab, TYPE_MODE (type));
+ op = umul_widen_optab;
else if (!TYPE_UNSIGNED (type1) && !TYPE_UNSIGNED (type2))
- handler = optab_handler (smul_widen_optab, TYPE_MODE (type));
+ op = smul_widen_optab;
else
- handler = optab_handler (usmul_widen_optab, TYPE_MODE (type));
+ op = usmul_widen_optab;
+
+ handler = widening_optab_handler (op, to_mode, from_mode);
if (handler == CODE_FOR_nothing)
return false;
@@ -2172,7 +2179,8 @@ convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple stmt,
accumulate in this mode/signedness combination, otherwise
this transformation is likely to pessimize code. */
this_optab = optab_for_tree_code (wmult_code, type1, optab_default);
- if (optab_handler (this_optab, TYPE_MODE (type)) == CODE_FOR_nothing)
+ if (widening_optab_handler (this_optab, TYPE_MODE (type), TYPE_MODE (type1))
+ == CODE_FOR_nothing)
return false;
/* ??? May need some type verification here? */