Commit 69660a70 by Bernd Schmidt Committed by Bernd Schmidt

optabs.c (expand_binop): Use GET_MODE_PRECISION instead of GET_MODE_BITSIZE where appropriate.

	* optabs.c (expand_binop): Use GET_MODE_PRECISION instead of
	GET_MODE_BITSIZE where appropriate.
	(widen_leading, expand_parity, expand_ctz, expand_ffs,
	expand_unop, expand_abs_nojump, expand_one_cmpl_abs_nojump,
	expand_float, expand_fix): Likewise.
	* expr.c (convert_move, convert_modes, expand_expr_real_2,
	expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
	* cfgexpand.c (convert_debug_memory_address, expand_debug_expr):
	Likewise.
	* convert.c (convert_to_integer): Likewise.
	* expmed.c (expand_shift_1): Likewise.

From-SVN: r176038
parent 2c50b2c3
2011-07-08 Bernd Schmidt <bernds@codesourcery.com>
* optabs.c (expand_binop): Use GET_MODE_PRECISION instead of
GET_MODE_BITSIZE where appropriate.
(widen_leading, expand_parity, expand_ctz, expand_ffs,
expand_unop, expand_abs_nojump, expand_one_cmpl_abs_nojump,
expand_float, expand_fix): Likewise.
* expr.c (convert_move, convert_modes, expand_expr_real_2,
expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
* stor-layout.c (get_mode_bounds): Likewise.
* cfgexpand.c (convert_debug_memory_address, expand_debug_expr):
Likewise.
* convert.c (convert_to_integer): Likewise.
* expmed.c (expand_shift_1): Likewise.
2011-07-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* Makefile.in (LIBGCOV): Remove.
......
......@@ -2303,7 +2303,7 @@ convert_debug_memory_address (enum machine_mode mode, rtx x,
if (GET_MODE (x) == mode || GET_MODE (x) == VOIDmode)
return x;
if (GET_MODE_BITSIZE (mode) < GET_MODE_BITSIZE (xmode))
if (GET_MODE_PRECISION (mode) < GET_MODE_PRECISION (xmode))
x = simplify_gen_subreg (mode, x, xmode,
subreg_lowpart_offset
(mode, xmode));
......@@ -2558,7 +2558,7 @@ expand_debug_expr (tree exp)
op0 = simplify_gen_unary (FIX, mode, op0, inner_mode);
}
else if (CONSTANT_P (op0)
|| GET_MODE_BITSIZE (mode) <= GET_MODE_BITSIZE (inner_mode))
|| GET_MODE_PRECISION (mode) <= GET_MODE_PRECISION (inner_mode))
op0 = simplify_gen_subreg (mode, op0, inner_mode,
subreg_lowpart_offset (mode,
inner_mode));
......
......@@ -583,7 +583,7 @@ convert_to_integer (tree type, tree expr)
be cleared. */
if (TYPE_UNSIGNED (type) != TYPE_UNSIGNED (TREE_TYPE (expr))
&& (TYPE_PRECISION (TREE_TYPE (expr))
!= GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (expr)))))
!= GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (expr)))))
code = CONVERT_EXPR;
else
code = NOP_EXPR;
......@@ -602,7 +602,7 @@ convert_to_integer (tree type, tree expr)
type corresponding to its mode, then do a nop conversion
to TYPE. */
else if (TREE_CODE (type) == ENUMERAL_TYPE
|| outprec != GET_MODE_BITSIZE (TYPE_MODE (type)))
|| outprec != GET_MODE_PRECISION (TYPE_MODE (type)))
return build1 (NOP_EXPR, type,
convert (lang_hooks.types.type_for_mode
(TYPE_MODE (type), TYPE_UNSIGNED (type)),
......
......@@ -2090,7 +2090,7 @@ expand_shift_1 (enum tree_code code, enum machine_mode mode, rtx shifted,
if (code == LSHIFT_EXPR
&& CONST_INT_P (op1)
&& INTVAL (op1) > 0
&& INTVAL (op1) < GET_MODE_BITSIZE (mode)
&& INTVAL (op1) < GET_MODE_PRECISION (mode)
&& INTVAL (op1) < MAX_BITS_PER_WORD
&& shift_cost[speed][mode][INTVAL (op1)] > INTVAL (op1) * add_cost[speed][mode]
&& shift_cost[speed][mode][INTVAL (op1)] != MAX_COST)
......@@ -2146,7 +2146,7 @@ expand_shift_1 (enum tree_code code, enum machine_mode mode, rtx shifted,
else
other_amount
= simplify_gen_binary (MINUS, GET_MODE (op1),
GEN_INT (GET_MODE_BITSIZE (mode)),
GEN_INT (GET_MODE_PRECISION (mode)),
op1);
shifted = force_reg (mode, shifted);
......
......@@ -336,8 +336,8 @@ convert_move (rtx to, rtx from, int unsignedp)
TO here. */
if (GET_CODE (from) == SUBREG && SUBREG_PROMOTED_VAR_P (from)
&& (GET_MODE_SIZE (GET_MODE (SUBREG_REG (from)))
>= GET_MODE_SIZE (to_mode))
&& (GET_MODE_PRECISION (GET_MODE (SUBREG_REG (from)))
>= GET_MODE_PRECISION (to_mode))
&& SUBREG_PROMOTED_UNSIGNED_P (from) == unsignedp)
from = gen_lowpart (to_mode, from), from_mode = to_mode;
......@@ -478,8 +478,8 @@ convert_move (rtx to, rtx from, int unsignedp)
/* Now both modes are integers. */
/* Handle expanding beyond a word. */
if (GET_MODE_BITSIZE (from_mode) < GET_MODE_BITSIZE (to_mode)
&& GET_MODE_BITSIZE (to_mode) > BITS_PER_WORD)
if (GET_MODE_PRECISION (from_mode) < GET_MODE_PRECISION (to_mode)
&& GET_MODE_PRECISION (to_mode) > BITS_PER_WORD)
{
rtx insns;
rtx lowpart;
......@@ -503,7 +503,7 @@ convert_move (rtx to, rtx from, int unsignedp)
return;
}
/* Next, try converting via full word. */
else if (GET_MODE_BITSIZE (from_mode) < BITS_PER_WORD
else if (GET_MODE_PRECISION (from_mode) < BITS_PER_WORD
&& ((code = can_extend_p (to_mode, word_mode, unsignedp))
!= CODE_FOR_nothing))
{
......@@ -529,7 +529,7 @@ convert_move (rtx to, rtx from, int unsignedp)
from = force_reg (from_mode, from);
/* Get a copy of FROM widened to a word, if necessary. */
if (GET_MODE_BITSIZE (from_mode) < BITS_PER_WORD)
if (GET_MODE_PRECISION (from_mode) < BITS_PER_WORD)
lowpart_mode = word_mode;
else
lowpart_mode = from_mode;
......@@ -567,8 +567,8 @@ convert_move (rtx to, rtx from, int unsignedp)
}
/* Truncating multi-word to a word or less. */
if (GET_MODE_BITSIZE (from_mode) > BITS_PER_WORD
&& GET_MODE_BITSIZE (to_mode) <= BITS_PER_WORD)
if (GET_MODE_PRECISION (from_mode) > BITS_PER_WORD
&& GET_MODE_PRECISION (to_mode) <= BITS_PER_WORD)
{
if (!((MEM_P (from)
&& ! MEM_VOLATILE_P (from)
......@@ -603,7 +603,7 @@ convert_move (rtx to, rtx from, int unsignedp)
}
/* Handle extension. */
if (GET_MODE_BITSIZE (to_mode) > GET_MODE_BITSIZE (from_mode))
if (GET_MODE_PRECISION (to_mode) > GET_MODE_PRECISION (from_mode))
{
/* Convert directly if that works. */
if ((code = can_extend_p (to_mode, from_mode, unsignedp))
......@@ -635,8 +635,8 @@ convert_move (rtx to, rtx from, int unsignedp)
/* No suitable intermediate mode.
Generate what we need with shifts. */
shift_amount = (GET_MODE_BITSIZE (to_mode)
- GET_MODE_BITSIZE (from_mode));
shift_amount = (GET_MODE_PRECISION (to_mode)
- GET_MODE_PRECISION (from_mode));
from = gen_lowpart (to_mode, force_reg (from_mode, from));
tmp = expand_shift (LSHIFT_EXPR, to_mode, from, shift_amount,
to, unsignedp);
......@@ -664,7 +664,7 @@ convert_move (rtx to, rtx from, int unsignedp)
??? Code above formerly short-circuited this, for most integer
mode pairs, with a force_reg in from_mode followed by a recursive
call to this routine. Appears always to have been wrong. */
if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode))
if (GET_MODE_PRECISION (to_mode) < GET_MODE_PRECISION (from_mode))
{
rtx temp = force_reg (to_mode, gen_lowpart (to_mode, from));
emit_move_insn (to, temp);
......@@ -742,11 +742,11 @@ convert_modes (enum machine_mode mode, enum machine_mode oldmode, rtx x, int uns
wider than HOST_BITS_PER_WIDE_INT, we must be narrowing the operand. */
if ((CONST_INT_P (x)
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
&& GET_MODE_PRECISION (mode) <= HOST_BITS_PER_WIDE_INT)
|| (GET_MODE_CLASS (mode) == MODE_INT
&& GET_MODE_CLASS (oldmode) == MODE_INT
&& (GET_CODE (x) == CONST_DOUBLE
|| (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (oldmode)
|| (GET_MODE_PRECISION (mode) <= GET_MODE_PRECISION (oldmode)
&& ((MEM_P (x) && ! MEM_VOLATILE_P (x)
&& direct_load[(int) mode])
|| (REG_P (x)
......@@ -759,7 +759,7 @@ convert_modes (enum machine_mode mode, enum machine_mode oldmode, rtx x, int uns
X does not need sign- or zero-extension. This may not be
the case, but it's the best we can do. */
if (CONST_INT_P (x) && oldmode != VOIDmode
&& GET_MODE_SIZE (mode) > GET_MODE_SIZE (oldmode))
&& GET_MODE_PRECISION (mode) > GET_MODE_PRECISION (oldmode))
{
HOST_WIDE_INT val = INTVAL (x);
......@@ -4279,7 +4279,7 @@ expand_assignment (tree to, tree from, bool nontemporal)
if (!MEM_P (to_rtx)
&& GET_MODE (to_rtx) != BLKmode
&& (unsigned HOST_WIDE_INT) bitpos
>= GET_MODE_BITSIZE (GET_MODE (to_rtx)))
>= GET_MODE_PRECISION (GET_MODE (to_rtx)))
{
expand_normal (from);
result = NULL;
......@@ -7476,7 +7476,7 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
if (modifier == EXPAND_STACK_PARM)
target = 0;
if (TREE_CODE (treeop0) == INTEGER_CST
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
&& GET_MODE_PRECISION (mode) <= HOST_BITS_PER_WIDE_INT
&& TREE_CONSTANT (treeop1))
{
rtx constant_part;
......@@ -7498,7 +7498,7 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
}
else if (TREE_CODE (treeop1) == INTEGER_CST
&& GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
&& GET_MODE_PRECISION (mode) <= HOST_BITS_PER_WIDE_INT
&& TREE_CONSTANT (treeop0))
{
rtx constant_part;
......@@ -8968,7 +8968,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
we can't do this optimization. */
&& (! DECL_BIT_FIELD (field)
|| ((GET_MODE_CLASS (DECL_MODE (field)) == MODE_INT)
&& (GET_MODE_BITSIZE (DECL_MODE (field))
&& (GET_MODE_PRECISION (DECL_MODE (field))
<= HOST_BITS_PER_WIDE_INT))))
{
if (DECL_BIT_FIELD (field)
......@@ -8987,7 +8987,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
}
else
{
int count = GET_MODE_BITSIZE (imode) - bitsize;
int count = GET_MODE_PRECISION (imode) - bitsize;
op0 = expand_shift (LSHIFT_EXPR, imode, op0, count,
target, 0);
......@@ -9431,7 +9431,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* If neither mode is BLKmode, and both modes are the same size
then we can use gen_lowpart. */
else if (mode != BLKmode && GET_MODE (op0) != BLKmode
&& GET_MODE_SIZE (mode) == GET_MODE_SIZE (GET_MODE (op0))
&& (GET_MODE_PRECISION (mode)
== GET_MODE_PRECISION (GET_MODE (op0)))
&& !COMPLEX_MODE_P (GET_MODE (op0)))
{
if (GET_CODE (op0) == SUBREG)
......@@ -9754,7 +9755,7 @@ reduce_to_bit_field_precision (rtx exp, rtx target, tree type)
}
else
{
int count = GET_MODE_BITSIZE (GET_MODE (exp)) - prec;
int count = GET_MODE_PRECISION (GET_MODE (exp)) - prec;
exp = expand_shift (LSHIFT_EXPR, GET_MODE (exp),
exp, count, target, 0);
return expand_shift (RSHIFT_EXPR, GET_MODE (exp),
......
......@@ -1407,7 +1407,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
{
optab otheroptab = (binoptab == rotl_optab ? rotr_optab : rotl_optab);
rtx newop1;
unsigned int bits = GET_MODE_BITSIZE (mode);
unsigned int bits = GET_MODE_PRECISION (mode);
if (CONST_INT_P (op1))
newop1 = GEN_INT (bits - INTVAL (op1));
......@@ -2353,8 +2353,8 @@ widen_leading (enum machine_mode mode, rtx op0, rtx target, optab unoptab)
unoptab != clrsb_optab);
if (temp != 0)
temp = expand_binop (wider_mode, sub_optab, temp,
GEN_INT (GET_MODE_BITSIZE (wider_mode)
- GET_MODE_BITSIZE (mode)),
GEN_INT (GET_MODE_PRECISION (wider_mode)
- GET_MODE_PRECISION (mode)),
target, true, OPTAB_DIRECT);
if (temp == 0)
delete_insns_since (last);
......@@ -2540,7 +2540,7 @@ expand_parity (enum machine_mode mode, rtx op0, rtx target)
}
/* Try calculating ctz(x) as K - clz(x & -x) ,
where K is GET_MODE_BITSIZE(mode) - 1.
where K is GET_MODE_PRECISION(mode) - 1.
Both __builtin_ctz and __builtin_clz are undefined at zero, so we
don't have to worry about what the hardware does in that case. (If
......@@ -2568,7 +2568,7 @@ expand_ctz (enum machine_mode mode, rtx op0, rtx target)
if (temp)
temp = expand_unop_direct (mode, clz_optab, temp, NULL_RTX, true);
if (temp)
temp = expand_binop (mode, sub_optab, GEN_INT (GET_MODE_BITSIZE (mode) - 1),
temp = expand_binop (mode, sub_optab, GEN_INT (GET_MODE_PRECISION (mode) - 1),
temp, target,
true, OPTAB_DIRECT);
if (temp == 0)
......@@ -2619,7 +2619,7 @@ expand_ffs (enum machine_mode mode, rtx op0, rtx target)
if (CLZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2)
{
defined_at_zero = true;
val = (GET_MODE_BITSIZE (mode) - 1) - val;
val = (GET_MODE_PRECISION (mode) - 1) - val;
}
}
else
......@@ -3077,8 +3077,8 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
if ((unoptab == clz_optab || unoptab == clrsb_optab)
&& temp != 0)
temp = expand_binop (wider_mode, sub_optab, temp,
GEN_INT (GET_MODE_BITSIZE (wider_mode)
- GET_MODE_BITSIZE (mode)),
GEN_INT (GET_MODE_PRECISION (wider_mode)
- GET_MODE_PRECISION (mode)),
target, true, OPTAB_DIRECT);
if (temp)
......@@ -3173,7 +3173,7 @@ expand_abs_nojump (enum machine_mode mode, rtx op0, rtx target,
false) >= 2)
{
rtx extended = expand_shift (RSHIFT_EXPR, mode, op0,
GET_MODE_BITSIZE (mode) - 1,
GET_MODE_PRECISION (mode) - 1,
NULL_RTX, 0);
temp = expand_binop (mode, xor_optab, extended, op0, target, 0,
......@@ -3274,7 +3274,7 @@ expand_one_cmpl_abs_nojump (enum machine_mode mode, rtx op0, rtx target)
false) >= 2)
{
rtx extended = expand_shift (RSHIFT_EXPR, mode, op0,
GET_MODE_BITSIZE (mode) - 1,
GET_MODE_PRECISION (mode) - 1,
NULL_RTX, 0);
temp = expand_binop (mode, xor_optab, extended, op0, target, 0,
......@@ -4663,7 +4663,7 @@ expand_float (rtx to, rtx from, int unsignedp)
int doing_unsigned = unsignedp;
if (fmode != GET_MODE (to)
&& significand_size (fmode) < GET_MODE_BITSIZE (GET_MODE (from)))
&& significand_size (fmode) < GET_MODE_PRECISION (GET_MODE (from)))
continue;
icode = can_float_p (fmode, imode, unsignedp);
......@@ -4707,7 +4707,7 @@ expand_float (rtx to, rtx from, int unsignedp)
for (fmode = GET_MODE (to); fmode != VOIDmode;
fmode = GET_MODE_WIDER_MODE (fmode))
if (GET_MODE_BITSIZE (GET_MODE (from)) < GET_MODE_BITSIZE (fmode)
if (GET_MODE_PRECISION (GET_MODE (from)) < GET_MODE_BITSIZE (fmode)
&& can_float_p (fmode, GET_MODE (from), 0) != CODE_FOR_nothing)
break;
......@@ -4718,7 +4718,7 @@ expand_float (rtx to, rtx from, int unsignedp)
/* Avoid double-rounding when TO is narrower than FROM. */
if ((significand_size (fmode) + 1)
< GET_MODE_BITSIZE (GET_MODE (from)))
< GET_MODE_PRECISION (GET_MODE (from)))
{
rtx temp1;
rtx neglabel = gen_label_rtx ();
......@@ -4785,7 +4785,7 @@ expand_float (rtx to, rtx from, int unsignedp)
0, label);
real_2expN (&offset, GET_MODE_BITSIZE (GET_MODE (from)), fmode);
real_2expN (&offset, GET_MODE_PRECISION (GET_MODE (from)), fmode);
temp = expand_binop (fmode, add_optab, target,
CONST_DOUBLE_FROM_REAL_VALUE (offset, fmode),
target, 0, OPTAB_LIB_WIDEN);
......@@ -4915,18 +4915,18 @@ expand_fix (rtx to, rtx from, int unsignedp)
2^63. The subtraction of 2^63 should not generate any rounding as it
simply clears out that bit. The rest is trivial. */
if (unsignedp && GET_MODE_BITSIZE (GET_MODE (to)) <= HOST_BITS_PER_WIDE_INT)
if (unsignedp && GET_MODE_PRECISION (GET_MODE (to)) <= HOST_BITS_PER_WIDE_INT)
for (fmode = GET_MODE (from); fmode != VOIDmode;
fmode = GET_MODE_WIDER_MODE (fmode))
if (CODE_FOR_nothing != can_fix_p (GET_MODE (to), fmode, 0, &must_trunc)
&& (!DECIMAL_FLOAT_MODE_P (fmode)
|| GET_MODE_BITSIZE (fmode) > GET_MODE_BITSIZE (GET_MODE (to))))
|| GET_MODE_BITSIZE (fmode) > GET_MODE_PRECISION (GET_MODE (to))))
{
int bitsize;
REAL_VALUE_TYPE offset;
rtx limit, lab1, lab2, insn;
bitsize = GET_MODE_BITSIZE (GET_MODE (to));
bitsize = GET_MODE_PRECISION (GET_MODE (to));
real_2expN (&offset, bitsize - 1, fmode);
limit = CONST_DOUBLE_FROM_REAL_VALUE (offset, fmode);
lab1 = gen_label_rtx ();
......
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