Commit ceeb2cbc by Andrew Pinski Committed by Andrew Pinski

revert: re PR middle-end/49721 (convert_memory_address_addr_space may generate invalid new insns)

2014-10-14  Andrew Pinski  <apinski@cavium.com>

	Revert:
	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.

From-SVN: r216229
parent e24ad4ec
2014-10-14 Andrew Pinski <apinski@cavium.com>
Revert:
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.
2014-10-14 DJ Delorie <dj@redhat.com> 2014-10-14 DJ Delorie <dj@redhat.com>
* config/msp430/msp430-modes.def (PSI): Add. * config/msp430/msp430-modes.def (PSI): Add.
...@@ -376,23 +376,18 @@ convert_memory_address_addr_space (enum machine_mode to_mode ATTRIBUTE_UNUSED, ...@@ -376,23 +376,18 @@ convert_memory_address_addr_space (enum machine_mode to_mode ATTRIBUTE_UNUSED,
case PLUS: case PLUS:
case MULT: case MULT:
/* FIXME: For addition, we used to permute the conversion and /* For addition we can safely permute the conversion and addition
addition operation only if one operand is a constant and operation if one operand is a constant and converting the constant
converting the constant does not change it or if one operand does not change it or if one operand is a constant and we are
is a constant and we are using a ptr_extend instruction using a ptr_extend instruction (POINTERS_EXTEND_UNSIGNED < 0).
(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 We can always safely permute them if we are making the address
narrower. */ narrower. */
if (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (from_mode) if (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (from_mode)
|| (GET_CODE (x) == PLUS || (GET_CODE (x) == PLUS
&& CONST_INT_P (XEXP (x, 1)) && CONST_INT_P (XEXP (x, 1))
&& (POINTERS_EXTEND_UNSIGNED != 0 && (XEXP (x, 1) == convert_memory_address_addr_space
|| XEXP (x, 1) == convert_memory_address_addr_space (to_mode, XEXP (x, 1), as)
(to_mode, XEXP (x, 1), as)))) || POINTERS_EXTEND_UNSIGNED < 0)))
return gen_rtx_fmt_ee (GET_CODE (x), to_mode, return gen_rtx_fmt_ee (GET_CODE (x), to_mode,
convert_memory_address_addr_space convert_memory_address_addr_space
(to_mode, XEXP (x, 0), as), (to_mode, XEXP (x, 0), as),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment