Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / bmi-blsr-2.c
blobb3fc4e5e9620d72c6280fb8ae3c9ebaeca4c76ed
1 /* { dg-do run { target { bmi } } } */
2 /* { dg-options "-O2 -mbmi -fno-inline" } */
4 #include <x86intrin.h>
6 #include "bmi-check.h"
8 int calc_blsr_u32 (int src1, int src2)
10 return (src1-1) & (src2);
13 static void
14 bmi_test ()
16 unsigned i;
17 int src = 0xfacec0ff;
18 int res, res_ref;
20 for (i=0; i<5; ++i) {
21 src = i + src << i;
23 res_ref = calc_blsr_u32 (src, src);
24 res = __blsr_u32 (src);
26 if (res != res_ref)
27 abort();