openmp: Add testcases for omp_max_vf
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / bb-slp-pr65935.c
blob9ef1330b47c817e16baaafa44c2b15108b9dd3a9
1 /* { dg-additional-options "-O3" } */
2 /* { dg-require-effective-target vect_double } */
3 /* { dg-additional-options "-mprefer-vector-width=128" { target x86_64-*-* i?86-*-* } } */
5 #include "tree-vect.h"
7 extern void abort (void);
8 extern void *malloc (__SIZE_TYPE__);
10 struct site {
11 struct {
12 struct {
13 double real;
14 double imag;
15 } e[3][3];
16 } link[32];
17 double phase[32];
18 } *lattice;
19 int sites_on_node;
21 void rephase (void)
23 int i,j,k,dir;
24 struct site *s;
25 for(i=0,s=lattice;i<sites_on_node;i++,s++)
26 for(dir=0;dir<32;dir++)
28 for(j=0;j<3;j++)
29 for(k=0;k<3;k++)
31 s->link[dir].e[j][k].real *= s->phase[dir];
32 s->link[dir].e[j][k].imag *= s->phase[dir];
34 /* Avoid loop vectorizing the outer loop after unrolling
35 the inners. */
36 __asm__ volatile ("" : : : "memory");
40 int main()
42 int i,j,k;
43 check_vect ();
44 sites_on_node = 1;
45 lattice = malloc (sizeof (struct site) * sites_on_node);
46 for (i = 0; i < 32; ++i)
48 lattice->phase[i] = i;
49 for (j = 0; j < 3; ++j)
50 for (k = 0; k < 3; ++k)
52 lattice->link[i].e[j][k].real = 1.0;
53 lattice->link[i].e[j][k].imag = 1.0;
54 __asm__ volatile ("" : : : "memory");
57 rephase ();
58 for (i = 0; i < 32; ++i)
59 for (j = 0; j < 3; ++j)
60 #pragma GCC novector
61 for (k = 0; k < 3; ++k)
62 if (lattice->link[i].e[j][k].real != i
63 || lattice->link[i].e[j][k].imag != i)
64 abort ();
65 return 0;
68 /* We should also be able to use 2-lane SLP to initialize the real and
69 imaginary components in the first loop of main. */
70 /* { dg-final { scan-tree-dump-times "optimized: basic block" 10 "slp1" { target {! { vect1024 } } } } } */
71 /* { dg-final { scan-tree-dump-times "optimized: basic block" 11 "slp1" { target { { vect1024 } } } } } */
72 /* We should see the s->phase[dir] operand splatted and no other operand built
73 from scalars. See PR97334. */
74 /* { dg-final { scan-tree-dump "Using a splat" "slp1" } } */
75 /* { dg-final { scan-tree-dump-times "Building vector operands from scalars" 0 "slp1" } } */