libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / bb-slp-subgroups-3.c
blobd1d79125731e7f9ff211b78793fee5c7d53f5747
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_int_mult } */
3 /* PR tree-optimization/67682. */
5 #include "tree-vect.h"
7 int __attribute__((__aligned__(8))) a[8];
8 int __attribute__((__aligned__(8))) b[8];
10 __attribute__ ((noinline)) void
11 test ()
13 a[0] = b[0] + 1;
14 a[1] = b[1] + 2;
15 a[2] = b[2] + 3;
16 a[3] = b[3] + 4;
17 a[4] = b[0] * 3;
18 a[5] = b[2] * 4;
19 a[6] = b[4] * 5;
20 a[7] = b[6] * 7;
23 int
24 main (int argc, char **argv)
26 check_vect ();
28 for (int i = 0; i < 8; i++)
29 a[i] = 1;
30 for (int i = 0; i < 8; i++)
31 b[i] = i + 4;
32 __asm__ volatile ("" : : : "memory");
33 test (a, b);
34 __asm__ volatile ("" : : : "memory");
35 if ((a[0] != 5) || (a[1] != 7) || (a[2] != 9) || (a[3] != 11)
36 || (a[4] != 12) || (a[5] != 24) || (a[6] != 40) || (a[7] != 70))
37 abort ();
38 return 0;
41 /* { dg-final { scan-tree-dump-times "Basic block will be vectorized using SLP" 1 "slp2" } } */
42 /* Because we disable the cost model, targets with variable-length
43 vectors can end up vectorizing the store to a[0..7] on its own.
44 With the cost model we do something sensible. */
45 /* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" { target { ! amdgcn-*-* } xfail { vect_variable_length && { ! vect128 } } } } } */
47 /* amdgcn can do this in one vector. */
48 /* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { target amdgcn-*-* } } } */