1 /* { dg-do run { target bmi } } */ 2 /* { dg-options "-O2 -mbmi -fno-inline" } */ 3 4 #include <x86intrin.h> 5 6 #include "bmi-check.h" 7 8 /* Trick compiler in order not to generate target insn here. */ calc_blsmsk_u32(int src1,int src2)9int calc_blsmsk_u32 (int src1, int src2) 10 { 11 return (src1-1) ^ (src2); 12 } 13 14 static void bmi_test()15bmi_test () 16 { 17 unsigned i; 18 int src = 0xfacec0ff; 19 int res, res_ref; 20 21 for (i=0; i<5; ++i) { 22 src = i + src << i; 23 24 res_ref = calc_blsmsk_u32 (src, src); 25 res = __blsmsk_u32 (src); 26 27 if (res != res_ref) 28 abort(); 29 } 30 } 31