2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr37539.c
blob1d569a9986e99a26fd7c9aff9fcfd0dbf18049d1
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 __attribute__ ((noinline)) void
7 ayuv2yuyv_ref (int *d, int *src, int n)
9 char *dest = (char *)d;
10 int i;
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;
19 /* Check results. */
20 for(i=0;i<n/2;i++){
21 if (dest[i*4 + 0] != (src[i*2 + 0])>>16
22 || dest[i*4 + 1] != (src[i*2 + 1])>>8
23 || dest[i*4 + 2] != (src[i*2 + 0])>>16
24 || dest[i*4 + 3] != (src[i*2 + 0])>>0)
25 abort();
29 int main ()
31 int d[256], src[128], i;
33 for (i = 0; i < 128; i++)
34 src[i] = i;
36 ayuv2yuyv_ref(d, src, 128);
38 return 0;
41 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_strided_wide } } } */
42 /* { dg-final { cleanup-tree-dump "vect" } } */