On Mon, Mar 04, 2019 at 02:41:32PM +0100, Jakub Jelinek wrote:
> On Mon, Mar 04, 2019 at 05:33:41AM -0800, H.J. Lu wrote:
> > > >         PR tree-optimization/89487
> > > >         * gcc/testsuite/gcc.dg/tree-ssa/pr89487.c: New test.
> > 
> > gcc.dg/tree-ssa/pr89487.c:
> > 
> > /* { dg-do compile } */
> > /* { dg-options "-O2 -ftree-loop-distribution" } */
> > 
> > void
> > caml_interprete (void)
> > {
> >   register int *pc asm("%r15");  <<<< These are valid only for x86-64.
> >   register int *sp asm("%r14");
> >   int i;
> > 
> >   for (i = 0; i < 3; ++i)
> >     *--sp = pc[i];
> > }
> 
> It could perhaps #include "../pr87600.h", be guarded with
> /* { dg-do compile { target aarch64*-*-* arm*-*-* i?86-*-* powerpc*-*-* 
> s390*-*-* x86_64-*-* } } */
> and use REG1/REG2 instead.

Here it is in patch form, with the extra advantage that the target
list doesn't need to be provided and maintained up to date whenever
the pr87600.h header changes.

Tested on x86_64-linux (-m32/-m64, where with -m32 it previously FAILed),
additionally tested with the tree-loop-distribution.c + tree-ssa-loop-ivopts.c
changes reverted (ICEs as expected on both -m32 and -m64), committed to
trunk as obvious.

2019-03-05  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/89487
        * gcc.dg/tree-ssa/pr89487.c: Include ../pr87600.h.
        (caml_interprete): Ifdef the whole body out if REG1 or REG2 macros
        aren't defined.  Use REG1 instead of "%r15" and REG2 instead of
        "%r14".

--- gcc/testsuite/gcc.dg/tree-ssa/pr89487.c.jj  2019-03-04 10:22:32.740189031 
+0100
+++ gcc/testsuite/gcc.dg/tree-ssa/pr89487.c     2019-03-05 14:35:30.033099726 
+0100
@@ -1,13 +1,18 @@
+/* PR tree-optimization/89487 */
 /* { dg-do compile } */
 /* { dg-options "-O2 -ftree-loop-distribution" } */
 
+#include "../pr87600.h"
+
 void
 caml_interprete (void)
 {
-  register int *pc asm("%r15");
-  register int *sp asm("%r14");
+#if defined(REG1) && defined(REG2)
+  register int *pc asm(REG1);
+  register int *sp asm(REG2);
   int i;
 
   for (i = 0; i < 3; ++i)
     *--sp = pc[i];
+#endif
 }


        Jakub

Reply via email to