PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx2-vpop-check.h
blobc590940e7ec885e89ddc851e7ec05ff1b0d6aee9
1 #include "avx2-check.h"
3 #define SIZE 256
5 TYPE a[SIZE];
6 TYPE b[SIZE];
7 TYPE c[SIZE];
8 volatile TYPE c_ref[SIZE];
9 extern int memcmp (const void *, const void *, size_t);
11 __attribute__ ((__noinline__))
12 void
13 gen_pop ()
15 int i;
16 for (i = 0; i < SIZE; ++i)
17 #ifdef BIN_OP
18 c[i] = BIN_OP (a[i], b[i]);
19 #else /* Must be UN_OP */
20 c[i] = UN_OP (a[i]);
21 #endif /* BIN_OP */
24 void
25 check_pop ()
27 int i;
28 for (i = 0; i < SIZE; ++i)
29 #ifdef BIN_OP
30 c_ref[i] = BIN_OP (a[i], b[i]);
31 #else /* Must be UN_OP */
32 c_ref[i] = UN_OP (a[i]);
33 #endif /* BIN_OP */
36 void static
37 avx2_test (void)
39 int i, j;
40 for (i = 0; i < 4; ++i )
42 for ( j = 0; j < SIZE; ++j )
44 a[i] = i * i + i;
45 b[i] = i * i * i;
48 gen_pop ();
49 check_pop ();
51 /* We need to cast away volatility from c_ref here in order to eliminate
52 warning if libc version of memcpy is used here. */
53 if (memcmp (c, (void *) c_ref, SIZE * sizeof (TYPE)))
54 abort();