Debian Codegraph @

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

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