1  /* Verify that overloaded built-ins for vec_ld with
       2     structure pointer / double inputs produce the right code.  */
       3  
       4  /* This test is to ensure that when a cast is associated with arg1 on a
       5     call to vec_ld (arg0, arg1), that the arg1 type is properly handled
       6     through the gimple folding code.
       7     We want something like this:
       8  	D.2736 = MEM[(voidD.44 *)D.2739];
       9     We specifically do not want 'struct S' showing up:
      10  	D.3212 = MEM[(struct S *)D.3215];
      11  */
      12  
      13  /* { dg-do compile { target lp64 } } */
      14  /* { dg-require-effective-target powerpc_vsx_ok } */
      15  /* { dg-options "-mvsx -O2 -fdump-tree-gimple" } */
      16  
      17  #include <altivec.h>
      18  #include <stdio.h>
      19  
      20  struct S {
      21    vector int *i1,*i2;
      22    vector long long *ll1;
      23    vector double *vd1;
      24    vector double *vd2;
      25    vector double *vd3;
      26    vector double *vd4;
      27  };
      28  
      29  vector double
      30  testld_struct1 (long long ll1, struct S *p)
      31  {
      32    return __builtin_altivec_lvx_v2df (ll1, (double *)p);
      33  }
      34  
      35  vector double
      36  testld_struct1b (long long ll1, struct S *p)
      37  {
      38    return vec_ld (ll1, (vector double *)p);
      39  }
      40  
      41  vector double
      42  testld_struct2 (struct S *p)
      43  {
      44    return vec_ld (16, (vector double *)p);
      45  }
      46  
      47  vector double
      48  testld_struct3 (struct S *p)
      49  {
      50    return vec_ld (16, (vector double *)p->vd2);
      51  }
      52  
      53  // We do not want the "struct S" reference to show up.
      54  /* { dg-final { scan-tree-dump-times "MEM\[\(struct S *\)D.\[0-9\]+\]" 0 "gimple" } } */