aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/avx512f-pr88464-4.c
blob: e347e63b17a1a0c75df1a0ee3822b305e6a17c5f (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* PR tree-optimization/88464 */
/* { dg-do run { target { avx512f } } } */
/* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -mtune=skylake-avx512" } */

#include "avx512f-check.h"

#include "avx512f-pr88464-3.c"

static void
avx512f_test (void)
{
  double a[1024], b[1024];
  float c[1024], f[1024];
  int d[1024];
  long e[1024];
  int i;
  for (i = 0; i < 1024; i++)
    {
      asm volatile ("" : "+g" (i));
      a[i] = -5.0;
      b[i] = (i % 3) != 0 ? 2.0 * i : -5.0;
      d[i] = (i % 3) != 0 ? 1023 - i : __INT_MAX__;
    }
  f1 (a, b, d, 1024);
  for (i = 0; i < 1024; i++)
    {
      asm volatile ("" : "+g" (i));
      if (a[i] != ((i % 3) != 0 ? (1023 - i) * 2.0 : -5.0))
	abort ();
      a[i] = -5.0;
      b[i] = (i % 3) != 1 ? 3.0 * i : -5.0;
      e[i] = (i % 3) != 1 ? 1023 - i : __LONG_MAX__;
    }
  f2 (a, b, e, 1024);
  for (i = 0; i < 1024; i++)
    {
      asm volatile ("" : "+g" (i));
      if (a[i] != ((i % 3) != 2 ? (1023 - i) * 3.0 : -5.0))
	abort ();
      c[i] = -5.0f;
      d[i] = (i % 3) != 2 ? 1023 - i : __INT_MAX__;
      f[i] = (i % 3) != 2 ? 4.0f * i : -5.0f;
    }
  f3 (c, f, d, 1024);
  for (i = 0; i < 1024; i++)
    {
      asm volatile ("" : "+g" (i));
      if (c[i] != ((i % 3) != 1 ? (1023 - i) * 4.0f : -5.0f))
	abort ();
      c[i] = -5.0f;
      e[i] = (i % 3) != 0 ? 1023 - i : __INT_MAX__;
      f[i] = (i % 3) != 0 ? 5.0f * i : -5.0f;
    }
  f4 (c, f, e, 1024);
  for (i = 0; i < 1024; i++)
    {
      asm volatile ("" : "+g" (i));
      if (c[i] != ((i % 3) != 0 ? (1023 - i) * 5.0f : -5.0f))
	abort ();
    }
}