| 1 |
/* { dg-require-effective-target vect_int } */ |
| 2 |
|
| 3 |
#include <stdarg.h> |
| 4 |
#include "tree-vect.h" |
| 5 |
|
| 6 |
__attribute__ ((noinline)) void |
| 7 |
ayuv2yuyv_ref (int *d, int *src, int n) |
| 8 |
{ |
| 9 |
char *dest = (char *)d; |
| 10 |
int i; |
| 11 |
|
| 12 |
for(i=0;i<n/2;i++){ |
| 13 |
dest[i*4 + 0] = (src[i*2 + 0])>>16; |
| 14 |
dest[i*4 + 1] = (src[i*2 + 1])>>8; |
| 15 |
dest[i*4 + 2] = (src[i*2 + 0])>>16; |
| 16 |
dest[i*4 + 3] = (src[i*2 + 0])>>0; |
| 17 |
} |
| 18 |
|
| 19 |
/* Check results. */ |
| 20 |
#pragma GCC novector |
| 21 |
for(i=0;i<n/2;i++){ |
| 22 |
if (dest[i*4 + 0] != (src[i*2 + 0])>>16 |
| 23 |
|| dest[i*4 + 1] != (src[i*2 + 1])>>8 |
| 24 |
|| dest[i*4 + 2] != (src[i*2 + 0])>>16 |
| 25 |
|| dest[i*4 + 3] != (src[i*2 + 0])>>0) |
| 26 |
abort(); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
int main () |
| 31 |
{ |
| 32 |
int d[256], src[128], i; |
| 33 |
|
| 34 |
check_vect (); |
| 35 |
|
| 36 |
for (i = 0; i < 128; i++) |
| 37 |
src[i] = i; |
| 38 |
|
| 39 |
ayuv2yuyv_ref(d, src, 128); |
| 40 |
|
| 41 |
return 0; |
| 42 |
} |
| 43 |
|
| 44 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target { vect_strided4 && vect_strided2 } } } } */ |
| 45 |
|
| 46 |
|
| 47 |
|