* 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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189027
138bc75d-0d04-0410-961f-
82ee72b054a4
2012-06-27 Richard Henderson <rth@redhat.com>
+ * 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.
+
+2012-06-27 Richard Henderson <rth@redhat.com>
+
PR target/53749
* config/i386/i386.c (ix86_rtx_costs): Fix typo vs UNITS_PER_WORD
in 2012-06-23 change. Adjust two other DImode tests as well.
case VEC_PERM_EXPR:
return NULL;
- /* Misc codes. */
+ /* Misc codes. */
case ADDR_SPACE_CONVERT_EXPR:
case FIXED_CONVERT_EXPR:
case OBJ_TYPE_REF:
}
return NULL;
+ case MULT_HIGHPART_EXPR:
+ /* ??? Similar to the above. */
+ return NULL;
+
case WIDEN_SUM_EXPR:
case WIDEN_LSHIFT_EXPR:
if (SCALAR_INT_MODE_P (GET_MODE (op0))
return expand_divmod (0, code, mode, op0, op1, target, unsignedp);
case RDIV_EXPR:
+ case MULT_HIGHPART_EXPR:
goto binop;
case TRUNC_MOD_EXPR:
&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:
case BIT_XOR_EXPR:
return xor_optab;
+ case MULT_HIGHPART_EXPR:
+ return TYPE_UNSIGNED (type) ? umul_highpart_optab : smul_highpart_optab;
+
case TRUNC_MOD_EXPR:
case CEIL_MOD_EXPR:
case FLOOR_MOD_EXPR:
return false;
case MULT_EXPR:
+ case MULT_HIGHPART_EXPR:
case TRUNC_DIV_EXPR:
case CEIL_DIV_EXPR:
case FLOOR_DIV_EXPR:
case POINTER_PLUS_EXPR:
case MINUS_EXPR:
case MULT_EXPR:
+ case MULT_HIGHPART_EXPR:
case FMA_EXPR:
case ADDR_SPACE_CONVERT_EXPR:
case WIDEN_SUM_EXPR:
case WIDEN_MULT_EXPR:
case MULT_EXPR:
+ case MULT_HIGHPART_EXPR:
case PLUS_EXPR:
case POINTER_PLUS_EXPR:
case MINUS_EXPR:
case WIDEN_MULT_PLUS_EXPR:
case WIDEN_MULT_MINUS_EXPR:
case MULT_EXPR:
+ case MULT_HIGHPART_EXPR:
case TRUNC_DIV_EXPR:
case CEIL_DIV_EXPR:
case FLOOR_DIV_EXPR:
case WIDEN_MULT_EXPR:
return "w*";
+ case MULT_HIGHPART_EXPR:
+ return "h*";
+
case NEGATE_EXPR:
case MINUS_EXPR:
return "-";
{
case PLUS_EXPR:
case MULT_EXPR:
+ case MULT_HIGHPART_EXPR:
case MIN_EXPR:
case MAX_EXPR:
case BIT_IOR_EXPR:
case TRUTH_AND_EXPR:
case TRUTH_XOR_EXPR:
case TRUTH_OR_EXPR:
+ case WIDEN_MULT_EXPR:
+ case VEC_WIDEN_MULT_HI_EXPR:
+ case VEC_WIDEN_MULT_LO_EXPR:
return true;
default:
second operand is an integer of type sizetype. */
DEFTREECODE (POINTER_PLUS_EXPR, "pointer_plus_expr", tcc_binary, 2)
+/* Highpart multiplication. For an integral type with precision B,
+ returns bits [2B-1, B] of the full 2*B product. */
+DEFTREECODE (MULT_HIGHPART_EXPR, "mult_highpart_expr", tcc_binary, 2)
+
/* Division for integer result that rounds the quotient toward zero. */
DEFTREECODE (TRUNC_DIV_EXPR, "trunc_div_expr", tcc_binary, 2)