This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix rtl-optimization/27538. (Take 2)
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: roger at eyesopen dot com
- Date: Sat, 13 May 2006 23:28:39 -0700
- Subject: [patch] Fix rtl-optimization/27538. (Take 2)
Hi,
Attached is a revised patch to fix rtl-optimization/27538.
The first iteration was posted at:
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00515.html
This iteration incorporates Roger's suggestion to use gen_lowpart in
expand_compound_operation.
Tested on arm-none-eabi. OK to apply?
Kazu Hirata
2006-05-14 Roger Sayle <roger@eyesopen.com>
PR rtl-optimization/27538
* combine.c (expand_compound_operation): Call gen_lowpart
before calling simplify_shift_const.
Index: combine.c
===================================================================
*** combine.c (revision 113700)
--- combine.c (working copy)
***************
*** 5736,5749 ****
modewidth = GET_MODE_BITSIZE (GET_MODE (x));
if (modewidth + len >= pos)
! tem = simplify_shift_const (NULL_RTX, unsignedp ? LSHIFTRT : ASHIFTRT,
! GET_MODE (x),
! simplify_shift_const (NULL_RTX, ASHIFT,
! GET_MODE (x),
! XEXP (x, 0),
! modewidth - pos - len),
! modewidth - len);
!
else if (unsignedp && len < HOST_BITS_PER_WIDE_INT)
tem = simplify_and_const_int (NULL_RTX, GET_MODE (x),
simplify_shift_const (NULL_RTX, LSHIFTRT,
--- 5736,5751 ----
modewidth = GET_MODE_BITSIZE (GET_MODE (x));
if (modewidth + len >= pos)
! {
! enum machine_mode mode = GET_MODE (x);
! tem = gen_lowpart (mode, XEXP (x, 0));
! if (!tem || GET_CODE (tem) == CLOBBER)
! return x;
! tem = simplify_shift_const (NULL_RTX, ASHIFT, mode,
! tem, modewidth - pos - len);
! tem = simplify_shift_const (NULL_RTX, unsignedp ? LSHIFTRT : ASHIFTRT,
! mode, tem, modewidth - len);
! }
else if (unsignedp && len < HOST_BITS_PER_WIDE_INT)
tem = simplify_and_const_int (NULL_RTX, GET_MODE (x),
simplify_shift_const (NULL_RTX, LSHIFTRT,