From: Will Schmidt Date: Tue, 19 Sep 2017 13:32:54 +0000 (+0000) Subject: fold-vec-ld-misc.c: New. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=81b29ad80a7fb41b5534c1ae45565e1c353dbf0e;p=gcc.git fold-vec-ld-misc.c: New. [gcc/testsuite] 2017-09-19 Will Schmidt * gcc.target/powerpc/fold-vec-ld-misc.c: New. From-SVN: r252974 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a9e49e23bd8..a69bce3177f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-09-19 Will Schmidt + + * gcc.target/powerpc/fold-vec-ld-misc.c: New. + 2017-09-19 Richard Biener PR tree-optimization/82244 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 00000000000..4b86a81337c --- /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 -fdump-tree-gimple" } */ + +#include +#include + +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" } } */