OSDN Git Service

* tree-vectorizer.h (vect_is_simple_reduction): Takes a loop_vec_info
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-multitypes-10.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 unsigned char uX[N] __attribute__ ((__aligned__(16)));
9 unsigned short uY[N] __attribute__ ((__aligned__(16)));
10 unsigned int uresult[N];
11 signed char X[N] __attribute__ ((__aligned__(16)));
12 signed short Y[N] __attribute__ ((__aligned__(16)));
13 int result[N];
14
15 /* Unsigned type promotion (hi->si) */
16 int
17 foo1(int len) {
18   int i;
19
20   for (i=0; i<len; i++) {
21     uX[i] = 5;
22     uresult[i] = (unsigned int)uY[i];
23   }
24 }
25
26 /* Signed type promotion (hi->si) */
27 int
28 foo2(int len) {
29   int i;
30
31   for (i=0; i<len; i++) {
32     uX[i] = 5;
33     result[i] = (int)Y[i];
34   }
35 }
36
37 int main (void)
38 {
39   int i;
40
41   check_vect ();
42
43   for (i=0; i<N; i++) {
44     X[i] = 16-i;
45     uX[i] = 16-i;
46   }
47
48   foo1 (N);
49
50   for (i=0; i<N; i++) {
51     if (uresult[i] != (unsigned short)uY[i])
52       abort ();
53   }
54   
55   foo2 (N);
56   
57   for (i=0; i<N; i++) {
58     if (result[i] != (short)Y[i])
59       abort ();
60   }
61   
62   return 0;
63 }
64
65 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_unpack } } } */
66 /* { dg-final { cleanup-tree-dump "vect" } } */
67