| 1 |
/* { dg-do run { target { bmi && { ! ia32 } } } } */ |
| 2 |
/* { dg-options "-O2 -mbmi -fno-inline" } */ |
| 3 |
|
| 4 |
#include <x86intrin.h> |
| 5 |
|
| 6 |
#include "bmi-check.h" |
| 7 |
|
| 8 |
long long calc_blsr_u64 (long long src1, long long src2) |
| 9 |
{ |
| 10 |
return (src1-1) & (src2); |
| 11 |
} |
| 12 |
|
| 13 |
static void |
| 14 |
bmi_test() |
| 15 |
{ |
| 16 |
unsigned i; |
| 17 |
long long src = 0xfacec0ffeefacec0; |
| 18 |
long long res, res_ref; |
| 19 |
|
| 20 |
for (i=0; i<5; ++i) { |
| 21 |
src = i + src << i; |
| 22 |
|
| 23 |
res_ref = calc_blsr_u64 (src, src); |
| 24 |
res = __blsr_u64 (src); |
| 25 |
|
| 26 |
if (res != res_ref) |
| 27 |
abort(); |
| 28 |
} |
| 29 |
} |