| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target vect_int } */ |
| 3 |
/* { dg-require-effective-target vect_int_mult } */ |
| 4 |
/* { dg-require-effective-target vect_pack_trunc } */ |
| 5 |
/* { dg-require-effective-target vect_unpack } */ |
| 6 |
|
| 7 |
void train(short *t, short *w, int n, int err) |
| 8 |
{ |
| 9 |
n=(n+7)&-8; |
| 10 |
for (int i=0; i<n; ++i) |
| 11 |
{ |
| 12 |
int wt=w[i]+((t[i]*err*2>>16)+1>>1); |
| 13 |
if (wt<-32768) wt=-32768; |
| 14 |
if (wt>32767) wt=32767; |
| 15 |
w[i]=wt; |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail vect_no_int_min_max } } } */ |