diff mbox series

[rs6000] gimple folding vector load test variant

Message ID 1505488000.26707.32.camel@brimstone.rchland.ibm.com
State New
Headers show
Series [rs6000] gimple folding vector load test variant | expand

Commit Message

will schmidt Sept. 15, 2017, 3:06 p.m. UTC
Hi, 
  This is a test created during investigation of the feedback on
the rs6000 gimple vector folding code, regarding the handling of
arg1_type.  Inspired by feedback from Richard and Bill.

This was useful to illustrate the issue to me.  Whether this is a
valid test for the testsuite I'll defer to the judgement of the
maintainers.. :-)

OK for trunk? 

[gcc/testsuite]

2017-09-15  Will Schmidt  <will_schmidt@vnet.ibm.com>

	* gcc.target/powerpc/fold-vec-ld-misc.c: New.

Comments

Segher Boessenkool Sept. 15, 2017, 9:35 p.m. UTC | #1
On Fri, Sep 15, 2017 at 10:06:40AM -0500, Will Schmidt wrote:
>   This is a test created during investigation of the feedback on
> the rs6000 gimple vector folding code, regarding the handling of
> arg1_type.  Inspired by feedback from Richard and Bill.
> 
> This was useful to illustrate the issue to me.  Whether this is a
> valid test for the testsuite I'll defer to the judgement of the
> maintainers.. :-)

Looks fine to me, except one thing:

> +/* { dg-do compile { target lp64 } } */
> +/* { dg-require-effective-target powerpc_vsx_ok } */
> +/* { dg-options "-mvsx -O2 -mpower8-vector -fdump-tree-gimple" } */

If you use -mpower8-vector (do you need it?), you should use

/* { dg-require-effective-target powerpc_p8vector_ok } */

(instead of the vsx_ok, which is then implied).

Okay for trunk with that fixed.  Thanks,


Segher
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-ld-misc.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-ld-misc.c
new file mode 100644
index 0000000..01069f6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-ld-misc.c
@@ -0,0 +1,54 @@ 
+/* Verify that overloaded built-ins for vec_ld with 
+   structure pointer / double inputs produce the right code.  */
+
+/* This test is to ensure that when a cast is associated with arg1 on a
+   call to vec_ld (arg0, arg1), that the arg1 type is properly handled
+   through the gimple folding code.
+   We want something like this:
+	D.2736 = MEM[(voidD.44 *)D.2739];
+   We specifically do not want 'struct S' showing up:
+	D.3212 = MEM[(struct S *)D.3215];
+*/
+
+/* { dg-do compile { target lp64 } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mvsx -O2 -mpower8-vector -fdump-tree-gimple" } */
+
+#include <altivec.h>
+#include <stdio.h>
+
+struct S {
+  vector int *i1,*i2;
+  vector long long *ll1;
+  vector double *vd1;
+  vector double *vd2;
+  vector double *vd3;
+  vector double *vd4;
+};
+
+vector double
+testld_struct1 (long long ll1, struct S *p)
+{
+  return __builtin_altivec_lvx_v2df (ll1, (double *)p);
+}
+
+vector double
+testld_struct1b (long long ll1, struct S *p)
+{
+  return vec_ld (ll1, (vector double *)p);
+}
+
+vector double
+testld_struct2 (struct S *p)
+{
+  return vec_ld (16, (vector double *)p);
+}
+
+vector double
+testld_struct3 (struct S *p)
+{
+  return vec_ld (16, (vector double *)p->vd2);
+}
+
+// We do not want the "struct S" reference to show up.
+/* { dg-final { scan-tree-dump-times "MEM\[\(struct S *\)D.\[0-9\]+\]" 0 "gimple" } } */