Oops you are correct. I think only grepped the _tzcnt_u32 and _tzcnt_u64 which don't have definitions.
On Sun, Nov 2, 2014 at 4:31 PM, Robinson, Paul < [email protected]> wrote: > Intrin.h does contain definitions (farther down the file), among others > it has _lzcnt_u32 (~line 550), and under __x86_64__ it has _lzcnt_u64 > (~line 615). > > These definitions have correct zero guards. > > > > Cribbing from clang/test/Headers/ms-intrin.cpp, I can get > multiple-definition errors running on Linux with the following. > > > > $ cat try-intrin.c > > typedef __SIZE_TYPE__ size_t; > > #include <Intrin.h> > > $ clang -c try-intrin.c -target x86_64-pc-win32 -march=bdver1 > -ffreestanding > > > > If there aren't any Windows bots catching this, then it looks like > clang/test/Headers/ms-intrin.cpp needs to be beefed up. > > --paulr > > > > *From:* Craig Topper [mailto:[email protected]] > *Sent:* Sunday, November 02, 2014 11:59 AM > *To:* Alex Rosenberg > *Cc:* Robinson, Paul; [email protected] > *Subject:* Re: r221066 - Add _lzcnt_u32 and _lzcnt_u64 to lzcntintrin.h > to match Intel documentation names for these intrinsics. > > > > Where do the definitions for the things in Intrin.h live? It's just > declarations. > > > > On Sun, Nov 2, 2014 at 10:16 AM, Alex Rosenberg <[email protected]> > wrote: > > 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 < > [email protected]> 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: [email protected] [mailto:cfe-commits- > >> [email protected]] On Behalf Of Craig Topper > >> Sent: Saturday, November 01, 2014 3:51 PM > >> To: [email protected] > >> 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 > >> [email protected] > >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > > > > _______________________________________________ > > cfe-commits mailing list > > [email protected] > > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > > > > > > -- > ~Craig > -- ~Craig
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
