1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-tree-fre -fno-tree-pre -fdump-tree-optimized --param sra-max-scalarization-size-Ospeed=32" } */
3 /* System Z needs hardware vector support for this to work (the optimization
4    gets too complex without it.
5    { dg-additional-options "-march=z13" { target s390x-*-* } } */
6 /* Use generic tuning on x86 for the same reasons as why alpha, powerpc etc. are
7    xfailed below.
8    { dg-additional-options "-mtune=generic" { target i?86-*-* x86_64-*-* } } */
9 
10 int
foo()11 foo ()
12 {
13   const int a[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
14   int i, sum;
15 
16   sum = 0;
17   for (i = 0; i < sizeof (a) / sizeof (*a); i++)
18     sum += a[i];
19 
20   return sum;
21 }
22 
23 /* After late unrolling the above loop completely DOM should be
24    able to optimize this to return 28.  */
25 
26 /* On alpha, the vectorizer generates writes of two vector elements at once,
27    but the loop reads only one element at a time, and DOM cannot resolve these.
28    The same happens on powerpc depending on the SIMD support available.  */
29 
30 /* { dg-final { scan-tree-dump "return 28;" "optimized" { xfail { { alpha*-*-* hppa*64*-*-* nvptx*-*-* mmix-knuth-mmixware } || { { { lp64 && { powerpc*-*-* sparc*-*-* riscv*-*-* } } || aarch64_sve } || { arm*-*-* && { ! arm_neon } } } } } } } */
31