2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-over-widen-2.c
blobeb9683eb21b76274ee99dec152c8c37a53ddbc94
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 64
9 /* Modified rgb to rgb conversion from FFmpeg. */
10 __attribute__ ((noinline)) void
11 foo (unsigned char *src, unsigned char *dst)
13 unsigned char *s = src;
14 int *d = (int *)dst;
15 int i;
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 *d = ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5));
24 d++;
27 s = src;
28 d = (int *)dst;
29 for (i = 0; i < N/4; i++)
31 const int b = *s++;
32 const int g = *s++;
33 const int r = *s++;
34 const int a = *s++;
35 if (*d != ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5)))
36 abort ();
37 d++;
41 int main (void)
43 int i;
44 unsigned char in[N], out[N];
46 check_vect ();
48 for (i = 0; i < N; i++)
50 in[i] = i;
51 out[i] = 255;
52 __asm__ volatile ("");
55 foo (in, out);
57 return 0;
60 /* Final value stays in int, so no over-widening is detected at the moment. */
61 /* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 0 "vect" } } */
62 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */