machmode.h (TRULY_NOOP_TRUNCATION_MODES_P): New macro.

* machmode.h (TRULY_NOOP_TRUNCATION_MODES_P): New macro.
	* combine.c (make_extraction, gen_lowpart_or_truncate,
	apply_distributive_law, simplify_comparison,
	reg_truncated_to_mode, record_truncated_value): Use it.
	* cse.c (notreg_cost): Likewise.
	* expmed.c (store_bit_field_1, extract_bit_field_1): Likewise.
	* expr.c (convert_move, convert_modes): Likewise.
	* optabs.c (expand_binop, expand_unop): Likewise.
	* postreload.c (move2add_last_label): Likewise.
	* regmove.c (optimize_reg_copy_3): Likewise.
	* rtlhooks.c (gen_lowpart_general): Likewise.
	* simplify-rtx.c (simplify_unary_operation_1): Likewise.

From-SVN: r175921
This commit is contained in:
Bernd Schmidt 2011-07-06 14:44:30 +00:00 committed by Bernd Schmidt
parent e5cabdfba8
commit d0edd768de
12 changed files with 47 additions and 48 deletions

View file

@ -1,3 +1,18 @@
2011-07-06 Bernd Schmidt <bernds@codesourcery.com>
* machmode.h (TRULY_NOOP_TRUNCATION_MODES_P): New macro.
* combine.c (make_extraction, gen_lowpart_or_truncate,
apply_distributive_law, simplify_comparison,
reg_truncated_to_mode, record_truncated_value): Use it.
* cse.c (notreg_cost): Likewise.
* expmed.c (store_bit_field_1, extract_bit_field_1): Likewise.
* expr.c (convert_move, convert_modes): Likewise.
* optabs.c (expand_binop, expand_unop): Likewise.
* postreload.c (move2add_last_label): Likewise.
* regmove.c (optimize_reg_copy_3): Likewise.
* rtlhooks.c (gen_lowpart_general): Likewise.
* simplify-rtx.c (simplify_unary_operation_1): Likewise.
2011-07-06 Joseph Myers <joseph@codesourcery.com>
* config/rs6000/vxworks.h (WORDS_BIG_ENDIAN): Define.

View file

@ -7146,8 +7146,7 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
&& !MEM_P (inner)
&& (inner_mode == tmode
|| !REG_P (inner)
|| TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (tmode),
GET_MODE_BITSIZE (inner_mode))
|| TRULY_NOOP_TRUNCATION_MODES_P (tmode, inner_mode)
|| reg_truncated_to_mode (tmode, inner))
&& (! in_dest
|| (REG_P (inner)
@ -7416,8 +7415,8 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
/* On the LHS, don't create paradoxical subregs implicitely truncating
the register unless TRULY_NOOP_TRUNCATION. */
if (in_dest
&& !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE (inner)),
GET_MODE_BITSIZE (wanted_inner_mode)))
&& !TRULY_NOOP_TRUNCATION_MODES_P (GET_MODE (inner),
wanted_inner_mode))
return NULL_RTX;
if (GET_MODE (inner) != wanted_inner_mode
@ -8053,8 +8052,7 @@ gen_lowpart_or_truncate (enum machine_mode mode, rtx x)
{
if (!CONST_INT_P (x)
&& GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (x))
&& !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (GET_MODE (x)))
&& !TRULY_NOOP_TRUNCATION_MODES_P (mode, GET_MODE (x))
&& !(REG_P (x) && reg_truncated_to_mode (mode, x)))
{
/* Bit-cast X into an integer mode. */
@ -9268,9 +9266,8 @@ apply_distributive_law (rtx x)
|| GET_MODE_SIZE (GET_MODE (SUBREG_REG (lhs))) > UNITS_PER_WORD
/* Result might need to be truncated. Don't change mode if
explicit truncation is needed. */
|| !TRULY_NOOP_TRUNCATION
(GET_MODE_BITSIZE (GET_MODE (x)),
GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (lhs)))))
|| !TRULY_NOOP_TRUNCATION_MODES_P (GET_MODE (x),
GET_MODE (SUBREG_REG (lhs))))
return x;
tem = simplify_gen_binary (code, GET_MODE (SUBREG_REG (lhs)),
@ -11699,8 +11696,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
+ 1)) >= 0
&& const_op >> i == 0
&& (tmode = mode_for_size (i, MODE_INT, 1)) != BLKmode
&& (TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (tmode),
GET_MODE_BITSIZE (GET_MODE (op0)))
&& (TRULY_NOOP_TRUNCATION_MODES_P (tmode, GET_MODE (op0))
|| (REG_P (XEXP (op0, 0))
&& reg_truncated_to_mode (tmode, XEXP (op0, 0)))))
{
@ -12513,8 +12509,7 @@ reg_truncated_to_mode (enum machine_mode mode, const_rtx x)
return false;
if (GET_MODE_SIZE (truncated) <= GET_MODE_SIZE (mode))
return true;
if (TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (truncated)))
if (TRULY_NOOP_TRUNCATION_MODES_P (mode, truncated))
return true;
return false;
}
@ -12539,8 +12534,7 @@ record_truncated_value (rtx *p, void *data ATTRIBUTE_UNUSED)
if (GET_MODE_SIZE (original_mode) <= GET_MODE_SIZE (truncated_mode))
return -1;
if (TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (truncated_mode),
GET_MODE_BITSIZE (original_mode)))
if (TRULY_NOOP_TRUNCATION_MODES_P (truncated_mode, original_mode))
return -1;
x = SUBREG_REG (x);

