OSDN Git Service

* lib/target-supports.exp (check_effective_target_vect_int): New
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-42.c
1 /* { dg-require-effective-target vect_float } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 256
7
8 typedef float afloat __attribute__ ((__aligned__(16)));
9
10 void bar (afloat *pa, afloat *pb, afloat *pc) 
11 {
12   int i;
13
14   /* check results:  */
15   for (i = 0; i < N; i++)
16     {
17       if (pa[i] != (pb[i] * pc[i]))
18         abort ();
19     }
20
21   return;
22 }
23
24
25 int
26 main1 (afloat * __restrict__ pa)
27 {
28   int i;
29   afloat pb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
30   afloat pc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
31
32
33   for (i = 0; i < N; i++)
34     {
35       pa[i] = pb[i] * pc[i];
36     }
37
38   return 0;
39 }
40
41 int main (void)
42 {
43   int i;
44   afloat a[N];
45   afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
46   afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
47
48   check_vect ();
49
50   main1 (a);
51   bar (a,b,c);
52   return 0;
53 }
54
55 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"} } */