re PR bootstrap/49914 (call to abs(long long) in gcc/fold-const.c)
2011-08-02 Paolo Carlini <paolo.carlini@oracle.com> PR bootstrap/49914 * fold-const.c (fold_plusminus_mult_expr): Use abs_hwi instead of abs. * tree-ssa-math-opts.c (gimple_expand_builtin_pow): Likewise. * tree-ssa-loop-prefetch.c (prune_ref_by_group_reuse): Likewise. From-SVN: r177212
This commit is contained in:
parent
f315a6b438
commit
9f8139900d
|
@ -1,3 +1,11 @@
|
||||||
|
2011-08-02 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
|
PR bootstrap/49914
|
||||||
|
* fold-const.c (fold_plusminus_mult_expr): Use abs_hwi instead
|
||||||
|
of abs.
|
||||||
|
* tree-ssa-math-opts.c (gimple_expand_builtin_pow): Likewise.
|
||||||
|
* tree-ssa-loop-prefetch.c (prune_ref_by_group_reuse): Likewise.
|
||||||
|
|
||||||
2011-08-02 Richard Henderson <rth@redhat.com>
|
2011-08-02 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
* config/h8300/h8300.c (push, pop): Return the insn.
|
* config/h8300/h8300.c (push, pop): Return the insn.
|
||||||
|
|
|
@ -7037,8 +7037,7 @@ fold_plusminus_mult_expr (location_t loc, enum tree_code code, tree type,
|
||||||
int11 = TREE_INT_CST_LOW (arg11);
|
int11 = TREE_INT_CST_LOW (arg11);
|
||||||
|
|
||||||
/* Move min of absolute values to int11. */
|
/* Move min of absolute values to int11. */
|
||||||
if ((int01 >= 0 ? int01 : -int01)
|
if (abs_hwi (int01) < abs_hwi (int11))
|
||||||
< (int11 >= 0 ? int11 : -int11))
|
|
||||||
{
|
{
|
||||||
tmp = int01, int01 = int11, int11 = tmp;
|
tmp = int01, int01 = int11, int11 = tmp;
|
||||||
alt0 = arg00, arg00 = arg10, arg10 = alt0;
|
alt0 = arg00, arg00 = arg10, arg10 = alt0;
|
||||||
|
@ -7048,7 +7047,7 @@ fold_plusminus_mult_expr (location_t loc, enum tree_code code, tree type,
|
||||||
else
|
else
|
||||||
maybe_same = arg11;
|
maybe_same = arg11;
|
||||||
|
|
||||||
if (exact_log2 (abs (int11)) > 0 && int01 % int11 == 0
|
if (exact_log2 (abs_hwi (int11)) > 0 && int01 % int11 == 0
|
||||||
/* The remainder should not be a constant, otherwise we
|
/* The remainder should not be a constant, otherwise we
|
||||||
end up folding i * 4 + 2 to (i * 2 + 1) * 2 which has
|
end up folding i * 4 + 2 to (i * 2 + 1) * 2 which has
|
||||||
increased the number of multiplications necessary. */
|
increased the number of multiplications necessary. */
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Array prefetching.
|
/* Array prefetching.
|
||||||
Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GCC.
|
This file is part of GCC.
|
||||||
|
|
||||||
|
@ -794,7 +795,7 @@ prune_ref_by_group_reuse (struct mem_ref *ref, struct mem_ref *by,
|
||||||
prefetch_before = (hit_from - delta_r + step - 1) / step;
|
prefetch_before = (hit_from - delta_r + step - 1) / step;
|
||||||
|
|
||||||
/* Do not reduce prefetch_before if we meet beyond cache size. */
|
/* Do not reduce prefetch_before if we meet beyond cache size. */
|
||||||
if (prefetch_before > (unsigned) abs (L2_CACHE_SIZE_BYTES / step))
|
if (prefetch_before > (unsigned) abs_hwi (L2_CACHE_SIZE_BYTES / step))
|
||||||
prefetch_before = PREFETCH_ALL;
|
prefetch_before = PREFETCH_ALL;
|
||||||
if (prefetch_before < ref->prefetch_before)
|
if (prefetch_before < ref->prefetch_before)
|
||||||
ref->prefetch_before = prefetch_before;
|
ref->prefetch_before = prefetch_before;
|
||||||
|
|
|
@ -1231,9 +1231,10 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
|
||||||
/* Attempt to fold powi(arg0, abs(n/2)) into multiplies. If not
|
/* Attempt to fold powi(arg0, abs(n/2)) into multiplies. If not
|
||||||
possible or profitable, give up. Skip the degenerate case when
|
possible or profitable, give up. Skip the degenerate case when
|
||||||
n is 1 or -1, where the result is always 1. */
|
n is 1 or -1, where the result is always 1. */
|
||||||
if (abs (n) != 1)
|
if (abs_hwi (n) != 1)
|
||||||
{
|
{
|
||||||
powi_x_ndiv2 = gimple_expand_builtin_powi (gsi, loc, arg0, abs(n/2));
|
powi_x_ndiv2 = gimple_expand_builtin_powi (gsi, loc, arg0,
|
||||||
|
abs_hwi (n / 2));
|
||||||
if (!powi_x_ndiv2)
|
if (!powi_x_ndiv2)
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
}
|
}
|
||||||
|
@ -1242,7 +1243,7 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
|
||||||
result of the optimal multiply sequence just calculated. */
|
result of the optimal multiply sequence just calculated. */
|
||||||
sqrt_arg0 = build_and_insert_call (gsi, loc, &target, sqrtfn, arg0);
|
sqrt_arg0 = build_and_insert_call (gsi, loc, &target, sqrtfn, arg0);
|
||||||
|
|
||||||
if (abs (n) == 1)
|
if (abs_hwi (n) == 1)
|
||||||
result = sqrt_arg0;
|
result = sqrt_arg0;
|
||||||
else
|
else
|
||||||
result = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
|
result = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
|
||||||
|
@ -1284,10 +1285,10 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
|
||||||
/* Attempt to fold powi(arg0, abs(n/3)) into multiplies. If not
|
/* Attempt to fold powi(arg0, abs(n/3)) into multiplies. If not
|
||||||
possible or profitable, give up. Skip the degenerate case when
|
possible or profitable, give up. Skip the degenerate case when
|
||||||
abs(n) < 3, where the result is always 1. */
|
abs(n) < 3, where the result is always 1. */
|
||||||
if (abs (n) >= 3)
|
if (abs_hwi (n) >= 3)
|
||||||
{
|
{
|
||||||
powi_x_ndiv3 = gimple_expand_builtin_powi (gsi, loc, arg0,
|
powi_x_ndiv3 = gimple_expand_builtin_powi (gsi, loc, arg0,
|
||||||
abs (n / 3));
|
abs_hwi (n / 3));
|
||||||
if (!powi_x_ndiv3)
|
if (!powi_x_ndiv3)
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
}
|
}
|
||||||
|
@ -1297,14 +1298,14 @@ gimple_expand_builtin_pow (gimple_stmt_iterator *gsi, location_t loc,
|
||||||
either cbrt(x) or cbrt(x) * cbrt(x). */
|
either cbrt(x) or cbrt(x) * cbrt(x). */
|
||||||
cbrt_x = build_and_insert_call (gsi, loc, &target, cbrtfn, arg0);
|
cbrt_x = build_and_insert_call (gsi, loc, &target, cbrtfn, arg0);
|
||||||
|
|
||||||
if (abs (n) % 3 == 1)
|
if (abs_hwi (n) % 3 == 1)
|
||||||
powi_cbrt_x = cbrt_x;
|
powi_cbrt_x = cbrt_x;
|
||||||
else
|
else
|
||||||
powi_cbrt_x = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
|
powi_cbrt_x = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
|
||||||
cbrt_x, cbrt_x);
|
cbrt_x, cbrt_x);
|
||||||
|
|
||||||
/* Multiply the two subexpressions, unless powi(x,abs(n)/3) = 1. */
|
/* Multiply the two subexpressions, unless powi(x,abs(n)/3) = 1. */
|
||||||
if (abs (n) < 3)
|
if (abs_hwi (n) < 3)
|
||||||
result = powi_cbrt_x;
|
result = powi_cbrt_x;
|
||||||
else
|
else
|
||||||
result = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
|
result = build_and_insert_binop (gsi, loc, target, MULT_EXPR,
|
||||||
|
|
Loading…
Reference in New Issue