Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-bitfield-write-2.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 a : 4;
13 };
14
15 #define N 32
16 #define V 5
17 struct s A[N];
18
19 void __attribute__ ((noipa))
20 f(struct s *ptr, unsigned n) {
21 for (int i = 0; i < n; ++i)
22 ptr[i].a = V;
23 }
24
25 void __attribute__ ((noipa))
26 check_f(struct s *ptr) {
27 #pragma GCC novector
28 for (unsigned i = 0; i < N; ++i)
29 if (ptr[i].a != V)
30 abort ();
31 }
32
33 int main (void)
34 {
35 check_vect ();
36 __builtin_memset (&A[0], 0, sizeof(struct s) * N);
37
38 f(&A[0], N);
39 check_f (&A[0]);
40
41 return 0;
42 }
43
44 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
45
46 /* { dg-final { scan-tree-dump-not "Invalid sum" "optimized" } } */