Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-bitfield-write-1.c

raw
1 /* { dg-additional-options "-fdump-tree-optimized-details-blocks" } */
2 /* { dg-require-effective-target vect_int } */
3
4 #include <stdarg.h>
5 #include "tree-vect.h"
6
7 extern void abort(void);
8
9 struct s { int i : 31; };
10
11 #define N 32
12 #define V 5
13 struct s A[N];
14
15 void __attribute__ ((noipa))
16 f(struct s *ptr, unsigned n) {
17 for (int i = 0; i < n; ++i)
18 ptr[i].i = V;
19 }
20
21 void __attribute__ ((noipa))
22 check_f(struct s *ptr) {
23 #pragma GCC novector
24 for (unsigned i = 0; i < N; ++i)
25 if (ptr[i].i != V)
26 abort ();
27 }
28
29 int main (void)
30 {
31 check_vect ();
32 __builtin_memset (&A[0], 0, sizeof(struct s) * N);
33
34 f(&A[0], N);
35 check_f (&A[0]);
36
37 return 0;
38 }
39
40 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
41
42 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */