Debian Codegraph @

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

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