OSDN Git Service

* reload1.c (reload_cse_move2add): Don't turn an implicit
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 May 2003 17:16:54 +0000 (17:16 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 May 2003 17:16:54 +0000 (17:16 +0000)
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

gcc/ChangeLog
gcc/reload1.c

index 01bc7ff..d7ac8d8 100644 (file)
@@ -1,3 +1,8 @@
+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.
index 792dd46..adae5c8 100644 (file)
@@ -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))