Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 257054 | Differences between
and this patch

Collapse All | Expand All

(-)a/gcc/config/mips/mips.c (-1 / +28 lines)
Lines 2795-2801 bool Link Here
2795
mips_legitimize_address (rtx *xloc, enum machine_mode mode)
2795
mips_legitimize_address (rtx *xloc, enum machine_mode mode)
2796
{
2796
{
2797
  rtx base, addr;
2797
  rtx base, addr;
2798
  HOST_WIDE_INT offset;
2798
  HOST_WIDE_INT intval, high, offset;
2799
2799
2800
  if (mips_tls_symbol_p (*xloc))
2800
  if (mips_tls_symbol_p (*xloc))
2801
    {
2801
    {
Lines 2820-2825 mips_legitimize_address (rtx *xloc, enum Link Here
2820
      *xloc = mips_force_address (addr, mode);
2820
      *xloc = mips_force_address (addr, mode);
2821
      return true;
2821
      return true;
2822
    }
2822
    }
2823
2824
  /* Handle references to constant addresses by loading the high part
2825
     into a register and using an offset for the low part.  */
2826
  if (GET_CODE (base) == CONST_INT)
2827
    {
2828
      intval = INTVAL (base);
2829
      high = trunc_int_for_mode (CONST_HIGH_PART (intval), Pmode);
2830
      offset = CONST_LOW_PART (intval);
2831
     /* Ignore cases in which a positive address would be accessed by a
2832
       negative offset from a negative address.  The required wraparound
2833
       does not occur for 32-bit addresses on 64-bit targets, and it is
2834
       very unlikely that such an access would occur in real code anyway.
2835
2836
       If the low offset is not legitimate for MODE, prefer to load
2837
       the constant normally, instead of using mips_force_address on
2838
       the legitimized address.  The latter option would cause us to
2839
       use (D)ADDIU unconditionally, but LUI/ORI is more efficient
2840
       than LUI/ADDIU on some targets.  */
2841
     if ((intval < 0 || high > 0)
2842
        && mips_valid_offset_p (GEN_INT (offset), mode))
2843
      {
2844
        base = mips_force_temporary (NULL, GEN_INT (high));
2845
        *xloc = plus_constant (base, offset);
2846
        return true;
2847
      }
2848
   }
2849
2823
  return false;
2850
  return false;
2824
}
2851
}
2825
2852

Return to bug 257054