2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / no-scevccp-outer-13.c
blobb70aabd84a6e50cc7b3cd4fb0aebec44ce145a9d
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
8 unsigned short in[N];
10 __attribute__ ((noinline)) unsigned int
11 foo (short scale){
12 int i;
13 unsigned short j;
14 unsigned int sum = 0;
15 unsigned short sum_j;
17 for (i = 0; i < N; i++) {
18 sum_j = 0;
19 for (j = 0; j < N; j++) {
20 sum_j += j;
22 sum += ((unsigned int) in[i] * (unsigned int) sum_j) >> scale;
24 return sum;
27 __attribute__ ((noinline)) unsigned short
28 bar (void)
30 unsigned short j;
31 unsigned short sum_j;
32 sum_j = 0;
33 for (j = 0; j < N; j++) {
34 sum_j += j;
36 return sum_j;
39 int main (void)
41 int i;
42 unsigned short j, sum_j;
43 unsigned int sum = 0;
44 unsigned int res;
46 check_vect ();
48 for (i=0; i<N; i++){
49 in[i] = i;
52 res = foo (2);
54 /* check results: */
55 for (i=0; i<N; i++)
57 sum_j = bar ();
58 sum += ((unsigned int) in[i] * (unsigned int) sum_j) >> 2;
60 if (res != sum)
61 abort ();
63 return 0;
66 /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { target vect_widen_mult_hi_to_si } } } */
67 /* { dg-final { cleanup-tree-dump "vect" } } */