PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-over-widen-3-big-array.c
blobd828c833f5558a39ca190e1ee1db59e95d23c421
1 /* { dg-require-effective-target vect_int } */
2 /* { dg-require-effective-target vect_shift } */
4 #include <stdlib.h>
5 #include <stdarg.h>
6 #include "tree-vect.h"
8 #define N 128
10 /* Modified rgb to rgb conversion from FFmpeg. */
11 __attribute__ ((noinline)) void
12 foo (unsigned char *src, unsigned char *dst)
14 unsigned char *s = src;
15 unsigned short *d = (unsigned short *)dst;
16 int i;
18 for (i = 0; i < N/4; i++)
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&0xFFC)<<3) | ((r+0xF8)>>8) | (a<<9));
25 d++;
28 s = src;
29 d = (unsigned short *)dst;
30 for (i = 0; i < N/4; i++)
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&0xFFC)<<3) | ((r+0xF8)>>8) | (a<<9)))
37 abort ();
38 d++;
42 int main (void)
44 int i;
45 unsigned char in[N], out[N];
47 check_vect ();
49 for (i = 0; i < N; i++)
51 in[i] = i;
52 out[i] = 255;
53 __asm__ volatile ("");
56 foo (in, out);
58 return 0;
61 /* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 1 "vect" } } */
62 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
63 /* { dg-final { cleanup-tree-dump "vect" } } */