1 /* PR tree-optimization/88464 */
2 /* { dg-do run { target { avx512f } } } */
3 /* { dg-options "-O3 -mavx512f -mprefer-vector-width=512 -mtune=skylake-avx512" } */
4 
5 #include "avx512f-check.h"
6 
7 #include "avx512f-pr88464-1.c"
8 
9 static void
avx512f_test(void)10 avx512f_test (void)
11 {
12   double a[1024], b[1024];
13   float c[1024], f[1024];
14   int d[1024];
15   long e[1024];
16   int i;
17   for (i = 0; i < 1024; i++)
18     {
19       asm volatile ("" : "+g" (i));
20       a[i] = (i % 3) != 0 ? 15.0 : -5.0;
21       b[i] = 2 * i;
22       d[i] = (i % 3) ? 1023 - i : __INT_MAX__;
23     }
24   f1 (a, b, d, 1024);
25   for (i = 0; i < 1024; i++)
26     {
27       asm volatile ("" : "+g" (i));
28       if (a[i] != ((i % 3) != 0 ? (1023 - i) * 2.0 : -5.0))
29 	abort ();
30       a[i] = (i % 3) != 1 ? 15.0 : -5.0;
31       b[i] = 3 * i;
32       e[i] = (i % 3) != 1 ? 1023 - i : __LONG_MAX__;
33     }
34   f2 (a, b, e, 1024);
35   for (i = 0; i < 1024; i++)
36     {
37       asm volatile ("" : "+g" (i));
38       if (a[i] != ((i % 3) != 1 ? (1023 - i) * 3.0 : -5.0))
39 	abort ();
40       c[i] = (i % 3) != 2 ? 15.0f : -5.0f;
41       d[i] = (i % 3) != 2 ? 1023 - i : __INT_MAX__;
42       f[i] = 4 * i;
43     }
44   f3 (c, f, d, 1024);
45   for (i = 0; i < 1024; i++)
46     {
47       asm volatile ("" : "+g" (i));
48       if (c[i] != ((i % 3) != 2 ? (1023 - i) * 4.0f : -5.0f))
49 	abort ();
50       c[i] = (i % 3) != 0 ? 15.0f : -5.0f;
51       e[i] = (i % 3) != 0 ? 1023 - i : __INT_MAX__;
52       f[i] = 5 * i;
53     }
54   f4 (c, f, e, 1024);
55   for (i = 0; i < 1024; i++)
56     {
57       asm volatile ("" : "+g" (i));
58       if (c[i] != ((i % 3) != 0 ? (1023 - i) * 5.0f : -5.0f))
59 	abort ();
60     }
61 }
62