OSDN Git Service

* gcc.dg/vect/slp-13.c: Increase array size, add initialization.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-over-widen-2-big-array.c
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_shift } */
3
4 #include <stdlib.h>
5 #include <stdarg.h>
6 #include "tree-vect.h"
7
8 #define N 512
9
10 /* Modified rgb to rgb conversion from FFmpeg.  */
11 __attribute__ ((noinline)) void
12 foo (unsigned char *src, unsigned char *dst)
13 {
14   unsigned char *s = src;
15   int *d = (int *)dst;
16   int i;
17
18   for (i = 0; i < N/4; i++)
19     {
20       const int b = *s++;
21       const int g = *s++;
22       const int r = *s++;
23       const int a = *s++;
24       *d = ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5));
25       d++;
26     }
27
28   s = src;
29   d = (int *)dst;
30   for (i = 0; i < N/4; i++)
31     {
32       const int b = *s++;
33       const int g = *s++;
34       const int r = *s++;
35       const int a = *s++;
36       if (*d != ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5)))
37         abort ();
38       d++;
39     }
40 }
41
42 int main (void)
43 {
44   int i;
45   unsigned char in[N], out[N];
46
47   check_vect ();
48
49   for (i = 0; i < N; i++)
50     {
51       in[i] = i;
52       out[i] = 255;
53       __asm__ volatile ("");
54     }
55
56   foo (in, out);
57
58   return 0;
59 }
60
61 /* Final value stays in int, so no over-widening is detected at the moment.  */
62 /* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 0 "vect" } } */
63 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
64 /* { dg-final { cleanup-tree-dump "vect" } } */
65