libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-bitfield-read-1.c
blob147c959568de047ed36f69e5d2eea3532bbc9532
1 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
2 /* { dg-require-effective-target vect_int } */
3 /* { dg-require-effective-target vect_shift } */
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 extern void abort(void);
10 struct s { int i : 31; };
12 #define ELT0 {0}
13 #define ELT1 {1}
14 #define ELT2 {2}
15 #define ELT3 {3}
16 #define N 32
17 #define RES 48
18 struct s A[N]
19 = { ELT0, ELT1, ELT2, ELT3, ELT0, ELT1, ELT2, ELT3,
20 ELT0, ELT1, ELT2, ELT3, ELT0, ELT1, ELT2, ELT3,
21 ELT0, ELT1, ELT2, ELT3, ELT0, ELT1, ELT2, ELT3,
22 ELT0, ELT1, ELT2, ELT3, ELT0, ELT1, ELT2, ELT3};
24 int __attribute__ ((noipa))
25 f(struct s *ptr, unsigned n) {
26 int res = 0;
27 for (int i = 0; i < n; ++i)
28 res += ptr[i].i;
29 return res;
32 int main (void)
34 check_vect ();
36 if (f(&A[0], N) != RES)
37 abort ();
39 return 0;
42 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
43 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */