1 /* { dg-do run } */ 2 /* { dg-options "-O2 -mlzcnt" } */ 3 /* { dg-require-effective-target lzcnt } */ 4 5 #include "lzcnt-check.h" 6 7 static int foo(unsigned int v)8foo (unsigned int v) 9 { 10 return v ? __builtin_clz (v) : 32; 11 } 12 13 /* returns -1 if x == 0 */ 14 int 15 __attribute__ ((noinline, noclone)) bar(unsigned int x)16bar (unsigned int x) 17 { 18 return 31 - foo (x); 19 } 20 21 static void lzcnt_test()22lzcnt_test () 23 { 24 int r = bar (0); 25 26 if (r != -1) 27 abort (); 28 } 29