View file

@ -761,8 +761,8 @@ notreg_cost (rtx x, enum rtx_code outer)
&& (GET_MODE_SIZE (GET_MODE (x))
< GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
&& subreg_lowpart_p (x)
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE (x)),
GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x)))))
&& TRULY_NOOP_TRUNCATION_MODES_P (GET_MODE (x),
GET_MODE (SUBREG_REG (x))))
? 0
: rtx_cost (x, outer, optimize_this_for_speed_p) * 2);
}

View file

@ -1722,8 +1722,7 @@ find_shift_sequence (int access_size,
/* Try a wider mode if truncating the store mode to NEW_MODE
requires a real instruction. */
if (GET_MODE_BITSIZE (new_mode) < GET_MODE_BITSIZE (store_mode)
&& !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (new_mode),
GET_MODE_BITSIZE (store_mode)))
&& !TRULY_NOOP_TRUNCATION_MODES_P (new_mode, store_mode))
continue;
/* Also try a wider mode if the necessary punning is either not

View file

@ -635,9 +635,8 @@ store_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
X) 0)) is (reg:N X). */
if (GET_CODE (xop0) == SUBREG
&& REG_P (SUBREG_REG (xop0))
&& (!TRULY_NOOP_TRUNCATION
(GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (xop0))),
GET_MODE_BITSIZE (op_mode))))
&& (!TRULY_NOOP_TRUNCATION_MODES_P (GET_MODE (SUBREG_REG (xop0)),
op_mode)))
{
rtx tem = gen_reg_rtx (op_mode);
emit_move_insn (tem, xop0);
@ -1304,8 +1303,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
? bitpos + bitsize == BITS_PER_WORD
: bitpos == 0)))
&& ((!MEM_P (op0)
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode1),
GET_MODE_BITSIZE (GET_MODE (op0)))
&& TRULY_NOOP_TRUNCATION_MODES_P (mode1, GET_MODE (op0))
&& GET_MODE_SIZE (mode1) != 0
&& byte_offset % GET_MODE_SIZE (mode1) == 0)
|| (MEM_P (op0)
@ -1475,8 +1473,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
mode. Instead, create a temporary and use convert_move to set
the target. */
if (REG_P (xtarget)
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE (xtarget)),
GET_MODE_BITSIZE (ext_mode)))
&& TRULY_NOOP_TRUNCATION_MODES_P (GET_MODE (xtarget), ext_mode))
{
xtarget = gen_lowpart (ext_mode, xtarget);
if (GET_MODE_SIZE (ext_mode)

View file

@ -586,8 +586,7 @@ convert_move (rtx to, rtx from, int unsignedp)
/* For truncation, usually we can just refer to FROM in a narrower mode. */
if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode)
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (to_mode),
GET_MODE_BITSIZE (from_mode)))
&& TRULY_NOOP_TRUNCATION_MODES_P (to_mode, from_mode))
{
if (!((MEM_P (from)
&& ! MEM_VOLATILE_P (from)
@ -625,8 +624,7 @@ convert_move (rtx to, rtx from, int unsignedp)
if (((can_extend_p (to_mode, intermediate, unsignedp)
!= CODE_FOR_nothing)
|| (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (intermediate)
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (to_mode),
GET_MODE_BITSIZE (intermediate))))
&& TRULY_NOOP_TRUNCATION_MODES_P (to_mode, intermediate)))
&& (can_extend_p (intermediate, from_mode, unsignedp)
!= CODE_FOR_nothing))
{
@ -754,8 +752,8 @@ convert_modes (enum machine_mode mode, enum machine_mode oldmode, rtx x, int uns
|| (REG_P (x)
&& (! HARD_REGISTER_P (x)
|| HARD_REGNO_MODE_OK (REGNO (x), mode))
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (GET_MODE (x)))))))))
&& TRULY_NOOP_TRUNCATION_MODES_P (mode,
GET_MODE (x))))))))
{
/* ?? If we don't know OLDMODE, we have to assume here that
X does not need sign- or zero-extension. This may not be

View file

@ -275,4 +275,8 @@ extern enum machine_mode ptr_mode;
/* Target-dependent machine mode initialization - in insn-modes.c. */
extern void init_adjust_machine_modes (void);
#define TRULY_NOOP_TRUNCATION_MODES_P(MODE1, MODE2) \
TRULY_NOOP_TRUNCATION (GET_MODE_PRECISION (MODE1), \
GET_MODE_PRECISION (MODE2))
#endif /* not HAVE_MACHINE_MODES */

View file

@ -1440,8 +1440,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
if (temp != 0)
{
if (GET_MODE_CLASS (mode) == MODE_INT
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (GET_MODE (temp))))
&& TRULY_NOOP_TRUNCATION_MODES_P (mode, GET_MODE (temp)))
return gen_lowpart (mode, temp);
else
return convert_to_mode (mode, temp, unsignedp);
@ -1498,8 +1497,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
if (temp)
{
if (mclass != MODE_INT
|| !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (wider_mode)))
|| !TRULY_NOOP_TRUNCATION_MODES_P (mode, wider_mode))
{
if (target == 0)
target = gen_reg_rtx (mode);
@ -2027,8 +2025,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
if (temp)
{
if (mclass != MODE_INT
|| !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (wider_mode)))
|| !TRULY_NOOP_TRUNCATION_MODES_P (mode, wider_mode))
{
if (target == 0)
target = gen_reg_rtx (mode);
@ -2915,8 +2912,7 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
if (temp)
{
if (mclass != MODE_INT
|| !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (wider_mode)))
|| !TRULY_NOOP_TRUNCATION_MODES_P (mode, wider_mode))
{
if (target == 0)
target = gen_reg_rtx (mode);

View file

@ -1643,8 +1643,7 @@ static int move2add_last_label_luid;
#define MODES_OK_FOR_MOVE2ADD(OUTMODE, INMODE) \
(GET_MODE_SIZE (OUTMODE) == GET_MODE_SIZE (INMODE) \
|| (GET_MODE_SIZE (OUTMODE) <= GET_MODE_SIZE (INMODE) \
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (OUTMODE), \
GET_MODE_BITSIZE (INMODE))))
&& TRULY_NOOP_TRUNCATION_MODES_P (OUTMODE, INMODE)))
/* This function is called with INSN that sets REG to (SYM + OFF),
while REG is known to already have value (SYM + offset).

View file

@ -548,8 +548,7 @@ optimize_reg_copy_3 (rtx insn, rtx dest, rtx src)
/* Do not use a SUBREG to truncate from one mode to another if truncation
is not a nop. */
if (GET_MODE_BITSIZE (GET_MODE (src_reg)) <= GET_MODE_BITSIZE (GET_MODE (src))
&& !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE (src)),
GET_MODE_BITSIZE (GET_MODE (src_reg))))
&& !TRULY_NOOP_TRUNCATION_MODES_P (GET_MODE (src), GET_MODE (src_reg)))
return;
set_insn = p;

View file

@ -61,8 +61,7 @@ gen_lowpart_general (enum machine_mode mode, rtx x)
/* The following exposes the use of "x" to CSE. */
if (GET_MODE_SIZE (GET_MODE (x)) <= UNITS_PER_WORD
&& SCALAR_INT_MODE_P (GET_MODE (x))
&& TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (GET_MODE (x)))
&& TRULY_NOOP_TRUNCATION_MODES_P (mode, GET_MODE (x))
&& !reload_completed)
return gen_lowpart_general (mode, force_reg (GET_MODE (x), x));

View file

@ -852,8 +852,7 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
truncation. But don't do this for an (LSHIFTRT (MULT ...))
since this will cause problems with the umulXi3_highpart
patterns. */
if ((TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
GET_MODE_BITSIZE (GET_MODE (op)))
if ((TRULY_NOOP_TRUNCATION_MODES_P (mode, GET_MODE (op))
? (num_sign_bit_copies (op, GET_MODE (op))
> (unsigned int) (GET_MODE_BITSIZE (GET_MODE (op))
- GET_MODE_BITSIZE (mode)))