aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/pr97678.c
blob: 1fa56326422e832e82bb6f1739f14ea1a1cb4955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target vect_int_mult } */
/* { dg-require-effective-target vect_pack_trunc } */
/* { dg-additional-options "-mavx2" { target avx2_runtime } } */

#include "tree-vect.h"

int
main ()
{
  unsigned int i = 0;
  unsigned short b[158 * 2];

  check_vect ();

  for (i = 0; i < 158; i++)
    {
      b[i * 2] = i * 7;
      b[i * 2 + 1] = i * 8;
    }

#pragma GCC novector
  for (i = 0; i < 158; ++i)
    if (b[i*2] != (unsigned short)(i*7)
        || b[i*2+1] != (unsigned short)(i*8))
      abort ();

  return 0;
}

/* The init loop should be vectorized with SLP.  */
/* We don't yet support SLP inductions for variable length vectors.  */
/* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" { xfail vect_variable_length } } } */