| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target avx } */ |
| 3 |
/* { dg-options "-O2 -mavx" } */ |
| 4 |
|
| 5 |
#include "avx-check.h" |
| 6 |
|
| 7 |
void static |
| 8 |
avx_test (void) |
| 9 |
{ |
| 10 |
int s1i[8] = {0, 0, 0, 0, 0, 0, 0, 0}; |
| 11 |
int s2i[8] = {1, 2, 3, 4, 5, 6, 7, 8}; |
| 12 |
int d; |
| 13 |
int c = 1, z = 1, e = 0xf; |
| 14 |
int i; |
| 15 |
union256i_d s1, s2; |
| 16 |
|
| 17 |
s1.x = _mm256_loadu_si256 ((__m256i*)s1i); |
| 18 |
s2.x = _mm256_loadu_si256 ((__m256i*)s2i); |
| 19 |
d = _mm256_testnzc_si256 (s1.x, s2.x); |
| 20 |
|
| 21 |
for (i = 0; i < 8; i++) |
| 22 |
{ |
| 23 |
if ((s1.a[i] & s2.a[i])) |
| 24 |
z = 0; |
| 25 |
if ((~s1.a[i] & s2.a[i])) |
| 26 |
c = 0; |
| 27 |
} |
| 28 |
|
| 29 |
e = (z == 0 && c == 0) ? 1 : 0; |
| 30 |
|
| 31 |
if (d != e) |
| 32 |
abort (); |
| 33 |
} |