aboutsummaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
authorGabriel Dos Reis <gdr@integrable-solutions.net>2004-03-02 13:47:27 +0000
committerGabriel Dos Reis <gdr@integrable-solutions.net>2004-03-02 13:47:27 +0000
commit9b213be25d97c10c740d00af9d5b69e1b7eedc77 (patch)
tree8060520b512325787c6e70965aeda1c3ce35aea5 /gcc/reload1.c
parenta25966fb9ebec25dca22cad610f2b1ca12e5a1af (diff)
Backport from 3.4.0:
2004-02-29 Mark Mitchell <mark@codesourcery.com> PR debug/14328 * dwarf2out.c (gen_enumeration_type_die): Output all enumeration constants as signed values. 2004-01-16 J"orn Rennecke <joern.rennecke@superh.com> PR optimization/11864 * reload1.c (reload_cse_simplify_operands): Don't remove implicit extension from LOAD_EXTEND_OP. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-3_3-branch@78757 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 9624e166ee8..116f0a0ffeb 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -8363,6 +8363,8 @@ reload_cse_simplify_operands (insn, testreg)
{
cselib_val *v;
struct elt_loc_list *l;
+ rtx op;
+ enum machine_mode mode;
CLEAR_HARD_REG_SET (equiv_regs[i]);
@@ -8374,7 +8376,52 @@ reload_cse_simplify_operands (insn, testreg)
&& recog_data.operand_mode[i] == VOIDmode))
continue;
- v = cselib_lookup (recog_data.operand[i], recog_data.operand_mode[i], 0);
+ op = recog_data.operand[i];
+ mode = GET_MODE (op);
+#ifdef LOAD_EXTEND_OP
+ if (GET_CODE (op) == MEM
+ && GET_MODE_BITSIZE (mode) < BITS_PER_WORD
+ && LOAD_EXTEND_OP (mode) != NIL)
+ {
+ rtx set = single_set (insn);
+
+ /* We might have multiple sets, some of which do implict
+ extension. Punt on this for now. */
+ if (! set)
+ continue;
+ /* If the destination is a also MEM or a STRICT_LOW_PART, no
+ extension applies.
+ Also, if there is an explicit extension, we don't have to
+ worry about an implicit one. */
+ else if (GET_CODE (SET_DEST (set)) == MEM
+ || GET_CODE (SET_DEST (set)) == STRICT_LOW_PART
+ || GET_CODE (SET_SRC (set)) == ZERO_EXTEND
+ || GET_CODE (SET_SRC (set)) == SIGN_EXTEND)
+ ; /* Continue ordinary processing. */
+ /* If this is a straight load, make the extension explicit. */
+ else if (GET_CODE (SET_DEST (set)) == REG
+ && recog_data.n_operands == 2
+ && SET_SRC (set) == op
+ && SET_DEST (set) == recog_data.operand[1-i])
+ {
+ validate_change (insn, recog_data.operand_loc[i],
+ gen_rtx_fmt_e (LOAD_EXTEND_OP (mode),
+ word_mode, op),
+ 1);
+ validate_change (insn, recog_data.operand_loc[1-i],
+ gen_rtx_REG (word_mode, REGNO (SET_DEST (set))),
+ 1);
+ if (!apply_change_group ())
+ return 0;
+ return reload_cse_simplify_operands (insn, testreg);
+ }
+ else
+ /* ??? There might be arithmetic operations with memory that are
+ safe to optimize, but is it worth the trouble? */
+ continue;
+ }
+#endif /* LOAD_EXTEND_OP */
+ v = cselib_lookup (op, recog_data.operand_mode[i], 0);
if (! v)
continue;