+2003-05-09 Alexandre Oliva <aoliva@redhat.com>
+
+ * reload1.c (reload_cse_move2add): Don't turn an implicit
+ truncation into a self-set in the narrow mode.
+
2003-05-09 Richard Earnshaw <rearnsha@arm.com>
* arm.md (clzsi2): The CLZ instruction is predicable.
value flag. jump2 already knows how to get rid of
no-op moves. */
if (new_src == const0_rtx)
- validate_change (insn, &SET_SRC (pat), reg, 0);
+ {
+ /* If the constants are different, this is a
+ truncation, that, if turned into (set (reg)
+ (reg)), would be discarded. Maybe we should
+ try a truncMN pattern? */
+ if (INTVAL (src) == reg_offset [regno])
+ validate_change (insn, &SET_SRC (pat), reg, 0);
+ }
else if (rtx_cost (new_src, PLUS) < rtx_cost (src, SET)
&& have_add2_insn (reg, new_src))
{
int success = 0;
if (new_src == const0_rtx)
- /* See above why we create (set (reg) (reg)) here. */
- success
- = validate_change (next, &SET_SRC (set), reg, 0);
+ {
+ if (INTVAL (src) == reg_offset [regno])
+ /* See above why we create (set (reg)
+ (reg)) here. */
+ success
+ = validate_change (next, &SET_SRC (set), reg, 0);
+ else
+ success = 0;
+ }
else if ((rtx_cost (new_src, PLUS)
< COSTS_N_INSNS (1) + rtx_cost (src3, SET))
&& have_add2_insn (reg, new_src))