Add __builtion_unreachable to vector::size(), vector::capacity()
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-over-widen-4-big-array.c
blob6b3a2b88abfb6a5cd4587d766b889825c2d53d60
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_shift } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #define N 512
9 /* Modified rgb to rgb conversion from FFmpeg. */
10 __attribute__ ((noinline)) int
11 foo (unsigned char *src, unsigned char *dst)
13 unsigned char *s = src;
14 unsigned short *d = (unsigned short *)dst, res;
15 int i, result = 0;
17 for (i = 0; i < N/4; i++)
19 const int b = *s++;
20 const int g = *s++;
21 const int r = *s++;
22 const int a = *s++;
23 res = ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5));
24 *d = res;
25 result += res;
26 d++;
29 s = src;
30 d = (unsigned short *)dst;
31 #pragma GCC novector
32 for (i = 0; i < N/4; i++)
34 const int b = *s++;
35 const int g = *s++;
36 const int r = *s++;
37 const int a = *s++;
38 if (*d != ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5)))
39 abort ();
40 d++;
43 return result;
46 int main (void)
48 int i;
49 unsigned char in[N], out[N];
51 check_vect ();
53 for (i = 0; i < N; i++)
55 in[i] = i;
56 out[i] = 255;
57 __asm__ volatile ("");
60 foo (in, out);
62 return 0;
65 /* { dg-final { scan-tree-dump-times "vect_recog_widen_shift_pattern: detected" 2 "vect" { target vect_widen_shift } } } */
66 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* >> 3} "vect" } } */
67 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* >> 5} "vect" } } */
68 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */