On Mon, Aug 1, 2011 at 6:13 AM, Kirill Yukhin <kirill.yuk...@gmail.com> wrote: > Done. > Updated patch is attached. > > Thanks, K > > On Mon, Aug 1, 2011 at 4:49 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >> On Mon, Aug 1, 2011 at 5:36 AM, Kirill Yukhin <kirill.yuk...@gmail.com> >> wrote: >>> Hi HJ, >>> Thanks for input. I've missed it. >>> Done. Updated patch is attached. >> >> Compiler may still optimize it away. You need to replace 0 with >> a function parameter. Please see: >> >> http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html >> >> >> H.J. >> --- >>> Thanks, K >>> >>> On Mon, Aug 1, 2011 at 4:26 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >>>> On Mon, Aug 1, 2011 at 5:20 AM, Kirill Yukhin <kirill.yuk...@gmail.com> >>>> wrote: >>>>> I've merged my changes with trunk (there was a conflict) and fixed typo. >>>>> Updated patch is attached. Waiting for commit... >>>>> >>>>> Thanks, K >>>>> >>>>> On Mon, Aug 1, 2011 at 1:03 PM, Kirill Yukhin <kirill.yuk...@gmail.com> >>>>> wrote: >>>>>> Thanks! >>>>>> Guys with waa rights, could anybody commit my fix? >>>>>> >>>>>> Thanks, K >>>>>> >>>>>>> >>>>>>> OK for mainline. >>>>>>> >>>>>>> Uros. >>>>>>> >>>>>> >>>> >>>> >>>> +# Return 1 if lzcnt instruction can be compiled. >>>> +proc check_effective_target_lzcnt { } { >>>> + return [check_no_compiler_messages lzcnt object { >>>> + void _lzcnt (void) >>>> + { >>>> + __builtin_clzs (0); >>>> + } >>>> + } "-O2 -mlzcnt" ] >>>> +} >>>> >>>> GCC may optimize this away. Please fix it similar to: >>>> >>>> http://gcc.gnu.org/ml/gcc-patches/2011-07/msg02463.html >>>> >>> >> >
We should use long long on 64bit intrinsic. I checked in this as an obvious fix. -- H.J. --- Index: ChangeLog =================================================================== --- ChangeLog (revision 177080) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-08-01 H.J. Lu <hongjiu...@intel.com> + + * config/i386/lzcntintrin.h (__lzcnt64): Replace long with + long long. + 2011-08-01 Sebastian Pop <sebastian....@amd.com> Joseph Myers <jos...@codesourcery.com> Index: config/i386/lzcntintrin.h =================================================================== --- config/i386/lzcntintrin.h (revision 177080) +++ config/i386/lzcntintrin.h (working copy) @@ -45,10 +45,10 @@ __lzcnt32 (unsigned int __X) } #ifdef __x86_64__ -extern __inline unsigned long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -__lzcnt64 (unsigned long __X) +extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inli ne__, __artificial__)) +__lzcnt64 (unsigned long long __X) { - return __builtin_clzl (__X); + return __builtin_clzll (__X); } #endif