[Bug target/52876] [x32] - Sign extend 32 to 64bit then clear upper 32bits fails O1 or higher

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Apr 5 15:46:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52876

--- Comment #13 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-05 15:46:02 UTC ---
We shouldn't copy REG_POINTER from SIGN_EXTEND on target with
POINTERS_EXTEND_UNSIGNED > 0.  This patch works for me:

diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 6353126..77a7e66 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -1225,8 +1225,12 @@ reg_scan_mark_refs (rtx x, rtx insn)
     {
       rtx src = SET_SRC (x);

-      while (GET_CODE (src) == SIGN_EXTEND
-         || GET_CODE (src) == ZERO_EXTEND
+      while (GET_CODE (src) == ZERO_EXTEND
+         || (GET_CODE (src) == SIGN_EXTEND
+#ifdef POINTERS_EXTEND_UNSIGNED
+             && POINTERS_EXTEND_UNSIGNED <= 0
+#endif
+            )
          || GET_CODE (src) == TRUNCATE
          || (GET_CODE (src) == SUBREG && subreg_lowpart_p (src)))
         src = XEXP (src, 0);



More information about the Gcc-bugs mailing list