S/390: Fix movqi/movhi inefficiency
Ulrich Weigand
weigand@i1.informatik.uni-erlangen.de
Sat Nov 29 22:51:00 GMT 2003
Hello,
the movqi and movhi expanders would generate SIGN_EXTEND or
ZERO_EXTEND patterns to more faithfully represent the actions
of the available assembler instructions to load from memory.
However, this proved suboptimal when loading from a
(MEM (ADDRESSOF ...)), because the SIGN_EXTEND/ZERO_EXTEND
prevented replacement of the MEM with a REG, and thus
might unnecessarily force a variable to the stack.
This patch fixes that case. Incidentally, this fixes a
bootstrap error on s390x with Ada, because it appears to
hide another bug ...
Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux.
Applied to CVS head.
Bye,
Ulrich
ChangeLog:
* config/s390/s390.md ("movhi"): Do not emit extender pattern
when loading from a (MEM (ADDRESSOF ...)).
("movqi"): Likewise.
Index: gcc/config/s390/s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.84
diff -c -p -r1.84 s390.md
*** gcc/config/s390/s390.md 30 Oct 2003 14:11:34 -0000 1.84
--- gcc/config/s390/s390.md 28 Nov 2003 21:09:38 -0000
***************
*** 1313,1319 ****
always sign-extends (at least) to SImode. */
if (optimize && !no_new_pseudos
&& register_operand (operands[0], VOIDmode)
! && memory_operand (operands[1], VOIDmode))
{
rtx tmp = gen_reg_rtx (SImode);
rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
--- 1313,1320 ----
always sign-extends (at least) to SImode. */
if (optimize && !no_new_pseudos
&& register_operand (operands[0], VOIDmode)
! && GET_CODE (operands[1]) == MEM
! && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
{
rtx tmp = gen_reg_rtx (SImode);
rtx ext = gen_rtx_SIGN_EXTEND (SImode, operands[1]);
***************
*** 1360,1366 ****
is just as fast as a QImode load. */
if (TARGET_ZARCH && optimize && !no_new_pseudos
&& register_operand (operands[0], VOIDmode)
! && memory_operand (operands[1], VOIDmode))
{
rtx tmp = gen_reg_rtx (word_mode);
rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
--- 1361,1368 ----
is just as fast as a QImode load. */
if (TARGET_ZARCH && optimize && !no_new_pseudos
&& register_operand (operands[0], VOIDmode)
! && GET_CODE (operands[1]) == MEM
! && GET_CODE (XEXP (operands[1], 0)) != ADDRESSOF)
{
rtx tmp = gen_reg_rtx (word_mode);
rtx ext = gen_rtx_ZERO_EXTEND (word_mode, operands[1]);
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de
More information about the Gcc-patches
mailing list