| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O3" } */ |
| 3 |
/* { dg-require-effective-target lp64 } */ |
| 4 |
/* { dg-require-effective-target ppc_cpu_supports_hw } */ |
| 5 |
|
| 6 |
#define NO_WARN_X86_INTRINSICS 1 |
| 7 |
#include <x86intrin.h> |
| 8 |
#include "bmi-check.h" |
| 9 |
|
| 10 |
long long calc_andn_u64 (long long src1, |
| 11 |
long long src2, |
| 12 |
long long dummy) |
| 13 |
{ |
| 14 |
return (~src1 + dummy) & (src2); |
| 15 |
} |
| 16 |
|
| 17 |
static void |
| 18 |
bmi_test() |
| 19 |
{ |
| 20 |
unsigned i; |
| 21 |
|
| 22 |
long long src = 0xfacec0ffeefacec0; |
| 23 |
long long res, res_ref; |
| 24 |
|
| 25 |
for (i=0; i<5; ++i) { |
| 26 |
src = (i + src) << i; |
| 27 |
|
| 28 |
res_ref = calc_andn_u64 (src, src+i, 0); |
| 29 |
res = __andn_u64 (src, src+i); |
| 30 |
|
| 31 |
if (res != res_ref) |
| 32 |
abort(); |
| 33 |
} |
| 34 |
} |