Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
Hi Martell, On 17.02.2017 17:20, Martell Malone wrote: > Hey guys, > >> Thanks, but I'd be more interested in documentation how to get cross >> compilation setup with clang + mingw-w64. I did one in the past, but it >> required patching clang and llvm and working around misc problems I >> don't quite remember in details. >> I haven't tried but I doubt it will be smooth. > All patches for achieving this is currently being upstreamed and reviewed. > http://lists.llvm.org/pipermail/llvm-dev/2017-February/110097.html > There will be instructions on how to do this and the unofficial llvm > mingw-w64 build bot will be switched over to this soon. > Just bare with me for a week or so to get everything reviewed and in tree. That's a great news. Thanks for the work. Thanks, Jacek -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
Hey guys, > Thanks, but I'd be more interested in documentation how to get cross > compilation setup with clang + mingw-w64. I did one in the past, but it > required patching clang and llvm and working around misc problems I > don't quite remember in details. > I haven't tried but I doubt it will be smooth. All patches for achieving this is currently being upstreamed and reviewed. http://lists.llvm.org/pipermail/llvm-dev/2017-February/110097.html There will be instructions on how to do this and the unofficial llvm mingw-w64 build bot will be switched over to this soon. Just bare with me for a week or so to get everything reviewed and in tree. Best, Martell On Fri, Feb 17, 2017 at 12:22 PM, Mateusz Mikuławrote: > Hello Jacek, > > > Thanks for testing. Sadly, I found that the patch wasn't correct. Could > you please try the attached one? > > New patch is also fine. > > > Thanks, but I'd be more interested in documentation how to get cross > compilation setup with clang + mingw-w64. I did one in the past, but it > required patching clang and llvm and working around misc problems I > don't quite remember in details. > > I haven't tried but I doubt it will be smooth. > > 2017-02-17 12:55 GMT+01:00 Jacek Caban : > > > Hi Mateusz, > > > > On 17.02.2017 00:06, Mateusz Mikuła wrote: > > > Hello Jacek, > > > > > > With this patch clang builds example code from first message with and > > > without `-fms-extensions`. > > > > Thanks for testing. Sadly, I found that the patch wasn't correct. Could > > you please try the attached one? > > > > > I can provide prebuild clang-svn pacakge for msys2. > > > > Thanks, but I'd be more interested in documentation how to get cross > > compilation setup with clang + mingw-w64. I did one in the past, but it > > required patching clang and llvm and working around misc problems I > > don't quite remember in details. > > > > Jacek > > > > > > -- > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > > ___ > > Mingw-w64-public mailing list > > Mingw-w64-public@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > > > > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
Hello Jacek, > Thanks for testing. Sadly, I found that the patch wasn't correct. Could you please try the attached one? New patch is also fine. > Thanks, but I'd be more interested in documentation how to get cross compilation setup with clang + mingw-w64. I did one in the past, but it required patching clang and llvm and working around misc problems I don't quite remember in details. I haven't tried but I doubt it will be smooth. 2017-02-17 12:55 GMT+01:00 Jacek Caban: > Hi Mateusz, > > On 17.02.2017 00:06, Mateusz Mikuła wrote: > > Hello Jacek, > > > > With this patch clang builds example code from first message with and > > without `-fms-extensions`. > > Thanks for testing. Sadly, I found that the patch wasn't correct. Could > you please try the attached one? > > > I can provide prebuild clang-svn pacakge for msys2. > > Thanks, but I'd be more interested in documentation how to get cross > compilation setup with clang + mingw-w64. I did one in the past, but it > required patching clang and llvm and working around misc problems I > don't quite remember in details. > > Jacek > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
Hi Mateusz, On 17.02.2017 00:06, Mateusz Mikuła wrote: > Hello Jacek, > > With this patch clang builds example code from first message with and > without `-fms-extensions`. Thanks for testing. Sadly, I found that the patch wasn't correct. Could you please try the attached one? > I can provide prebuild clang-svn pacakge for msys2. Thanks, but I'd be more interested in documentation how to get cross compilation setup with clang + mingw-w64. I did one in the past, but it required patching clang and llvm and working around misc problems I don't quite remember in details. Jacek commit 68c803328439f119198b8dc64814b03e3c3aadef Author: Jacek CabanDate: Fri Feb 17 12:46:44 2017 +0100 intrin-impl.h: Guard all intrins definitions by __has_builtin. diff --git a/mingw-w64-headers/include/psdk_inc/intrin-impl.h b/mingw-w64-headers/include/psdk_inc/intrin-impl.h index fc781ff..c6b98f6 100644 --- a/mingw-w64-headers/include/psdk_inc/intrin-impl.h +++ b/mingw-w64-headers/include/psdk_inc/intrin-impl.h @@ -550,21 +550,25 @@ extern "C" { #if __INTRINSIC_PROLOG(_lrotl) unsigned long _lrotl(unsigned long __X, int __C); +#if !__has_builtin(_lrotl) __INTRINSICS_USEINLINE unsigned long _lrotl(unsigned long __X, int __C) { return (__X << __C) | (__X >> ((sizeof(long) * 8) - __C)); } +#endif #define __INTRINSIC_DEFINED__lrotl #endif /* __INTRINSIC_PROLOG */ #if __INTRINSIC_PROLOG(_lrotr) unsigned long _lrotr(unsigned long __X, int __C); +#if !__has_builtin(_lrotr) __INTRINSICS_USEINLINE unsigned long _lrotr(unsigned long __X, int __C) { return (__X >> __C) | (__X << ((sizeof(long) * 8) - __C)); } +#endif #define __INTRINSIC_DEFINED__lrotr #endif /* __INTRINSIC_PROLOG */ @@ -572,291 +576,370 @@ unsigned long _lrotr(unsigned long __X, int __C) #if __INTRINSIC_PROLOG(__faststorefence) void __faststorefence(void); +#if !__has_builtin(__faststorefence) __INTRINSICS_USEINLINE void __faststorefence(void) { /* Turns out this is actually faster than MS's "trick" on newer cpus. Note that this builtin performs an implicit ReadWriteBarrier. */ __builtin_ia32_sfence(); } +#endif #define __INTRINSIC_DEFINED___faststorefence #endif /* __INTRINSIC_PROLOG */ #if __INTRINSIC_PROLOG(__stosq) __MINGW_EXTENSION void __stosq(unsigned __int64 *, unsigned __int64, size_t); +#if !__has_builtin(__stosq) __INTRINSICS_USEINLINE __buildstos(__stosq, unsigned __int64, "q|q") +#endif #define __INTRINSIC_DEFINED___stosq #endif /* __INTRINSIC_PROLOG */ #if __INTRINSIC_PROLOG(_interlockedbittestandset64) __MINGW_EXTENSION unsigned char _interlockedbittestandset64(__int64 *a, __int64 b); +#if !__has_builtin(_interlockedbittestandset64) __INTRINSICS_USEINLINE __buildbittesti(_interlockedbittestandset64, __int64, "lock bts{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J", __int64) +#endif #define __INTRINSIC_DEFINED__interlockedbittestandset64 #endif /* __INTRINSIC_PROLOG */ #if __INTRINSIC_PROLOG(_interlockedbittestandreset64) __MINGW_EXTENSION unsigned char _interlockedbittestandreset64(__int64 *a, __int64 b); +#if !__has_builtin(_interlockedbittestandreset64) __INTRINSICS_USEINLINE __buildbittesti(_interlockedbittestandreset64, __int64, "lock btr{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J", __int64) +#endif #define __INTRINSIC_DEFINED__interlockedbittestandreset64 #endif /* __INTRINSIC_PROLOG */ #if __INTRINSIC_PROLOG(_interlockedbittestandcomplement64) __MINGW_EXTENSION unsigned char _interlockedbittestandcomplement64(__int64 *a, __int64 b); +#if !__has_builtin(_interlockedbittestandcomplement64) __INTRINSICS_USEINLINE __buildbittesti(_interlockedbittestandcomplement64, __int64, "lock btc{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J", __int64) +#endif #define __INTRINSIC_DEFINED__interlockedbittestandcomplement64 #endif /* __INTRINSIC_PROLOG */ #if __INTRINSIC_PROLOG(InterlockedBitTestAndSet64) __MINGW_EXTENSION unsigned char InterlockedBitTestAndSet64(volatile __int64 *a, __int64 b); +#if !__has_builtin(InterlockedBitTestAndSet64) __INTRINSICS_USEINLINE __buildbittesti(InterlockedBitTestAndSet64, volatile __int64, "lock bts{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J", __int64) +#endif #define __INTRINSIC_DEFINED_InterlockedBitTestAndSet64 #endif /* __INTRINSIC_PROLOG */ #if __INTRINSIC_PROLOG(InterlockedBitTestAndReset64) __MINGW_EXTENSION unsigned char InterlockedBitTestAndReset64(volatile __int64 *a, __int64 b); +#if !__has_builtin(InterlockedBitTestAndReset64) __INTRINSICS_USEINLINE __buildbittesti(InterlockedBitTestAndReset64, volatile __int64, "lock btr{q %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "J", __int64) +#endif #define __INTRINSIC_DEFINED_InterlockedBitTestAndReset64 #endif /* __INTRINSIC_PROLOG */ #if __INTRINSIC_PROLOG(InterlockedBitTestAndComplement64) __MINGW_EXTENSION unsigned char InterlockedBitTestAndComplement64(volatile __int64
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
Hello Jacek, With this patch clang builds example code from first message with and without `-fms-extensions`. I can provide prebuild clang-svn pacakge for msys2. Thanks, Mateusz 2017-02-16 15:06 GMT+01:00 Jacek Caban: > Hi Mateusz, > > Could you please try the attached patch? It should existing failures on > clang. It also changes our generic guard to take __has_builtin into > account, so this should prevent problems in the future, if clang > introduces more builtins, but I don't have clang setup to test it. > > Thanks, > Jacek > > On 09.02.2017 01:35, Mateusz Mikuła wrote: > > You are right David and now I remember the thing about ms-extensions. > > Declspec was part of those extensions and enabling it by default caused > > errors with specific code so declspec was changed to general attribute > > instead. > > Since I have clang git build (trying to upstream some patches used by > > MSYS2), I tried it also: > > https://paste.ubuntu.com/23957478/ > > > > While for 3.9.x Clang `-fms-extensions` didn't hurt, master branch > require > > some corrections but it is another issue. > > > > > > 2017-02-09 0:15 GMT+01:00 David Grayson : > > > >> I can confirm that MSYS2's x86_64 clang++ compiler does not support > >> __popcnt but does support __builtin_popcount. I looked into it a > >> little bit, and found out that the clang commit that adds the __popcnt > >> builtins is very recent (September 2016). I seems like it has not > >> made it into a release yet. > >> > >> Here is the commit: > >> > >> https://github.com/llvm-mirror/clang/commit/ > 5eb95c4c284486351e3ed0fdad011a > >> cf41540c8b > >> > >> The source code archive that Alexey used to build the MSYS2 clang++ > >> does not have the changes from that commit in it: > >> > >> http://repo.msys2.org/mingw/sources/mingw-w64-clang-3.9.1-3.src.tar.gz > >> > >> I don't intend to submit any more patches for this issue. Jacek has > >> already committed my patch to mingw-w64 (thanks!). Once the new > >> version of clang comes out and people start using it there should not > >> be any problems. If any clang users are itching to use __popcnt > >> before the new version of clang comes out, they can easily remove the > >> #if I put in intrin-impl.h. They could also use __has_builtin in > >> intrin-impl.h to detect whether clang has the builtin or not. > >> > >> Mateusz, the "CodeGen" folder in clang is not just used for MSVC libs, > >> it has tons of general-purpose code for generating LLVM code from > >> C/C++ code. > >> > >> --David Grayson > >> > >> On Wed, Feb 8, 2017 at 1:24 PM, Mateusz wrote: > >>> Opps, gmail put output into quote. Improved version: > >>> $ clang++ popcnt.cc -std=c++14 -fms-extensions > >>> popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' > >>> unsigned short usr = __popcnt16(us[i]); > >>> ^ > >>> popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' > >>> unsigned int uir = __popcnt(ui[i]); > >>>^ > >>> popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did > >> you > >>> mean '_popcnt64'? > >>> unsigned __int64 ulr = __popcnt64(ul[i]); > >>>^~ > >>>_popcnt64 > >>> D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: > >> note: > >>> '_popcnt64' declared here > >>> _popcnt64(long long __A) > >>> ^ > >>> 3 errors generated. > >>> > >>> > >>> > >>> 2017-02-08 22:22 GMT+01:00 Mateusz : > >>> > I think ms-extensions was made default option for mingw and msvc clang > >> and > codegen is used only for creating msvc libs. Here is Clang output > >> anyway: > $ clang++ popcnt.cc -std=c++14 -fms-extensions > popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' > unsigned short usr = __popcnt16(us[i]); > ^ > popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' > unsigned int uir = __popcnt(ui[i]); > ^ > popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did > >> you > mean '_popcnt64'? > unsigned __int64 ulr = __popcnt64(ul[i]); > ^~ > _popcnt64 > D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: > note: '_popcnt64' declared here > _popcnt64(long long __A) > ^ > 3 errors generated. > > 2017-02-08 20:10 GMT+01:00 David Grayson : > > > Mateusz, thanks for looking in to this. > > > > Here are the relevant lines from the clang source code that indicate > > that it supports those builtins: > > > > https://github.com/llvm-mirror/clang/blob/3e45634a7f951c2306 > > e4b368f9fb8c8d80c48273/include/clang/Basic/Builtins.def#L760-L762 > >
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
Hi Mateusz, Could you please try the attached patch? It should existing failures on clang. It also changes our generic guard to take __has_builtin into account, so this should prevent problems in the future, if clang introduces more builtins, but I don't have clang setup to test it. Thanks, Jacek On 09.02.2017 01:35, Mateusz Mikuła wrote: > You are right David and now I remember the thing about ms-extensions. > Declspec was part of those extensions and enabling it by default caused > errors with specific code so declspec was changed to general attribute > instead. > Since I have clang git build (trying to upstream some patches used by > MSYS2), I tried it also: > https://paste.ubuntu.com/23957478/ > > While for 3.9.x Clang `-fms-extensions` didn't hurt, master branch require > some corrections but it is another issue. > > > 2017-02-09 0:15 GMT+01:00 David Grayson: > >> I can confirm that MSYS2's x86_64 clang++ compiler does not support >> __popcnt but does support __builtin_popcount. I looked into it a >> little bit, and found out that the clang commit that adds the __popcnt >> builtins is very recent (September 2016). I seems like it has not >> made it into a release yet. >> >> Here is the commit: >> >> https://github.com/llvm-mirror/clang/commit/5eb95c4c284486351e3ed0fdad011a >> cf41540c8b >> >> The source code archive that Alexey used to build the MSYS2 clang++ >> does not have the changes from that commit in it: >> >> http://repo.msys2.org/mingw/sources/mingw-w64-clang-3.9.1-3.src.tar.gz >> >> I don't intend to submit any more patches for this issue. Jacek has >> already committed my patch to mingw-w64 (thanks!). Once the new >> version of clang comes out and people start using it there should not >> be any problems. If any clang users are itching to use __popcnt >> before the new version of clang comes out, they can easily remove the >> #if I put in intrin-impl.h. They could also use __has_builtin in >> intrin-impl.h to detect whether clang has the builtin or not. >> >> Mateusz, the "CodeGen" folder in clang is not just used for MSVC libs, >> it has tons of general-purpose code for generating LLVM code from >> C/C++ code. >> >> --David Grayson >> >> On Wed, Feb 8, 2017 at 1:24 PM, Mateusz wrote: >>> Opps, gmail put output into quote. Improved version: >>> $ clang++ popcnt.cc -std=c++14 -fms-extensions >>> popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' >>> unsigned short usr = __popcnt16(us[i]); >>> ^ >>> popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' >>> unsigned int uir = __popcnt(ui[i]); >>>^ >>> popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did >> you >>> mean '_popcnt64'? >>> unsigned __int64 ulr = __popcnt64(ul[i]); >>>^~ >>>_popcnt64 >>> D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: >> note: >>> '_popcnt64' declared here >>> _popcnt64(long long __A) >>> ^ >>> 3 errors generated. >>> >>> >>> >>> 2017-02-08 22:22 GMT+01:00 Mateusz : >>> I think ms-extensions was made default option for mingw and msvc clang >> and codegen is used only for creating msvc libs. Here is Clang output >> anyway: $ clang++ popcnt.cc -std=c++14 -fms-extensions popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' unsigned short usr = __popcnt16(us[i]); ^ popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' unsigned int uir = __popcnt(ui[i]); ^ popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did >> you mean '_popcnt64'? unsigned __int64 ulr = __popcnt64(ul[i]); ^~ _popcnt64 D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: note: '_popcnt64' declared here _popcnt64(long long __A) ^ 3 errors generated. 2017-02-08 20:10 GMT+01:00 David Grayson : > Mateusz, thanks for looking in to this. > > Here are the relevant lines from the clang source code that indicate > that it supports those builtins: > > https://github.com/llvm-mirror/clang/blob/3e45634a7f951c2306 > e4b368f9fb8c8d80c48273/include/clang/Basic/Builtins.def#L760-L762 > https://github.com/llvm-mirror/clang/blob/4cedfcc1ecf8387082 > 183508604b7f47c634f708/lib/CodeGen/CGBuiltin.cpp#L804-L821 > > Can you try your clang test again with the "-fms-extensions" argument? > > (I tried to test clang myself earlier but I had various issues. I > could probably try again tonight if you don't want to.) > > --David > > On Wed, Feb 8, 2017 at 10:54 AM, Mateusz wrote: >> MSYS2 native Clang test-popcnt.cpp:
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
On 2/9/2017 3:28 AM, Jacek Caban wrote: > __has_builtin looks like a nice way to fix it. Too bad gcc doesn't see the value in __has_builtin: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970 dw -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
I can confirm that MSYS2's x86_64 clang++ compiler does not support __popcnt but does support __builtin_popcount. I looked into it a little bit, and found out that the clang commit that adds the __popcnt builtins is very recent (September 2016). I seems like it has not made it into a release yet. Here is the commit: https://github.com/llvm-mirror/clang/commit/5eb95c4c284486351e3ed0fdad011acf41540c8b The source code archive that Alexey used to build the MSYS2 clang++ does not have the changes from that commit in it: http://repo.msys2.org/mingw/sources/mingw-w64-clang-3.9.1-3.src.tar.gz I don't intend to submit any more patches for this issue. Jacek has already committed my patch to mingw-w64 (thanks!). Once the new version of clang comes out and people start using it there should not be any problems. If any clang users are itching to use __popcnt before the new version of clang comes out, they can easily remove the #if I put in intrin-impl.h. They could also use __has_builtin in intrin-impl.h to detect whether clang has the builtin or not. Mateusz, the "CodeGen" folder in clang is not just used for MSVC libs, it has tons of general-purpose code for generating LLVM code from C/C++ code. --David Grayson On Wed, Feb 8, 2017 at 1:24 PM, Mateuszwrote: > Opps, gmail put output into quote. Improved version: > $ clang++ popcnt.cc -std=c++14 -fms-extensions > popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' > unsigned short usr = __popcnt16(us[i]); > ^ > popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' > unsigned int uir = __popcnt(ui[i]); >^ > popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did you > mean '_popcnt64'? > unsigned __int64 ulr = __popcnt64(ul[i]); >^~ >_popcnt64 > D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: note: > '_popcnt64' declared here > _popcnt64(long long __A) > ^ > 3 errors generated. > > > > 2017-02-08 22:22 GMT+01:00 Mateusz : > >> I think ms-extensions was made default option for mingw and msvc clang and >> codegen is used only for creating msvc libs. Here is Clang output anyway: >> >> $ clang++ popcnt.cc -std=c++14 -fms-extensions >> popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' >> unsigned short usr = __popcnt16(us[i]); >> ^ >> popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' >> unsigned int uir = __popcnt(ui[i]); >>^ >> popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did you >> mean '_popcnt64'? >> unsigned __int64 ulr = __popcnt64(ul[i]); >>^~ >>_popcnt64 >> D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: >> note: '_popcnt64' declared here >> _popcnt64(long long __A) >> ^ >> 3 errors generated. >> >> 2017-02-08 20:10 GMT+01:00 David Grayson : >> >>> Mateusz, thanks for looking in to this. >>> >>> Here are the relevant lines from the clang source code that indicate >>> that it supports those builtins: >>> >>> https://github.com/llvm-mirror/clang/blob/3e45634a7f951c2306 >>> e4b368f9fb8c8d80c48273/include/clang/Basic/Builtins.def#L760-L762 >>> https://github.com/llvm-mirror/clang/blob/4cedfcc1ecf8387082 >>> 183508604b7f47c634f708/lib/CodeGen/CGBuiltin.cpp#L804-L821 >>> >>> Can you try your clang test again with the "-fms-extensions" argument? >>> >>> (I tried to test clang myself earlier but I had various issues. I >>> could probably try again tonight if you don't want to.) >>> >>> --David >>> >>> On Wed, Feb 8, 2017 at 10:54 AM, Mateusz wrote: >>> > MSYS2 native Clang test-popcnt.cpp: >>> > >>> > $ clang++ popcnt.cc -std=c++14 >>> > popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' >>> > unsigned short usr = __popcnt16(us[i]); >>> > ^ >>> > popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' >>> > unsigned int uir = __popcnt(ui[i]); >>> >^ >>> > popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did >>> you >>> > mean '_popcnt64'? >>> > unsigned __int64 ulr = __popcnt64(ul[i]); >>> >^~ >>> >_popcnt64 >>> > D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: >>> note: >>> > '_popcnt64' declared here >>> > _popcnt64(long long __A) >>> > ^ >>> > 3 errors generated. >>> > >>> > Probably its safe to enable it for Clang, I'll try tomorrow late. >>> > >>> > 2017-02-08 18:37 GMT+01:00 David Grayson : >>> > >>> >> Hello. This patch adds support for the Microsoft __popcnt16, __popcnt, >>> >> and __popcnt64 intrinsics, which are documented here: >>> >> >>> >>
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
Opps, gmail put output into quote. Improved version: $ clang++ popcnt.cc -std=c++14 -fms-extensions popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' unsigned short usr = __popcnt16(us[i]); ^ popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' unsigned int uir = __popcnt(ui[i]); ^ popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did you mean '_popcnt64'? unsigned __int64 ulr = __popcnt64(ul[i]); ^~ _popcnt64 D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: note: '_popcnt64' declared here _popcnt64(long long __A) ^ 3 errors generated. 2017-02-08 22:22 GMT+01:00 Mateusz: > I think ms-extensions was made default option for mingw and msvc clang and > codegen is used only for creating msvc libs. Here is Clang output anyway: > > $ clang++ popcnt.cc -std=c++14 -fms-extensions > popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' > unsigned short usr = __popcnt16(us[i]); > ^ > popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' > unsigned int uir = __popcnt(ui[i]); >^ > popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did you > mean '_popcnt64'? > unsigned __int64 ulr = __popcnt64(ul[i]); >^~ >_popcnt64 > D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: > note: '_popcnt64' declared here > _popcnt64(long long __A) > ^ > 3 errors generated. > > 2017-02-08 20:10 GMT+01:00 David Grayson : > >> Mateusz, thanks for looking in to this. >> >> Here are the relevant lines from the clang source code that indicate >> that it supports those builtins: >> >> https://github.com/llvm-mirror/clang/blob/3e45634a7f951c2306 >> e4b368f9fb8c8d80c48273/include/clang/Basic/Builtins.def#L760-L762 >> https://github.com/llvm-mirror/clang/blob/4cedfcc1ecf8387082 >> 183508604b7f47c634f708/lib/CodeGen/CGBuiltin.cpp#L804-L821 >> >> Can you try your clang test again with the "-fms-extensions" argument? >> >> (I tried to test clang myself earlier but I had various issues. I >> could probably try again tonight if you don't want to.) >> >> --David >> >> On Wed, Feb 8, 2017 at 10:54 AM, Mateusz wrote: >> > MSYS2 native Clang test-popcnt.cpp: >> > >> > $ clang++ popcnt.cc -std=c++14 >> > popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' >> > unsigned short usr = __popcnt16(us[i]); >> > ^ >> > popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' >> > unsigned int uir = __popcnt(ui[i]); >> >^ >> > popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did >> you >> > mean '_popcnt64'? >> > unsigned __int64 ulr = __popcnt64(ul[i]); >> >^~ >> >_popcnt64 >> > D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: >> note: >> > '_popcnt64' declared here >> > _popcnt64(long long __A) >> > ^ >> > 3 errors generated. >> > >> > Probably its safe to enable it for Clang, I'll try tomorrow late. >> > >> > 2017-02-08 18:37 GMT+01:00 David Grayson : >> > >> >> Hello. This patch adds support for the Microsoft __popcnt16, __popcnt, >> >> and __popcnt64 intrinsics, which are documented here: >> >> >> >> https://msdn.microsoft.com/en-us/library/bb385231.aspx >> >> >> >> I was trying to compile ANGLE recently and one of the first errors I >> >> encountered was due to both GCC/mingw-w64 not supporting __popcnt. >> >> >> >> I attached the simple C++ program I used to test this patch. >> >> >> >> I am not totally sure, but it looks like Clang already supports the >> >> __popcnt intrinsics because I saw code for it in the clang >> repository. So >> >> that is why this patch has "#if !defined(__clang__)" around it. >> >> >> >> I read the documentation for intrin.h and intrin-impl.h and I believe >> this >> >> patch follows all the rules. It would be great if it could be merged >> in. >> >> Thanks! >> >> >> >> --David Grayson >> >> >> >> >> >> -- >> >> Check out the vibrant tech community on one of the world's most >> >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot >> >> ___ >> >> Mingw-w64-public mailing list >> >> Mingw-w64-public@lists.sourceforge.net >> >> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public >> >> >> >> >> > >> -- >> > Check out the vibrant tech community on one of the world's most >> > engaging tech sites, SlashDot.org! http://sdm.link/slashdot >> > ___
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
I think ms-extensions was made default option for mingw and msvc clang and codegen is used only for creating msvc libs. Here is Clang output anyway: $ clang++ popcnt.cc -std=c++14 -fms-extensions popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' unsigned short usr = __popcnt16(us[i]); ^ popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' unsigned int uir = __popcnt(ui[i]); ^ popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did you mean '_popcnt64'? unsigned __int64 ulr = __popcnt64(ul[i]); ^~ _popcnt64 D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: note: '_popcnt64' declared here _popcnt64(long long __A) ^ 3 errors generated. 2017-02-08 20:10 GMT+01:00 David Grayson: > Mateusz, thanks for looking in to this. > > Here are the relevant lines from the clang source code that indicate > that it supports those builtins: > > https://github.com/llvm-mirror/clang/blob/3e45634a7f951c2306e4b368f9fb8c > 8d80c48273/include/clang/Basic/Builtins.def#L760-L762 > https://github.com/llvm-mirror/clang/blob/4cedfcc1ecf8387082183508604b7f > 47c634f708/lib/CodeGen/CGBuiltin.cpp#L804-L821 > > Can you try your clang test again with the "-fms-extensions" argument? > > (I tried to test clang myself earlier but I had various issues. I > could probably try again tonight if you don't want to.) > > --David > > On Wed, Feb 8, 2017 at 10:54 AM, Mateusz wrote: > > MSYS2 native Clang test-popcnt.cpp: > > > > $ clang++ popcnt.cc -std=c++14 > > popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' > > unsigned short usr = __popcnt16(us[i]); > > ^ > > popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' > > unsigned int uir = __popcnt(ui[i]); > >^ > > popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did > you > > mean '_popcnt64'? > > unsigned __int64 ulr = __popcnt64(ul[i]); > >^~ > >_popcnt64 > > D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: > note: > > '_popcnt64' declared here > > _popcnt64(long long __A) > > ^ > > 3 errors generated. > > > > Probably its safe to enable it for Clang, I'll try tomorrow late. > > > > 2017-02-08 18:37 GMT+01:00 David Grayson : > > > >> Hello. This patch adds support for the Microsoft __popcnt16, __popcnt, > >> and __popcnt64 intrinsics, which are documented here: > >> > >> https://msdn.microsoft.com/en-us/library/bb385231.aspx > >> > >> I was trying to compile ANGLE recently and one of the first errors I > >> encountered was due to both GCC/mingw-w64 not supporting __popcnt. > >> > >> I attached the simple C++ program I used to test this patch. > >> > >> I am not totally sure, but it looks like Clang already supports the > >> __popcnt intrinsics because I saw code for it in the clang repository. > So > >> that is why this patch has "#if !defined(__clang__)" around it. > >> > >> I read the documentation for intrin.h and intrin-impl.h and I believe > this > >> patch follows all the rules. It would be great if it could be merged > in. > >> Thanks! > >> > >> --David Grayson > >> > >> > >> -- > >> Check out the vibrant tech community on one of the world's most > >> engaging tech sites, SlashDot.org! http://sdm.link/slashdot > >> ___ > >> Mingw-w64-public mailing list > >> Mingw-w64-public@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > >> > >> > > > -- > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > > ___ > > Mingw-w64-public mailing list > > Mingw-w64-public@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net
Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.
MSYS2 native Clang test-popcnt.cpp: $ clang++ popcnt.cc -std=c++14 popcnt.cc:9:26: error: use of undeclared identifier '__popcnt16' unsigned short usr = __popcnt16(us[i]); ^ popcnt.cc:17:24: error: use of undeclared identifier '__popcnt' unsigned int uir = __popcnt(ui[i]); ^ popcnt.cc:26:28: error: use of undeclared identifier '__popcnt64'; did you mean '_popcnt64'? unsigned __int64 ulr = __popcnt64(ul[i]); ^~ _popcnt64 D:\msys64\mingw64\bin\..\lib\clang\3.9.1\include\popcntintrin.h:90:1: note: '_popcnt64' declared here _popcnt64(long long __A) ^ 3 errors generated. Probably its safe to enable it for Clang, I'll try tomorrow late. 2017-02-08 18:37 GMT+01:00 David Grayson: > Hello. This patch adds support for the Microsoft __popcnt16, __popcnt, > and __popcnt64 intrinsics, which are documented here: > > https://msdn.microsoft.com/en-us/library/bb385231.aspx > > I was trying to compile ANGLE recently and one of the first errors I > encountered was due to both GCC/mingw-w64 not supporting __popcnt. > > I attached the simple C++ program I used to test this patch. > > I am not totally sure, but it looks like Clang already supports the > __popcnt intrinsics because I saw code for it in the clang repository. So > that is why this patch has "#if !defined(__clang__)" around it. > > I read the documentation for intrin.h and intrin-impl.h and I believe this > patch follows all the rules. It would be great if it could be merged in. > Thanks! > > --David Grayson > > > -- > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > ___ > Mingw-w64-public mailing list > Mingw-w64-public@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public