summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.target/i386/avx512vl-pr96246-2.C
blob: 9a16f0d2c9e86f622b50863a936a5bf96257df76 (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
34
35
36
37
38
39
40
41
/* PR target/96246 */
/* { dg-do run } */
/* { dg-require-effective-target avx512bw } */
/* { dg-require-effective-target avx512vl } */
/* { dg-options "-O2 -std=c++14 -mavx512bw -mavx512vl" } */

#include "avx512vl-pr96246-1.C"

#define RUNTIME_TEST(vtype, num)			\
  do							\
    {							\
      vtype a, b, c, d;					\
      vtype res;					\
      for (int i = 0; i != num; i++)			\
	{						\
	  a[i] = i * 2;					\
	  b[i] = i * i - 5;				\
	  c[i] = 1;					\
	  d[i] = 0;					\
	}						\
      res = foo_##vtype (a, b, c, d);			\
      for (int i = 0; i != num; i++)			\
	if (res [i] != (a[i] > b[i] ? c[i] : d[i]))	\
	  __builtin_abort ();				\
    }							\
  while (0)

int
main (void)
{
  RUNTIME_TEST (v16qi, 16);
  RUNTIME_TEST (v32qi, 32);
  RUNTIME_TEST (v16hi, 16);
  RUNTIME_TEST (v4si, 4);
  RUNTIME_TEST (v8si, 8);
  RUNTIME_TEST (v4sf, 4);
  RUNTIME_TEST (v8sf, 8);
  RUNTIME_TEST (v4di, 4);
  RUNTIME_TEST (v4df, 4);
  return 0;
}