This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] operand_subword_force vs subregs
- To: gcc-patches at gcc dot gnu dot org
- Subject: [patch] operand_subword_force vs subregs
- From: DJ Delorie <dj at redhat dot com>
- Date: Mon, 11 Jun 2001 19:11:28 -0400
In a port I'm working on, gcc.c-torture/compile/combine-hang.c
is trying to do this on a machine with no 64-bit moves:
(set (reg:DF ...) (subreg:DF (reg:DI ...)))
and ends up recursing trying to take a subreg of a subreg. This patch
short-circuits that by replacing the subreg with a new subreg instead.
Of course, there may be a better way to fix this. If so, please feel
free to post it. ;-)
2001-06-11 DJ Delorie <dj@redhat.com>
* emit-rtl.c (operand_subword_force): Avoid taking a subreg of
a subreg and recursing.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.181
diff -p -3 -r1.181 emit-rtl.c
*** emit-rtl.c 2001/06/10 22:49:40 1.181
--- emit-rtl.c 2001/06/11 23:09:21
*************** operand_subword_force (op, offset, mode)
*** 1511,1516 ****
--- 1511,1528 ----
to a pseudo register. */
if (GET_CODE (op) == REG)
op = copy_to_reg (op);
+ /* If we are trying for a subreg of a subreg, see if we can take
+ a subreg of the inner reg. Otherwise, force_reg ends up
+ recursing. */
+ else if (GET_CODE (op) == SUBREG
+ && XINT (op, 1) == 0
+ && GET_CODE (XEXP (op, 0)) == REG
+ && (GET_MODE_SIZE (mode)
+ == GET_MODE_SIZE (GET_MODE (XEXP (op, 0))))
+ {
+ op = XEXP (op, 0);
+ mode = GET_MODE (op);
+ }
else
op = force_reg (mode, op);
}