IVOPT performance tuning patch. The main problem is a variant of maximal weight
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-cond-1.c
blob4ee67132a82f3991b477e476c70de0b83b9b0e96
1 /* { dg-require-effective-target vect_condition } */
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include "tree-vect.h"
7 #define M 32
8 #define N 16
10 int x_in[M];
11 int x_out[M];
12 int c[N] = {3,2,1,10,1,42,3,4,50,9,32,8,11,10,1,2};
13 int a[N+1] = {0,16,32,48,64,128,256,512,0,16,32,48,64,128,256,512,1024};
14 int check_result[M] = {1024,1024,1024,256,256,256,256,256,256,256,256,128,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48};
16 __attribute__ ((noinline)) void
17 foo ()
19 int j, i, x;
20 int curr_a, next_a;
22 for (j = 0; j < M; j++)
24 x = x_in[j];
25 curr_a = a[0];
27 for (i = 0; i < N; i++)
29 next_a = a[i+1];
30 curr_a = x > c[i] ? curr_a : next_a;
33 x_out[j] = curr_a;
37 int main (void)
39 int i,j;
41 check_vect ();
43 for (j = 0; j < M; j++)
44 x_in[j] = j;
46 foo ();
48 for (j = 0; j < M; j++)
49 if (x_out[j] != check_result[j])
50 abort ();
52 return 0;
55 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
56 /* { dg-final { cleanup-tree-dump "vect" } } */