libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-bitfield-write-5.c
blob386de504aad82c0ca7d05f80cf5c5f8380c79bc8
1 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
2 /* { dg-require-effective-target vect_int } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 extern void abort(void);
9 struct s {
10 unsigned b : 23;
11 unsigned a : 8;
14 #define N 32
15 #define V 5
16 struct s A[N];
18 void __attribute__ ((noipa))
19 f(struct s *ptr, unsigned n) {
20 for (int i = 0; i < n; ++i)
21 ptr[i].a = V;
24 void __attribute__ ((noipa))
25 check_f(struct s *ptr) {
26 #pragma GCC novector
27 for (unsigned i = 0; i < N; ++i)
28 if (ptr[i].a != V)
29 abort ();
32 int main (void)
34 check_vect ();
35 __builtin_memset (&A[0], 0, sizeof(struct s) * N);
37 f(&A[0], N);
38 check_f (&A[0]);
40 return 0;
43 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
45 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */