| 1 |
/* { dg-require-effective-target vect_float } */ |
| 2 |
|
| 3 |
#include "tree-vect.h" |
| 4 |
|
| 5 |
void __attribute__((noinline,noclone)) |
| 6 |
downscale_2 (const float* src, int src_n, float* dst) |
| 7 |
{ |
| 8 |
int i; |
| 9 |
|
| 10 |
for (i = 0; i < src_n; i += 2) { |
| 11 |
const float* a = src; |
| 12 |
const float* b = src + 4; |
| 13 |
|
| 14 |
dst[0] = (a[0] + b[0]) / 2; |
| 15 |
dst[1] = (a[1] + b[1]) / 2; |
| 16 |
dst[2] = (a[2] + b[2]) / 2; |
| 17 |
dst[3] = (a[3] + b[3]) / 2; |
| 18 |
|
| 19 |
src += 2 * 4; |
| 20 |
dst += 4; |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
int main () |
| 25 |
{ |
| 26 |
const float in[4 * 4] = { |
| 27 |
1, 2, 3, 4, |
| 28 |
5, 6, 7, 8, |
| 29 |
|
| 30 |
1, 2, 3, 4, |
| 31 |
5, 6, 7, 8 |
| 32 |
}; |
| 33 |
float out[2 * 4]; |
| 34 |
|
| 35 |
check_vect (); |
| 36 |
|
| 37 |
downscale_2 (in, 4, out); |
| 38 |
|
| 39 |
if (out[0] != 3 || out[1] != 4 || out[2] != 5 || out[3] != 6 |
| 40 |
|| out[4] != 3 || out[5] != 4 || out[6] != 5 || out[7] != 6) |
| 41 |
__builtin_abort (); |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |
| 45 |
|
| 46 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ |