diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2011-08-19 21:18:03 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2011-08-19 14:18:03 -0700 |
commit | 54f6892e4b7baa65bd5a16e5800258c319710e3c (patch) | |
tree | 1b85c27b72fa3bcaecc098807bd2c3f176de23b4 /gcc/explow.c | |
parent | d4a83c103c7a266631bc93abcfebc2451a8d5dcd (diff) | |
download | gcc-54f6892e4b7baa65bd5a16e5800258c319710e3c.zip gcc-54f6892e4b7baa65bd5a16e5800258c319710e3c.tar.gz gcc-54f6892e4b7baa65bd5a16e5800258c319710e3c.tar.bz2 |
Permute conversion and addition of constant for zero-extend.
gcc/
2011-08-19 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/49721
* explow.c (convert_memory_address_addr_space): Also permute the
conversion and addition of constant for zero-extend.
gcc/testsuite/
2011-08-19 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/49721
* gfortran.dg/pr49721-1.f: New.
* gfortran.fortran-torture/compile/pr49721-1.f: Likewise.
From-SVN: r177914
Diffstat (limited to 'gcc/explow.c')
-rw-r--r-- | gcc/explow.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/explow.c b/gcc/explow.c index beeab44..984150e 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -384,18 +384,23 @@ convert_memory_address_addr_space (enum machine_mode to_mode ATTRIBUTE_UNUSED, case PLUS: case MULT: - /* For addition we can safely permute the conversion and addition - operation if one operand is a constant and converting the constant - does not change it or if one operand is a constant and we are - using a ptr_extend instruction (POINTERS_EXTEND_UNSIGNED < 0). + /* FIXME: For addition, we used to permute the conversion and + addition operation only if one operand is a constant and + converting the constant does not change it or if one operand + is a constant and we are using a ptr_extend instruction + (POINTERS_EXTEND_UNSIGNED < 0) even if the resulting address + may overflow/underflow. We relax the condition to include + zero-extend (POINTERS_EXTEND_UNSIGNED > 0) since the other + parts of the compiler depend on it. See PR 49721. + We can always safely permute them if we are making the address narrower. */ if (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (from_mode) || (GET_CODE (x) == PLUS && CONST_INT_P (XEXP (x, 1)) - && (XEXP (x, 1) == convert_memory_address_addr_space - (to_mode, XEXP (x, 1), as) - || POINTERS_EXTEND_UNSIGNED < 0))) + && (POINTERS_EXTEND_UNSIGNED != 0 + || XEXP (x, 1) == convert_memory_address_addr_space + (to_mode, XEXP (x, 1), as)))) return gen_rtx_fmt_ee (GET_CODE (x), to_mode, convert_memory_address_addr_space (to_mode, XEXP (x, 0), as), |