111
|
1 /* { dg-require-effective-target vect_int } */
|
|
2 /* { dg-require-effective-target vect_shift } */
|
|
3
|
|
4 #include <stdarg.h>
|
|
5 #include "tree-vect.h"
|
|
6
|
|
7 #define N 512
|
|
8
|
|
9 /* Modified rgb to rgb conversion from FFmpeg. */
|
|
10 __attribute__ ((noinline)) int
|
|
11 foo (unsigned char *src, unsigned char *dst)
|
|
12 {
|
|
13 unsigned char *s = src;
|
|
14 unsigned short *d = (unsigned short *)dst, res;
|
|
15 int i, result = 0;
|
|
16
|
|
17 for (i = 0; i < N/4; i++)
|
|
18 {
|
|
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++;
|
|
27 }
|
|
28
|
|
29 s = src;
|
|
30 d = (unsigned short *)dst;
|
|
31 for (i = 0; i < N/4; i++)
|
|
32 {
|
|
33 const int b = *s++;
|
|
34 const int g = *s++;
|
|
35 const int r = *s++;
|
|
36 const int a = *s++;
|
|
37 if (*d != ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5)))
|
|
38 abort ();
|
|
39 d++;
|
|
40 }
|
|
41
|
|
42 return result;
|
|
43 }
|
|
44
|
|
45 int main (void)
|
|
46 {
|
|
47 int i;
|
|
48 unsigned char in[N], out[N];
|
|
49
|
|
50 check_vect ();
|
|
51
|
|
52 for (i = 0; i < N; i++)
|
|
53 {
|
|
54 in[i] = i;
|
|
55 out[i] = 255;
|
|
56 __asm__ volatile ("");
|
|
57 }
|
|
58
|
|
59 foo (in, out);
|
|
60
|
|
61 return 0;
|
|
62 }
|
|
63
|
|
64 /* { dg-final { scan-tree-dump-times "vect_recog_widen_shift_pattern: detected" 2 "vect" { target vect_widen_shift } } } */
|
131
|
65 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* << 3} "vect" } } */
|
|
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]* << 8} "vect" } } */
|
|
68 /* { dg-final { scan-tree-dump {vect_recog_over_widening_pattern: detected:[^\n]* >> 5} "vect" } } */
|
111
|
69 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
|
|
70
|