This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Don't let gen_lowpart generate SUBREGs with word -1.
- To: gcc-patches at gcc dot gnu dot org
- Subject: Don't let gen_lowpart generate SUBREGs with word -1.
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 22 Nov 2000 19:30:06 -0200
- Organization: GCC Team, Red Hat
If certain hardware registers are narrower than words,
gen_lowpart_common() may generate a paradoxical subreg with
SUBREG_WORD == -1. This patch fixes this problem, and adds a sanity
check to gen_highpart(). Bootstrapping on i686-pc-linux-gnu. I think
it's already bootstrapped yesterday, but I no longer remember for
sure. Ok to install?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* emit-rtl.c (gen_lowpart_common): Use word 0 for paradoxical
subregs.
(gen_highpart): Abort on little-endian PARADOXICAL subreg.
Index: gcc/emit-rtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/emit-rtl.c,v
retrieving revision 1.154
diff -u -p -r1.154 emit-rtl.c
--- gcc/emit-rtl.c 2000/11/10 16:01:13 1.154
+++ gcc/emit-rtl.c 2000/11/21 18:44:46
@@ -709,7 +709,8 @@ gen_lowpart_common (mode, x)
regs are sized by the underlying register size. Better would be
to always interpret the subreg offset parameter as bytes or bits. */
- if (WORDS_BIG_ENDIAN && REGNO (x) < FIRST_PSEUDO_REGISTER)
+ if (WORDS_BIG_ENDIAN && REGNO (x) < FIRST_PSEUDO_REGISTER
+ && GET_MODE_SIZE (GET_MODE (x)) > GET_MODE_SIZE (mode))
word = (HARD_REGNO_NREGS (REGNO (x), GET_MODE (x))
- HARD_REGNO_NREGS (REGNO (x), mode));
@@ -1143,6 +1144,8 @@ gen_highpart (mode, x)
if (WORDS_BIG_ENDIAN)
word = 0;
+ else if (GET_MODE_SIZE (GET_MODE (x)) < GET_MODE_SIZE (mode))
+ abort ();
else if (REGNO (x) < FIRST_PSEUDO_REGISTER)
word = (HARD_REGNO_NREGS (REGNO (x), GET_MODE (x))
- HARD_REGNO_NREGS (REGNO (x), mode));
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me