| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target vect_shift } */ |
| 3 |
/* { dg-require-effective-target vect_int } */ |
| 4 |
|
| 5 |
typedef unsigned int uint32_t; |
| 6 |
typedef short unsigned int uint16_t; |
| 7 |
|
| 8 |
int foo (uint32_t arr[4][4]) |
| 9 |
{ |
| 10 |
int sum = 0; |
| 11 |
for(int i = 0; i < 4; i++) |
| 12 |
{ |
| 13 |
sum += ((arr[0][i] >> 10) * 20) + ((arr[1][i] >> 11) & 53) |
| 14 |
+ ((arr[2][i] >> 12) * 7) + ((arr[3][i] >> 13) ^ 43); |
| 15 |
} |
| 16 |
return (((uint16_t)sum) + ((uint32_t)sum >> 16)) >> 1; |
| 17 |
} |
| 18 |
|
| 19 |
/* For a target that has a vector/scalar shift/rotate optab, check |
| 20 |
that we are not adding the cost of creating a vector from the scalar |
| 21 |
in the prologue. */ |
| 22 |
/* { dg-final { scan-tree-dump {vectorizable_shift ===[\n\r][^\n]*prologue_cost = 0} "vect" { target { aarch64*-*-* x86_64-*-* } } } } */ |