summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-aggressive-1.c
blob: b18d2cbefa36a1185e4fdf039a831eeb35c4c508 (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
50
51
52
53
54
55
56
57
58
59
60
/* { dg-require-effective-target vect_condition } */
/* { dg-require-effective-target vect_simd_clones } */
/* { dg-additional-options "-fopenmp-simd" } */

#include "tree-vect.h"

#define N 64
int a[N];
int c[N];

__attribute__ ((noinline)) int
foo (void)
{
  int i, res = 0;
#pragma omp simd safelen(8)
  for (i = 0; i < N; i++)
  {
    int t = a[i];
    if (c[i] != 0)
      if (t != 100 & t > 5)
	res += 1;
  }
  return res;
}

__attribute__ ((noinline)) int
hundred (void)
{
  return 100;
}


int main (void)
{
  int i;

  check_vect ();

  for (i = 0; i < N; i++)
    {
      c[i] = i & 1;
      switch (i & 3)
	{
case 0:
	  a[i] = hundred ();
	  break;
case 1:
	  a[i] = 1;
	  break;
default:
	  a[i] = i + 6;
	  break;
	}
    }
  if (foo () != 16)
    abort ();
  return 0;
}

/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */