| 1 |
/* { dg-require-effective-target loongarch_sx_hw } */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-options "-march=loongarch64 -mfpu=64 -mlsx -O3" } */ |
| 4 |
|
| 5 |
typedef __INT32_TYPE__ int32_t; |
| 6 |
typedef unsigned __INT32_TYPE__ uint32_t; |
| 7 |
|
| 8 |
__attribute__ ((noipa)) static int32_t |
| 9 |
long_filter_ehigh_3830_1 (int32_t *buffer, int length) |
| 10 |
{ |
| 11 |
int i, j; |
| 12 |
int32_t dotprod = 0; |
| 13 |
int32_t delay[4] = { 0 }; |
| 14 |
uint32_t coeffs[4] = { 0 }; |
| 15 |
|
| 16 |
for (i = 0; i < length; i++) |
| 17 |
{ |
| 18 |
dotprod = 0; |
| 19 |
for (j = 3; j >= 0; j--) |
| 20 |
{ |
| 21 |
dotprod += delay[j] * coeffs[j]; |
| 22 |
coeffs[j] += ((delay[j] >> 31) | 1); |
| 23 |
} |
| 24 |
for (j = 3; j > 0; j--) |
| 25 |
delay[j] = delay[j - 1]; |
| 26 |
delay[0] = buffer[i]; |
| 27 |
} |
| 28 |
|
| 29 |
return dotprod; |
| 30 |
} |
| 31 |
|
| 32 |
int |
| 33 |
main () |
| 34 |
{ |
| 35 |
int32_t buffer[] = { -1, 1 }; |
| 36 |
if (long_filter_ehigh_3830_1 (buffer, 2) != -1) |
| 37 |
__builtin_trap (); |
| 38 |
} |