Check the mode when checking values equivalent to sreg
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 2 May 1997 18:16:50 +0000 (18:16 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 2 May 1997 18:16:50 +0000 (18:16 +0000)
From-SVN: r14009

gcc/reload1.c

index 8489fe4e755bed8ec19c8a25b3e8c649587e8c72..199ae685d89c6bc08994c17864739f83fdcc23cf 100644 (file)
@@ -8035,8 +8035,21 @@ reload_cse_noop_set_p (set, insn)
 
          for (x = reg_values[sreg]; x; x = XEXP (x, 1))
            {
-             if (XEXP (x, 0) != 0
-                 && reload_cse_regno_equal_p (dreg, XEXP (x, 0), dest_mode))
+             rtx tmp;
+
+             if (XEXP (x, 0) == 0)
+               continue;
+
+             if (dest_mode == GET_MODE (x))
+               tmp = XEXP (x, 0);
+             else if (GET_MODE_BITSIZE (dest_mode)
+                      < GET_MODE_BITSIZE (GET_MODE (x)))
+               tmp = gen_lowpart_common (dest_mode, XEXP (x, 0));
+             else
+               continue;
+
+             if (tmp
+                 && reload_cse_regno_equal_p (dreg, tmp, dest_mode))
                {
                  ret = 1;
                  break;