aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-bitfield-read-2-not.c
blob: 4ac7b3fc0dfd1c9d0b5e94a2ba6a745545577ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* { dg-require-effective-target vect_shift } */
/* { dg-require-effective-target vect_long_long } */
/* { dg-additional-options { "-fdump-tree-ifcvt-all" } } */

#include <stdarg.h>
#include "tree-vect.h"

extern void abort(void);

struct s {
    char a : 4;
};

#define N 32
#define ELT0 {0}
#define ELT1 {1}
#define ELT2 {2}
#define ELT3 {3}
#define RES 48
struct s A[N]
  = { ELT0, ELT1, ELT2, ELT3, ELT0, ELT1, ELT2, ELT3,
      ELT0, ELT1, ELT2, ELT3, ELT0, ELT1, ELT2, ELT3,
      ELT0, ELT1, ELT2, ELT3, ELT0, ELT1, ELT2, ELT3,
      ELT0, ELT1, ELT2, ELT3, ELT0, ELT1, ELT2, ELT3};

int __attribute__ ((noipa))
f(struct s *ptr, unsigned n) {
    int res = 0;
    for (int i = 0; i < n; ++i)
      {
	asm volatile ("" ::: "memory");
	res += ptr[i].a;
      }
    return res;
}

int main (void)
{
  check_vect ();

  if (f(&A[0], N) != RES)
    abort ();

  return 0;
}

/* { dg-final { scan-tree-dump-not "Bitfield OK to lower." "ifcvt" } } */