This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: x86_64 mmx reload error
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 20 Feb 2006 15:33:46 -0300
- Subject: Re: x86_64 mmx reload error
- References: <orlkyglbel.fsf@livre.oliva.athome.lsd.ic.unicamp.br>
On Dec 20, 2005, Alexandre Oliva <aoliva@redhat.com> wrote:
> The testcase included in the patch below triggers a reload bug. The
> problem is that one of the operands of the vector xor is a paradoxical
> (subreg:V2SI (reg:QI 0 rax)), and preferred_reload_class() forbids
> reload from trying to satisfy the reload into MMX_REGS.
> I realize the test I'm proposing might be a bit crude, but the
> alternative I could think of, namely making exceptions for other
> register classes such as MMX_REGS, looked even less appealing to me.
> Bootstrapped and tested in the 4.0 branch, trunk build is in stage2,
> stage1 passes the test, will run full test as soon as build completes.
> Ok to install?
Ping?
:ADDPATCH i386/mmx:
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* config/i386/i386.c (ix86_preferred_reload_class): Accept reloads
of Q_REGs to other classes.
for gcc/testsuite/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* gcc.target/i386/mmx-7.c: New.
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c.orig 2006-01-18 22:41:01.000000000 -0200
+++ gcc/config/i386/i386.c 2006-01-18 22:41:12.000000000 -0200
@@ -16060,6 +16060,10 @@ ix86_preferred_reload_class (rtx x, enum
return class;
if (reg_class_subset_p (Q_REGS, class))
return Q_REGS;
+ /* If we already have a Q_REG and we needed a reload, maybe
+ the caller had SUBREG, so let it get what it needs. */
+ if (REG_P (x) && reg_fits_class_p (x, Q_REGS, 0, QImode))
+ return class;
return NO_REGS;
}
Index: gcc/testsuite/gcc.target/i386/mmx-7.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.target/i386/mmx-7.c 2006-01-18 22:41:12.000000000 -0200
@@ -0,0 +1,33 @@
+/* Reduced from testcase filed at
+ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=173101 */
+
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O1 -mmmx" } */
+
+typedef unsigned char uint8_t;
+typedef uint8_t v8qi __attribute__ ((vector_size (sizeof(uint8_t) * 8)));
+
+union pb {
+ v8qi v;
+ uint8_t i[8];
+};
+
+void
+foo (union pb data, union pb mask)
+{
+ while (1)
+ {
+ union pb r;
+
+ r.v = __builtin_ia32_pand (data.v, mask.v);
+
+ asm (""); /* Prevent collapsing of pand,pxor to pandn. */
+
+ r.v = __builtin_ia32_pxor (r.v, mask.v);
+
+ if (!r.i[0])
+ mask.i[0] >>= 1;
+ else
+ break;
+ }
+}
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Secretary for FSF Latin America http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}