summaryrefslogtreecommitdiff
path: root/gcc/reload1.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-09 17:16:54 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-09 17:16:54 +0000
commit291ee89df99af129659f365849e613a27928e033 (patch)
treea45f9fe5c6841a2561bee0d8369feff64fbea99c /gcc/reload1.c
parentee7cbe0eb1a1f34f7cf6913e9455adb67cb9d261 (diff)
downloadgcc-291ee89df99af129659f365849e613a27928e033.tar.gz
* reload1.c (reload_cse_move2add): Don't turn an implicit
truncation into a self-set in the narrow mode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66638 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r--gcc/reload1.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 792dd467e89..adae5c8a162 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -9166,7 +9166,14 @@ reload_cse_move2add (first)
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))
{
@@ -9252,9 +9259,15 @@ reload_cse_move2add (first)
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))