Commit 7735d6c7 by Bill Schmidt Committed by William Schmidt

double-int.c (double_int_multiple_of): New function.

2012-06-22  Bill Schmidt  <wschmidt@linux.ibm.com>

	* double-int.c (double_int_multiple_of): New function.
	* double-int.h (double_int_multiple_of): New decl.
	* tree-ssa-loop-ivopts.c (add_cost, zero_cost): Remove undefs.
	(mbc_entry_hash): New forward decl.
	(mbc_entry_eq): Likewise.
	(zero_cost): Change to no_cost.
	(mult_costs): New static var.
	(cost_tables_exist): Likewise.
	(initialize_costs): New function.
	(finalize_costs): Likewise.
	(tree_ssa_iv_optimize_init): Call initialize_costs.
	(add_cost): Change to add_regs_cost; distinguish costs by speed.
	(multiply_regs_cost): New function.
	(add_const_cost): Likewise.
	(extend_or_trunc_reg_cost): Likewise.
	(negate_reg_cost): Likewise.
	(multiply_by_cost): Change to multiply_by_const_cost; distinguish
	costs by speed.
	(get_address_cost): Change add_cost to add_regs_cost; change
	multiply_by_cost to multiply_by_const_cost.
	(force_expr_to_var_cost): Change zero_cost to no_cost; change
	add_cost to add_regs_cost; change multiply_by_cost to
	multiply_by_const_cost.
	(split_cost): Change zero_cost to no_cost.
	(ptr_difference_cost): Likewise.
	(difference_cost): Change zero_cost to no_cost; change multiply_by_cost
	to multiply_by_const_cost.
	(get_computation_cost_at): Change add_cost to add_regs_cost; change
	multiply_by_cost to multiply_by_const_cost.
	(determine_use_iv_cost_generic): Change zero_cost to no_cost.
	(determine_iv_cost): Change add_cost to add_regs_cost.
	(iv_ca_new): Change zero_cost to no_cost.
	(tree_ssa_iv_optimize_finalize): Call finalize_costs.
	* tree-ssa-address.c (most_expensive_mult_to_index): Change
	multiply_by_cost to multiply_by_const_cost.
	* tree-flow.h (multiply_by_cost): Change to multiply_by_const_cost.
	(add_regs_cost): New decl.
	(multiply_regs_cost): Likewise.
	(add_const_cost): Likewise.
	(extend_or_trunc_reg_cost): Likewise.
	(negate_reg_cost): Likewise.

From-SVN: r188891
parent 62e0a1ed
2012-06-22 Bill Schmidt <wschmidt@linux.ibm.com>
* double-int.c (double_int_multiple_of): New function.
* double-int.h (double_int_multiple_of): New decl.
* tree-ssa-loop-ivopts.c (add_cost, zero_cost): Remove undefs.
(mbc_entry_hash): New forward decl.
(mbc_entry_eq): Likewise.
(zero_cost): Change to no_cost.
(mult_costs): New static var.
(cost_tables_exist): Likewise.
(initialize_costs): New function.
(finalize_costs): Likewise.
(tree_ssa_iv_optimize_init): Call initialize_costs.
(add_cost): Change to add_regs_cost; distinguish costs by speed.
(multiply_regs_cost): New function.
(add_const_cost): Likewise.
(extend_or_trunc_reg_cost): Likewise.
(negate_reg_cost): Likewise.
(multiply_by_cost): Change to multiply_by_const_cost; distinguish
costs by speed.
(get_address_cost): Change add_cost to add_regs_cost; change
multiply_by_cost to multiply_by_const_cost.
(force_expr_to_var_cost): Change zero_cost to no_cost; change
add_cost to add_regs_cost; change multiply_by_cost to
multiply_by_const_cost.
(split_cost): Change zero_cost to no_cost.
(ptr_difference_cost): Likewise.
(difference_cost): Change zero_cost to no_cost; change multiply_by_cost
to multiply_by_const_cost.
(get_computation_cost_at): Change add_cost to add_regs_cost; change
multiply_by_cost to multiply_by_const_cost.
(determine_use_iv_cost_generic): Change zero_cost to no_cost.
(determine_iv_cost): Change add_cost to add_regs_cost.
(iv_ca_new): Change zero_cost to no_cost.
(tree_ssa_iv_optimize_finalize): Call finalize_costs.
* tree-ssa-address.c (most_expensive_mult_to_index): Change
multiply_by_cost to multiply_by_const_cost.
* tree-flow.h (multiply_by_cost): Change to multiply_by_const_cost.
(add_regs_cost): New decl.
(multiply_regs_cost): Likewise.
(add_const_cost): Likewise.
(extend_or_trunc_reg_cost): Likewise.
(negate_reg_cost): Likewise.
2012-06-22 Richard Guenther <rguenther@suse.de>
Merge from graphite branch
......
......@@ -865,6 +865,26 @@ double_int_umod (double_int a, double_int b, unsigned code)
return double_int_mod (a, b, true, code);
}
/* Return TRUE iff PRODUCT is an integral multiple of FACTOR, and return
the multiple in *MULTIPLE. Otherwise return FALSE and leave *MULTIPLE
unchanged. */
bool
double_int_multiple_of (double_int product, double_int factor,
bool unsigned_p, double_int *multiple)
{
double_int remainder;
double_int quotient = double_int_divmod (product, factor, unsigned_p,
TRUNC_DIV_EXPR, &remainder);
if (double_int_zero_p (remainder))
{
*multiple = quotient;
return true;
}
return false;
}
/* Set BITPOS bit in A. */
double_int
double_int_setbit (double_int a, unsigned bitpos)
......
......@@ -150,6 +150,8 @@ double_int double_int_divmod (double_int, double_int, bool, unsigned, double_int
double_int double_int_sdivmod (double_int, double_int, unsigned, double_int *);
double_int double_int_udivmod (double_int, double_int, unsigned, double_int *);
bool double_int_multiple_of (double_int, double_int, bool, double_int *);
double_int double_int_setbit (double_int, unsigned);
int double_int_ctz (double_int);
......
......@@ -810,7 +810,12 @@ bool expr_invariant_in_loop_p (struct loop *, tree);
bool stmt_invariant_in_loop_p (struct loop *, gimple);
bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum machine_mode,
addr_space_t);
unsigned multiply_by_cost (HOST_WIDE_INT, enum machine_mode, bool);
unsigned multiply_by_const_cost (HOST_WIDE_INT, enum machine_mode, bool);
unsigned add_regs_cost (enum machine_mode, bool);
unsigned multiply_regs_cost (enum machine_mode, bool);
unsigned add_const_cost (enum machine_mode, bool);
unsigned extend_or_trunc_reg_cost (tree, tree, bool);
unsigned negate_reg_cost (enum machine_mode, bool);
bool may_be_nonaddressable_p (tree expr);
/* In tree-ssa-threadupdate.c. */
......
......@@ -556,7 +556,7 @@ most_expensive_mult_to_index (tree type, struct mem_address *parts,
|| !multiplier_allowed_in_address_p (coef, TYPE_MODE (type), as))
continue;
acost = multiply_by_cost (coef, address_mode, speed);
acost = multiply_by_const_cost (coef, address_mode, speed);
if (acost > best_mult_cost)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment