aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/vect-125.c
blob: 4a3c0dc7a3a4a77897b490362c37473d6d37ab99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target vect_int_mult } */
/* { dg-require-effective-target vect_pack_trunc } */
/* { dg-require-effective-target vect_unpack } */

void train(short *t, short *w, int n, int err)
{
  n=(n+7)&-8;
  for (int i=0; i<n; ++i)
    {
      int wt=w[i]+((t[i]*err*2>>16)+1>>1);
      if (wt<-32768) wt=-32768;
      if (wt>32767) wt=32767;
      w[i]=wt;
    }
}

/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail vect_no_int_min_max } } } */