diff options
author | ams <ams@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-19 14:12:32 +0000 |
---|---|---|
committer | ams <ams@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-19 14:12:32 +0000 |
commit | 5a574e8bc02ccbac0d8fb40b989a8a17af6917bc (patch) | |
tree | 79e47d7fd79f8a22d857e9e104cac40825bc24b0 /gcc/tree-ssa-math-opts.c | |
parent | 4755ceab65335b7efe910ae66128bdfea947256c (diff) | |
download | gcc-5a574e8bc02ccbac0d8fb40b989a8a17af6917bc.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177901 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index db4ec44c331..e6bc2ae215b 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? */ |