r221066 - Add _lzcnt_u32 and _lzcnt_u64 to lzcntintrin.h to match Intel documentation names for these intrinsics.

Alex Rosenberg alexr at leftfield.org
Sun Nov 2 10:16:56 PST 2014


Intrin.h is the MSVC-compatibility header. lzcntintrin.h is the GCC/ICC,etc. style header as well as MSVC's vendor-specific header in some cases.

Alex

> On Nov 1, 2014, at 7:20 PM, Robinson, Paul <Paul_Robinson at playstation.sony.com> wrote:
> 
> I thought these were already defined in Intrin.h?  Except only for Windows I guess.
> Still can't reach my work systems so checking it myself might have to wait until
> Monday.
> --paulr
> 
>> -----Original Message-----
>> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-
>> bounces at cs.uiuc.edu] On Behalf Of Craig Topper
>> Sent: Saturday, November 01, 2014 3:51 PM
>> To: cfe-commits at cs.uiuc.edu
>> Subject: r221066 - Add _lzcnt_u32 and _lzcnt_u64 to lzcntintrin.h to match
>> Intel documentation names for these intrinsics.
>> 
>> Author: ctopper
>> Date: Sat Nov  1 17:50:57 2014
>> New Revision: 221066
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=221066&view=rev
>> Log:
>> Add _lzcnt_u32 and _lzcnt_u64 to lzcntintrin.h to match Intel
>> documentation names for these intrinsics.
>> 
>> Modified:
>>    cfe/trunk/lib/Headers/lzcntintrin.h
>>    cfe/trunk/test/CodeGen/lzcnt-builtins.c
>> 
>> Modified: cfe/trunk/lib/Headers/lzcntintrin.h
>> URL: http://llvm.org/viewvc/llvm-
>> project/cfe/trunk/lib/Headers/lzcntintrin.h?rev=221066&r1=221065&r2=221066
>> &view=diff
>> ==========================================================================
>> ====
>> --- cfe/trunk/lib/Headers/lzcntintrin.h (original)
>> +++ cfe/trunk/lib/Headers/lzcntintrin.h Sat Nov  1 17:50:57 2014
>> @@ -44,12 +44,24 @@ __lzcnt32(unsigned int __X)
>>   return __X ? __builtin_clz(__X) : 32;
>> }
>> 
>> +static __inline__ unsigned int __attribute__((__always_inline__,
>> __nodebug__))
>> +_lzcnt_u32(unsigned int __X)
>> +{
>> +  return __X ? __builtin_clz(__X) : 32;
>> +}
>> +
>> #ifdef __x86_64__
>> static __inline__ unsigned long long __attribute__((__always_inline__,
>> __nodebug__))
>> __lzcnt64(unsigned long long __X)
>> {
>>   return __X ? __builtin_clzll(__X) : 64;
>> }
>> +
>> +static __inline__ unsigned long long __attribute__((__always_inline__,
>> __nodebug__))
>> +_lzcnt_u64(unsigned long long __X)
>> +{
>> +  return __X ? __builtin_clzll(__X) : 64;
>> +}
>> #endif
>> 
>> #endif /* __LZCNTINTRIN_H */
>> 
>> Modified: cfe/trunk/test/CodeGen/lzcnt-builtins.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/lzcnt-
>> builtins.c?rev=221066&r1=221065&r2=221066&view=diff
>> ==========================================================================
>> ====
>> --- cfe/trunk/test/CodeGen/lzcnt-builtins.c (original)
>> +++ cfe/trunk/test/CodeGen/lzcnt-builtins.c Sat Nov  1 17:50:57 2014
>> @@ -22,3 +22,15 @@ unsigned long long test__lzcnt64(unsigne
>>   // CHECK: @llvm.ctlz.i64
>>   return __lzcnt64(__X);
>> }
>> +
>> +unsigned int test_lzcnt_u32(unsigned int __X)
>> +{
>> +  // CHECK: @llvm.ctlz.i32
>> +  return _lzcnt_u32(__X);
>> +}
>> +
>> +unsigned long long test__lzcnt_u64(unsigned long long __X)
>> +{
>> +  // CHECK: @llvm.ctlz.i64
>> +  return _lzcnt_u64(__X);
>> +}
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list