* [committed] PR 35838: Fix subreg offset in dse.c:find_shift_sequence
@ 2008-04-17 22:31 Richard Sandiford
0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2008-04-17 22:31 UTC (permalink / raw)
To: gcc-patches; +Cc: danglin
In the fix for PR 33927, I'd wrongly thought that the first subreg
created by find_shift_sequence would be a paradoxical one. This isn't
so: we can do the shift in a narrower mode than the store mode if:
shift + GET_MODE_SIZE (read_mode) <= GET_MODE_SIZE (store_mode) / 2
This caused a wrong code bug on PA.
Bootstrapped & regression-tested on x86_64-linux-gnu ({,-m32}).
Dave Anglin confirmed that it fixes the PR (thanks). Applied as obvious.
Richard
gcc/
PR rtl-optimization/35838
* dse.c (find_shift_sequence): Use subreg_lowpart_offset to work
out the byte offset of the first subreg.
Index: gcc/dse.c
===================================================================
--- gcc/dse.c 2008-04-14 12:20:03.000000000 +0100
+++ gcc/dse.c 2008-04-14 12:20:27.000000000 +0100
@@ -1446,7 +1446,7 @@ find_shift_sequence (int access_size,
new_mode = GET_MODE_WIDER_MODE (new_mode))
{
rtx target, new_reg, shift_seq, insn, new_lhs;
- int cost;
+ int cost, offset;
/* Try a wider mode if truncating the store mode to NEW_MODE
requires a real instruction. */
@@ -1460,8 +1460,9 @@ find_shift_sequence (int access_size,
if (!CONSTANT_P (store_info->rhs)
&& !MODES_TIEABLE_P (new_mode, store_mode))
continue;
+ offset = subreg_lowpart_offset (new_mode, store_mode);
new_lhs = simplify_gen_subreg (new_mode, copy_rtx (store_info->rhs),
- store_mode, 0);
+ store_mode, offset);
if (new_lhs == NULL_RTX)
continue;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-17 20:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-17 22:31 [committed] PR 35838: Fix subreg offset in dse.c:find_shift_sequence Richard Sandiford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).