PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr65518.c
blob3e5b986183c04261430b6a0c1493716d534c96cf
1 #include "tree-vect.h"
3 #if VECTOR_BITS > 256
4 #define NINTS (VECTOR_BITS / 32)
5 #else
6 #define NINTS 8
7 #endif
9 #define N (NINTS * 2)
10 #define RESULT (NINTS * (NINTS - 1) / 2 * N + NINTS)
12 extern void abort (void);
14 typedef struct giga
16 unsigned int g[N];
17 } giga;
19 unsigned long __attribute__((noinline,noclone))
20 addfst(giga const *gptr, int num)
22 unsigned int retval = 0;
23 int i;
24 for (i = 0; i < num; i++)
25 retval += gptr[i].g[0];
26 return retval;
29 int main ()
31 struct giga g[NINTS];
32 unsigned int n = 1;
33 int i, j;
34 check_vect ();
35 for (i = 0; i < NINTS; ++i)
36 for (j = 0; j < N; ++j)
38 g[i].g[j] = n++;
39 __asm__ volatile ("");
41 if (addfst (g, NINTS) != RESULT)
42 abort ();
43 return 0;
46 /* We don't want to vectorize the single-element interleaving in the way
47 we currently do that (without ignoring not needed vectors in the
48 gap between gptr[0].g[0] and gptr[1].g[0]), because that's very
49 sub-optimal and causes memory explosion (even though the cost model
50 should reject that in the end). */
52 /* { dg-final { scan-tree-dump-times "vectorized 0 loops in function" 2 "vect" } } */