Re: [Mingw-w64-public] [PATCH] intrin-impl.h: Added __popcnt16, __popcnt, and __popcnt64.

2017-02-09 Thread Jacek Caban
Yeah, I think that we should fix clang with -fms-extensions.
__has_builtin looks like a nice way to fix it.

Jacek

On 09.02.2017 01:52, David Grayson wrote:
> Ah, from your paste, it looks like mingw-w64 and clang are fighting to
> declare a lot of builtins when -fms-extensions is turned on.
>
> I would personally prefer to use compiler implementations of these
> things instead of header file implementations, so I think that
> mingw-w64 should try to support clang with -fms-extensions turned on.
> I'm not sure it try to support clang when -fms-extensions is turned
> off.  But it would be easy to do so since clang has the __has_builtin
> macro which can check which builtins are enabled.
>
> --David
>
> On Wed, Feb 8, 2017 at 4:35 PM, 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


--
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.

2017-02-09 Thread David Wohlferd
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