aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2012-06-27 21:30:51 +0000
committerRichard Henderson <rth@redhat.com>2012-06-27 21:30:51 +0000
commitda2a7f576533cf15503296dc9995afbcbe143303 (patch)
tree0ff9298f4b499b29ab5996ba2f0360c7401e22d1 /gcc/fold-const.c
parent72f710f7390df88ce8cf533c03d915c843697126 (diff)
Add MULT_HIGHPART_EXPR
* tree.def (MULT_HIGHPART_EXPR): New. * cfgexpand.c (expand_debug_expr): Ignore it. * expr.c (expand_expr_real_2): Handle it. * fold-const.c (int_const_binop_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. * tree-cfg.c (verify_gimple_assign_binary): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. (op_code_prio, op_symbol_code): Likewise. * tree.c (commutative_tree_code): Likewise. Also handle WIDEN_MULT_EXPR, VEC_WIDEN_MULT_HI_EXPR, VEC_WIDEN_MULT_LO_EXPR. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@189027 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 877cf32717e..702f4e06701 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -999,6 +999,16 @@ int_const_binop_1 (enum tree_code code, const_tree arg1, const_tree arg2,
&res.low, &res.high);
break;
+ case MULT_HIGHPART_EXPR:
+ /* ??? Need quad precision, or an additional shift operand
+ to the multiply primitive, to handle very large highparts. */
+ if (TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT)
+ return NULL_TREE;
+ tmp = double_int_mul (op1, op2);
+ res = double_int_rshift (tmp, TYPE_PRECISION (type),
+ TYPE_PRECISION (type), !uns);
+ break;
+
case TRUNC_DIV_EXPR:
case FLOOR_DIV_EXPR: case CEIL_DIV_EXPR:
case EXACT_DIV_EXPR: