libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / gen-vect-2.c
bloba35999a172ac762bb4873d10b331301750f4015b
1 /* { dg-do run { target vect_cmdline_needed } } */
2 /* { dg-do compile { target { loongarch_sx && {! loongarch_sx_hw } } } } */
3 /* { dg-options "-O2 -fno-tree-loop-distribute-patterns -ftree-vectorize -fdump-tree-vect-details -fvect-cost-model=dynamic" } */
4 /* { dg-additional-options "-mno-sse" { target { i?86-*-* x86_64-*-* } } } */
5 /* { dg-additional-options "-mlsx" { target { loongarch*-*-* } } } */
7 #include <stdlib.h>
9 #define N 16
11 #if __INT_MAX__ == 32767
12 typedef char half_word;
13 #elif __LONG_MAX__ == 2147483647
14 typedef short half_word;
15 #else
16 typedef int half_word;
17 #endif
19 half_word cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
21 int main ()
23 half_word ca[N];
24 int i;
26 for (i = 0; i < N; i++)
28 ca[i] = cb[i];
31 /* check results: */
32 for (i = 0; i < N; i++)
34 if (ca[i] != cb[i])
35 abort ();
38 return 0;
41 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* pru-*-* } } } } } */
42 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* pru-*-* } } } } } */