OSDN Git Service

* config/rs6000/atlivec.md (mulv4si3): New pattern.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-92.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 /* known misalignment: same alignment  */
11
12 int
13 main1 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
14 {
15   int i;
16
17   for (i = 0; i < 5; i++)
18     {
19       pa[i+1] = pb[i+1] * pc[i+1];
20     }
21
22   /* check results:  */
23   for (i = 0; i < 5; i++)
24     {
25       if (pa[i+1] != (pb[i+1] * pc[i+1]))
26         abort ();
27     }
28
29   return 0;
30 }
31
32 int
33 main2 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc)
34 {
35   int i;
36
37   for (i = 0; i < 6; i++)
38     {
39       pa[i+1] = pb[i+1] * pc[i+1];
40     }
41
42   /* check results:  */
43   for (i = 0; i < 6; i++)
44     {
45       if (pa[i+1] != (pb[i+1] * pc[i+1]))
46         abort ();
47     }
48
49   return 0;
50 }
51
52 int
53 main3 (afloat * __restrict__ pa, afloat * __restrict__ pb, afloat * __restrict__ pc, int n)
54 {
55   int i;
56
57   for (i = 0; i < n; i++)
58     {
59       pa[i+1] = pb[i+1] * pc[i+1];
60     }
61
62   /* check results:  */
63   for (i = 0; i < n; i++)
64     {
65       if (pa[i+1] != (pb[i+1] * pc[i+1]))
66         abort ();
67     }
68
69   return 0;
70 }
71
72 int main (void)
73 {
74   int i;
75   afloat a[N];
76   afloat b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
77   afloat c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
78
79   check_vect ();
80
81   main1 (a,b,c);
82   main2 (a,b,c);
83   main3 (a,b,c,N);
84
85   return 0;
86 }
87
88 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" } } */
89 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
90 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" } } */