| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-ftree-vectorize" } */ |
| 3 |
|
| 4 |
struct Pixel { |
| 5 |
unsigned short r; |
| 6 |
unsigned short g; |
| 7 |
unsigned short b; |
| 8 |
unsigned short a; |
| 9 |
}; |
| 10 |
|
| 11 |
void fn(unsigned char * __restrict dst, const unsigned char * __restrict src) |
| 12 |
{ |
| 13 |
unsigned x; |
| 14 |
for(x = 0; x < 1024; x += 1) |
| 15 |
{ |
| 16 |
struct Pixel pixel; |
| 17 |
pixel.r = (unsigned short)(((unsigned)src[0]) * 0xffff / 0xff); |
| 18 |
pixel.g = (unsigned short)(((unsigned)src[1]) * 0xffff / 0xff); |
| 19 |
pixel.b = (unsigned short)(((unsigned)src[2]) * 0xffff / 0xff); |
| 20 |
pixel.a = (unsigned short)(((unsigned)src[3]) * 0xffff / 0xff); |
| 21 |
__builtin_memcpy(dst, &pixel, sizeof pixel); |
| 22 |
src += 4; |
| 23 |
dst += 8; |
| 24 |
} |
| 25 |
} |