Relax gcc.dg/vect/pr65947-8.c
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / bb-slp-32.c
blob475b241c36ed66d9aec9c7322f2d7b48528fdb2f
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-additional-options "-fvect-cost-model=dynamic" } */
4 #include "tree-vect.h"
6 int __attribute__((noipa))
7 foo (int * __restrict__ x, int *p, int a, int b)
9 p = __builtin_assume_aligned (p, __BIGGEST_ALIGNMENT__);
10 x = __builtin_assume_aligned (x, __BIGGEST_ALIGNMENT__);
11 int tem0, tem1, tem2, tem3;
12 int sum = 0;
13 tem0 = p[0] + 1 + a;
14 sum += tem0;
15 x[0] = tem0;
16 tem1 = p[1] + 2 + b;
17 sum += tem1;
18 x[1] = tem1;
19 tem2 = p[2] + 3 + b;
20 sum += tem2;
21 x[2] = tem2;
22 tem3 = p[3] + 4 + a;
23 sum += tem3;
24 x[3] = tem3;
25 return sum;
28 int x[4] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
29 int p[4] __attribute__((aligned(__BIGGEST_ALIGNMENT__))) = { 0, 1, 2, 3 };
31 int main()
33 check_vect ();
35 if (foo (x, p, 7, 13) != 56)
36 abort ();
37 if (x[0] != 8 || x[1] != 16 || x[2] != 18 || x[3] != 14)
38 abort ();
39 return 0;
42 /* This is a weak test but we want to re-use the arithmetic for both the
43 store and the reduction. */
44 /* { dg-final { scan-tree-dump "re-using SLP tree" "slp2" { target { x86_64-*-* i?86-*-* } } } } */
45 /* On i386 we vectorize both the store and the reduction. */
46 /* { dg-final { scan-tree-dump-times "basic block part vectorized" 2 "slp2" { target { x86_64-*-* i?86-*-* } } } } */