blob: c590940e7ec885e89ddc851e7ec05ff1b0d6aee9 (
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
|
#include "avx2-check.h"
#define SIZE 256
TYPE a[SIZE];
TYPE b[SIZE];
TYPE c[SIZE];
volatile TYPE c_ref[SIZE];
extern int memcmp (const void *, const void *, size_t);
__attribute__ ((__noinline__))
void
gen_pop ()
{
int i;
for (i = 0; i < SIZE; ++i)
#ifdef BIN_OP
c[i] = BIN_OP (a[i], b[i]);
#else /* Must be UN_OP */
c[i] = UN_OP (a[i]);
#endif /* BIN_OP */
}
void
check_pop ()
{
int i;
for (i = 0; i < SIZE; ++i)
#ifdef BIN_OP
c_ref[i] = BIN_OP (a[i], b[i]);
#else /* Must be UN_OP */
c_ref[i] = UN_OP (a[i]);
#endif /* BIN_OP */
}
void static
avx2_test (void)
{
int i, j;
for (i = 0; i < 4; ++i )
{
for ( j = 0; j < SIZE; ++j )
{
a[i] = i * i + i;
b[i] = i * i * i;
}
gen_pop ();
check_pop ();
/* We need to cast away volatility from c_ref here in order to eliminate
warning if libc version of memcpy is used here. */
if (memcmp (c, (void *) c_ref, SIZE * sizeof (TYPE)))
abort();
}
}
|