aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-01-18 08:45:12 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2011-01-18 08:45:12 +0100
commite7ef91dc8eb398de7b6c780b00f1360dafd84798 (patch)
tree020c8a49163b7cf9347b1c3455970378ec548bc7 /gcc/expr.c
parentfb70168707ecbe4175c069f6c36baa8986a075bd (diff)
downloadgcc-e7ef91dc8eb398de7b6c780b00f1360dafd84798.zip
gcc-e7ef91dc8eb398de7b6c780b00f1360dafd84798.tar.gz
gcc-e7ef91dc8eb398de7b6c780b00f1360dafd84798.tar.bz2
re PR rtl-optimization/47299 (Widening multiply optimization generates bad code)
PR rtl-optimization/47299 * expr.c (expand_expr_real_2) <case WIDEN_MULT_EXPR>: Don't use subtarget. Use normal multiplication if both operands are constants. * expmed.c (expand_widening_mult): Don't try to optimize constant multiplication if op0 has VOIDmode. Convert op1 constant to mode before using it. * gcc.c-torture/execute/pr47299.c: New test. From-SVN: r168944
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index dfcaefb..7441548 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -1,6 +1,6 @@
/* Convert tree expression to rtl instructions, for GNU compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GCC.
@@ -7631,10 +7631,10 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
if (optab_handler (this_optab, mode) != CODE_FOR_nothing)
{
if (TYPE_UNSIGNED (TREE_TYPE (treeop0)))
- expand_operands (treeop0, treeop1, subtarget, &op0, &op1,
+ expand_operands (treeop0, treeop1, NULL_RTX, &op0, &op1,
EXPAND_NORMAL);
else
- expand_operands (treeop0, treeop1, subtarget, &op1, &op0,
+ expand_operands (treeop0, treeop1, NULL_RTX, &op1, &op0,
EXPAND_NORMAL);
goto binop3;
}
@@ -7652,7 +7652,8 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
optab other_optab = zextend_p ? smul_widen_optab : umul_widen_optab;
this_optab = zextend_p ? umul_widen_optab : smul_widen_optab;
- if (mode == GET_MODE_2XWIDER_MODE (innermode))
+ if (mode == GET_MODE_2XWIDER_MODE (innermode)
+ && TREE_CODE (treeop0) != INTEGER_CST)
{
if (optab_handler (this_optab, mode) != CODE_FOR_nothing)
{