OSDN Git Service

2008-06-07 Xinliang David Li <davidxl@google.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / slp-9.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 64
7
8 short X[N] __attribute__ ((__aligned__(16)));
9 short Y[N] __attribute__ ((__aligned__(16)));
10 int result[N];
11
12 /* short->int widening-mult */
13 int
14 foo1(int len) {
15   int i;
16
17   for (i=0; i<len/2; i++) {
18     result[2*i] = X[2*i] * Y[2*i];
19     result[2*i+1] = X[2*i+1] * Y[2*i+1];
20   }
21 }
22
23 int main (void)
24 {
25   int i;
26
27   check_vect ();
28
29   for (i=0; i<N; i++) {
30     X[i] = i;
31     Y[i] = 64-i;
32   }
33
34   foo1 (N);
35
36   for (i=0; i<N; i++) {
37     if (result[i] != X[i] * Y[i])
38       abort ();
39   }
40   
41   return 0;
42 }
43
44 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" {  target { vect_strided && vect_widen_mult_hi_to_si } } } }*/
45 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
46 /* { dg-final { cleanup-tree-dump "vect" } } */
47