re PR rtl-optimization/45903 (unnecessary load of 32/64bit variable when only 8 bits are needed)
PR tree-optimization/45903 * simplify-rtx.c (simplify_subreg): Optimize lowpart SUBREG of *SHIFTRT of MEM. * gcc.target/i386/pr45903.c: New test. From-SVN: r165200
This commit is contained in:
parent
0fd76d8e4c
commit
509dd3804c
@ -1,3 +1,9 @@
|
||||
2010-10-08 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/45903
|
||||
* simplify-rtx.c (simplify_subreg): Optimize lowpart SUBREG
|
||||
of *SHIFTRT of MEM.
|
||||
|
||||
2010-10-08 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* lto-streamer-in.c (lto_input_ts_decl_minimal_tree_pointers):
|
||||
|
@ -5482,6 +5482,31 @@ simplify_subreg (enum machine_mode outermode, rtx op,
|
||||
: byte + shifted_bytes));
|
||||
}
|
||||
|
||||
/* If we have a lowpart SUBREG of a right shift of MEM, make a new MEM
|
||||
and try replacing the SUBREG and shift with it. Don't do this if
|
||||
the MEM has a mode-dependent address or if we would be widening it. */
|
||||
|
||||
if ((GET_CODE (op) == LSHIFTRT
|
||||
|| GET_CODE (op) == ASHIFTRT)
|
||||
&& MEM_P (XEXP (op, 0))
|
||||
&& CONST_INT_P (XEXP (op, 1))
|
||||
&& GET_MODE_SIZE (outermode) < GET_MODE_SIZE (GET_MODE (op))
|
||||
&& (INTVAL (XEXP (op, 1)) % GET_MODE_BITSIZE (outermode)) == 0
|
||||
&& INTVAL (XEXP (op, 1)) > 0
|
||||
&& INTVAL (XEXP (op, 1)) < GET_MODE_BITSIZE (innermode)
|
||||
&& ! mode_dependent_address_p (XEXP (XEXP (op, 0), 0))
|
||||
&& ! MEM_VOLATILE_P (XEXP (op, 0))
|
||||
&& byte == subreg_lowpart_offset (outermode, innermode)
|
||||
&& (GET_MODE_SIZE (outermode) >= UNITS_PER_WORD
|
||||
|| WORDS_BIG_ENDIAN == BYTES_BIG_ENDIAN))
|
||||
{
|
||||
int shifted_bytes = INTVAL (XEXP (op, 1)) / BITS_PER_UNIT;
|
||||
return adjust_address_nv (XEXP (op, 0), outermode,
|
||||
(WORDS_BIG_ENDIAN
|
||||
? byte - shifted_bytes
|
||||
: byte + shifted_bytes));
|
||||
}
|
||||
|
||||
return NULL_RTX;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2010-10-08 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/45903
|
||||
* gcc.target/i386/pr45903.c: New test.
|
||||
|
||||
2010-10-08 Arnaud Charlet <charlet@adacore.com>
|
||||
|
||||
* gnat.dg/interface5.adb: Compile with warnings disabled.
|
||||
|
Loading…
Reference in New Issue
Block a user