[RFA]: Fix reload of paradoxical subreg on big-endian platforms when reg is in memory
Stephane Carrez
stcarrez@nerim.fr
Sun Apr 13 11:41:00 GMT 2003
Hi!
I've found a reload problem with paradoxical subregs on big-endian platforms.
When a register is in memory and its paradoxical subreg is reloaded, we
compute its address but we come up with a wrong address representing the
high part instead of the low part. It is a regression compared to 3.0.4.
For m6811-elf target, when I compile the gcc test:
xgcc -B./ -o t.x -O1 testsuite/gcc.c-torture/execute/930123-1.c
It generates the following insn with `(subreg:HI (reg:QI 61) 0)':
(insn 64 65 62 4 (nil) (set (reg:HI 68)
(ashift:HI (subreg:HI (reg:QI 61) 0)
(const_int 8 [0x8]))) 113 {*ashlhi3} (nil)
(expr_list:REG_DEAD (reg:QI 61)
(nil)))
Reg:QI 61 is in memory at 'frame + 8' and to load it as a reg:HI we must
use 'frame + 7' (note the SUBREG_BYTE which is 0). So, we come with this load:
(insn 82 65 64 4 (nil) (set (reg:HI 1 d [68])
(mem:HI (plus:HI (reg:HI 0 x)
(const_int 8 [0x8])) [0 S2 A8])) 23 {*movhi_m68hc11} (nil)
(nil))
I tracked the problem and found that in `find_reloads_subreg_address' we
do not adjust the offset of a paradoxical subreg on big-endian platforms.
In gcc 3.0.4 we handled this correctly but the code was removed as part
of the SUBREG_BYTE work. Note that for a paradoxical subreg the SUBREG_BYTE
can be 0 and the offset that we apply does nothing (see also Jan Hubicka
comment in `simplify_subreg' about this and the special big-endian handling
he had to do).
This patch fixes the problem by resurecting the 3.0.4 reload code that
handled the case (tested on 3_3 branch with m6811-elf).
Can you approve this patch for 3_3 and mainline?
Thanks,
Stephane
2003-04-13 Stephane Carrez <stcarrez@nerim.fr>
* reload.c (find_reloads_subreg_address): Adjust offset of paradoxical
subregs on big-endian machines.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: reload.c.diffs
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030413/e744a1c0/attachment.ksh>
More information about the Gcc-patches
mailing list