Debian Codegraph @

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