[PATCH] Fix powerpc movsi_from_sf define_insn_and_split constraints (PR target/79354)
Jakub Jelinek
jakub@redhat.com
Fri Feb 3 17:25:00 GMT 2017
On Fri, Feb 03, 2017 at 09:59:45AM -0600, Segher Boessenkool wrote:
> Hi Jakub,
>
> On Fri, Feb 03, 2017 at 10:10:47AM +0100, Jakub Jelinek wrote:
> > As mentioned in the PR, for the following testcase we emit a power9
> > instruction even with -mcpu=power8. Similar movsf_hardfloat instruction
> > uses wb constraint for the stxssp insn source rather than wu, which it
> > only uses for stxsspx (power7?).
> >
> > Bootstrapped/regtested on powerpc64{,le}-linux, ok for trunk?
>
> Yes please. Thanks!
>
> Some testcase stuff below...
>
>
> > --- gcc/testsuite/gcc.target/powerpc/pr79354.c.jj 2017-02-03 02:37:44.147938375 +0100
> > +++ gcc/testsuite/gcc.target/powerpc/pr79354.c 2017-02-03 02:38:34.838303987 +0100
> > @@ -0,0 +1,23 @@
> > +/* PR target/79354 */
> > +/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
>
> powerpc*-*-* instead? And why is lp64 needed?
Neither is needed, I've copied/adjusted the dg-do.*dg-options
block from another testcase and missed this.
> > +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
> > +/* { dg-require-effective-target powerpc_p8vector_ok } */
> > +/* { dg-options "-mcpu=power8 -O2" } */
> > +/* { dg-final { scan-assembler-not "stxssp\[^x]" } } */
>
> \M is nicer and more future-proof, but this works.
{\mstxssp\M} is what I've committed after retesting it without/with the
rs6000.md change. Thanks.
2017-02-03 Jakub Jelinek <jakub@redhat.com>
PR target/79354
* config/rs6000/rs6000.md (movsi_from_sf): Use wb constraint instead of
wu for stxssp alternative.
* gcc.target/powerpc/pr79354.c: New test.
* gcc.c-torture/execute/pr79354.c: New test.
--- gcc/config/rs6000/rs6000.md.jj 2017-02-02 11:04:27.000000000 +0100
+++ gcc/config/rs6000/rs6000.md 2017-02-03 02:29:42.754962983 +0100
@@ -6814,7 +6814,7 @@ (define_insn_and_split "movsi_from_sf"
(unspec:SI [(match_operand:SF 1 "input_operand"
"r, m, Z, Z, r,
- f, wu, wu, wIwH, r,
+ f, wb, wu, wIwH, r,
wK")]
UNSPEC_SI_FROM_SF))
--- gcc/testsuite/gcc.target/powerpc/pr79354.c.jj 2017-02-03 02:37:44.147938375 +0100
+++ gcc/testsuite/gcc.target/powerpc/pr79354.c 2017-02-03 02:38:34.838303987 +0100
@@ -0,0 +1,22 @@
+/* PR target/79354 */
+/* { dg-do compile } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mcpu=power8 -O2" } */
+/* { dg-final { scan-assembler-not {\mstxssp\M} } } */
+
+int b, f, g;
+float e;
+unsigned long d;
+
+void
+foo (int *a)
+{
+ for (g = 0; g < 32; g++)
+ if (f)
+ {
+ e = d;
+ __builtin_memcpy (&b, &e, sizeof (float));
+ b = *a;
+ }
+}
--- gcc/testsuite/gcc.c-torture/execute/pr79354.c.jj 2017-02-03 02:36:36.746781897 +0100
+++ gcc/testsuite/gcc.c-torture/execute/pr79354.c 2017-02-03 02:36:07.000000000 +0100
@@ -0,0 +1,30 @@
+/* PR target/79354 */
+
+int b, f, g;
+float e;
+unsigned long d;
+
+__attribute__((noinline, noclone)) void
+foo (int *a)
+{
+ for (g = 0; g < 32; g++)
+ if (f)
+ {
+ e = d;
+ __builtin_memcpy (&b, &e, sizeof (float));
+ b = *a;
+ }
+}
+
+int
+main ()
+{
+ int h = 5;
+ f = 1;
+ asm volatile ("" : : : "memory");
+ foo (&h);
+ asm volatile ("" : : : "memory");
+ foo (&b);
+ asm volatile ("" : : : "memory");
+ return 0;
+}
Jakub
More information about the Gcc-patches
mailing list