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 <davidegray...@gmail.com>:

> 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 <mati...@gmail.com> 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 <davidegray...@gmail.com>:
> >
> >> 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
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to