aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/pr98674.c
blob: 0f1b6cb060bec8c31f6c1f15023acb425a06d8c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* { dg-do compile } */
/* { dg-additional-options "-msse2" { target sse2 } } */

void swap(short *p, int cnt)
{
  while (cnt-- > 0)
    {
      *p = ((*p << 8) & 0xFF00) | ((*p >> 8) & 0x00FF);
      ++p;
    }
}

/* Dependence analysis should not fail.  */
/* { dg-final { scan-tree-dump "dependence distance == 0" "vect" } } */
/* On x86 with SSE2 we can vectorize this with psllw/psrlw.  */
/* { dg-final { scan-tree-dump "loop vectorized" "vect" { target sse2 } } } */