Hi,

Hi,

We should call simplify_gen_subreg for PIC with ptr_mode only if modes
of x and orig_x are different.  OK for trunk?

Thanks.


H.J.
---
2011-07-26  H.J. Lu  <hongjiu...@intel.com>

        PR target/47372
        * config/i386/i386.c (ix86_delegitimize_address): Call
        simplify_gen_subreg for PIC with ptr_mode only if modes of
        x and orig_x are different.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 429cd62..9c52aa3 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12967,9 +12982,10 @@ ix86_delegitimize_address (rtx x)
          || !MEM_P (orig_x))
        return ix86_delegitimize_tls_address (orig_x);
       x = XVECEXP (XEXP (x, 0), 0, 0);
-      if (GET_MODE (orig_x) != Pmode)
+      if (GET_MODE (orig_x) != GET_MODE (x) 
+         && GET_MODE (orig_x) != ptr_mode)
        {
-         x = simplify_gen_subreg (GET_MODE (orig_x), x, Pmode, 0);
+         x = simplify_gen_subreg (GET_MODE (orig_x), x, ptr_mode, 0);
          if (x == NULL_RTX)
            return orig_x;
        }

Reply via email to