summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-06 14:44:30 +0000
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-06 14:44:30 +0000
commit396f21304b3d9cdcaea3b88994cb049952ffc9cb (patch)
tree95d75bc9dd3fb8ff5d3161011734bcfd2796c8bf /gcc
parentb60af16f749ec4e5611c886b5ce7a80a64f62b6f (diff)
downloadgcc-396f21304b3d9cdcaea3b88994cb049952ffc9cb.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175921 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/combine.c24
-rw-r--r--gcc/cse.c4
-rw-r--r--gcc/dse.c3
-rw-r--r--gcc/expmed.c11
-rw-r--r--gcc/expr.c10
-rw-r--r--gcc/machmode.h4
-rw-r--r--gcc/optabs.c12
-rw-r--r--gcc/postreload.c3
-rw-r--r--gcc/regmove.c3
-rw-r--r--gcc/rtlhooks.c3
-rw-r--r--gcc/simplify-rtx.c3
12 files changed, 47 insertions, 48 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c38a1f1b4bb..3156a9be19d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/combine.c b/gcc/combine.c
index 7ac4613955c..9edfdd18b1c 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -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);
diff --git a/gcc/cse.c b/gcc/cse.c
index 9dc27c383e8..c75fd7b81ab 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -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);
}
diff --git a/gcc/dse.c b/gcc/dse.c
index 3646b0420e3..18926b28273 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -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
diff --git a/gcc/expmed.c b/gcc/expmed.c
index e9b6016cf8b..567f98d4da8 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -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)
diff --git a/gcc/expr.c b/gcc/expr.c
index e225d245a04..fd431c20011 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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
diff --git a/gcc/machmode.h b/gcc/machmode.h
index bdcd02d435d..30d1a8ccb38 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -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 */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index bf15ab4fbc6..1a8aebd9438 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -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);
diff --git a/gcc/postreload.c b/gcc/postreload.c
index e5c6ce7cdbc..72e487e057f 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -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).
diff --git a/gcc/regmove.c b/gcc/regmove.c
index 89dbd592103..a2baca1c3bb 100644
--- a/gcc/regmove.c
+++ b/gcc/regmove.c
@@ -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;
diff --git a/gcc/rtlhooks.c b/gcc/rtlhooks.c
index a64c0674dc8..60e4d52890e 100644
--- a/gcc/rtlhooks.c
+++ b/gcc/rtlhooks.c
@@ -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));
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 232776f5ade..80faaefb395 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -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)))