openmp: Add testcases for omp_max_vf
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr60276.c
blob824e2a336b6d9fad2e7a72c445ec2edf80be8138
1 #include "tree-vect.h"
3 extern void abort (void);
5 static void
6 foo (int *out, const int *lp, unsigned samples)
8 int x, target;
9 for (x = 0, target = 0; x < (int)samples; x += 2, target++)
11 out[x] = lp[target];
12 out[x - 1] = out[x - 2] + out[x];
16 static void
17 foo_novec (int *out, const int *lp, unsigned samples)
19 int x, target;
20 for (x = 0, target = 0; x < (int)samples; x += 2, target++)
22 out[x] = lp[target];
23 out[x - 1] = out[x - 2] + out[x];
24 __asm__ volatile ("" : : : "memory");
28 int main(void)
30 const int lp[25] = {
31 0, 2, 4, 6, 8,
32 10, 12, 14, 16,
33 18, 20, 22, 24,
34 26, 28, 30, 32,
35 34, 36, 38, 40,
36 42, 44, 46, 48,
38 int out[49] = {0};
39 int out2[49] = {0};
40 int s;
42 check_vect ();
44 foo (out + 2, lp + 1, 48);
45 foo_novec (out2 + 2, lp + 1, 48);
47 #pragma GCC novector
48 for (s = 0; s < 49; s++)
49 if (out[s] != out2[s])
50 abort ();
52 return 0;