testsuite: Revert to the original version of pr100056.c
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-over-widen-1.c
blob21fbcf4ed70716b47da6cbd268f041965584d08b
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_shift } */
4 #include <stdarg.h>
5 #include "tree-vect.h"
7 #if VECTOR_BITS > 128
8 #define N (VECTOR_BITS * 8 / 16)
9 #else
10 #define N 64
11 #endif
13 /* Modified rgb to rgb conversion from FFmpeg. */
14 __attribute__ ((noinline)) void
15 foo (unsigned char *src, unsigned char *dst)
17 unsigned char *s = src;
18 unsigned short *d = (unsigned short *)dst;
19 int i;
21 for (i = 0; i < N/4; i++)
23 const int b = *s++;
24 const int g = *s++;
25 const int r = *s++;
26 const int a = *s++;
27 *d = ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5));
28 d++;
31 s = src;
32 d = (unsigned short *)dst;
33 #pragma GCC novector
34 for (i = 0; i < N/4; i++)
36 const int b = *s++;
37 const int g = *s++;
38 const int r = *s++;
39 const int a = *s++;
40 if (*d != ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5)))
41 abort ();
42 d++;
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" } } */