pinterf / AviSynthPlus

AviSynth with improvements
http://avs-plus.net
208 stars 24 forks source link

Can not build with clang in r2819 #28

Open fuchanghao opened 5 years ago

fuchanghao commented 5 years ago

Seems the MSVC version check didn't work fine with clang.

The C compiler identification is Clang 3.8.0 The CXX compiler identification is Clang 3.8.0 Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/ClangC2/14.10.25903/bin/HostX86/clang.exe Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/ClangC2/14.10.25903/bin/HostX86/clang.exe -- works Detecting C compiler ABI info Detecting C compiler ABI info - done Detecting C compile features Detecting C compile features - done Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/ClangC2/14.10.25903/bin/HostX86/clang.exe Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/ClangC2/14.10.25903/bin/HostX86/clang.exe -- works Detecting CXX compiler ABI info Detecting CXX compiler ABI info - done Detecting CXX compile features Detecting CXX compile features - done CMake Error at CMakeLists.txt:26 (MESSAGE): Visual C++ 2017 or newer required.

pinterf commented 5 years ago

Which toolset are you using?

Seems like the toolset check is not complete, and this clang version does not report MS compatible versioning, it's not pretending to be an ms cl-compatible compiler. Have you used clang based avisynth compilation previously?

So the log: The C compiler identification is MSVC 19.16.27027.1 The CXX compiler identification is MSVC 19.16.27027.1 Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe Check for working C compiler: C:/Program Files/LLVM/bin/clang.exe -- works Detecting C compiler ABI info Detecting C compiler ABI info - done Check for working CXX compiler: C:/Program Files/LLVM/bin/clang.exe Check for working CXX compiler: C:/Program Files/LLVM/bin/clang.exe -- works Detecting CXX compiler ABI info Detecting CXX compiler ABI info - done Detecting CXX compile features Detecting CXX compile features - done v141_clang_c2 toolset was specified via -T. Reported MSVC_VERSION is: 1916 Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.17.1.windows.2") Configuring done

fuchanghao commented 5 years ago

seem there's an easy way.

change Cmakelists.txt "v141_clang_c2" to "llvm"

Install Clang Power Tools & LLVM Compiler Toolchain

https://marketplace.visualstudio.com/items?itemName=caphyon.ClangPowerTools https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.llvm-toolchain

Cmake log

The C compiler identification is Clang 7.0.1 The CXX compiler identification is Clang 7.0.1 Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe Check for working C compiler: C:/Program Files/LLVM/bin/clang-cl.exe -- works Detecting C compiler ABI info Detecting C compiler ABI info - done Detecting C compile features Detecting C compile features - done Check for working CXX compiler: C:/Program Files/LLVM/bin/clang-cl.exe Check for working CXX compiler: C:/Program Files/LLVM/bin/clang-cl.exe -- works Detecting CXX compiler ABI info Detecting CXX compiler ABI info - done Detecting CXX compile features Detecting CXX compile features - done llvm toolset was specified via -T. Reported MSVC_VERSION is: 1916 Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.21.0.windows.1") Configuring done Generating done

pinterf commented 5 years ago

Yeah, much simpler. But something is still different.

How did you make it built?

When I said that I had successful build with the "hacked" v141_clang_c2, I was wrong. It seems that not the right cl.exe was used, the compilation was still using the original CL.EXE as shown in the build log (Tools|Options|Projects and solutions|MS Build Verbosity: "Detailed":

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\CL.exe .. etc.......

With LLVM toolset chosen, the proper compiler is used as seen from the verbose build log: C:\Program Files\LLVM\bin\clang-cl.exe /c etc....

So with LLVM toolset the project does not compile (undeclared identifier errors on sse 4.1 things like _mm_packus_epi32), because for example convert.cpp requires sse4.1 intrinsic. O.K., I put the include: #include

But after providing that this type of errors appear: always_inline function '_mm_packus_epi32' requires target feature 'sse4.1', but would be inlined into function 'convert_rgb_uint16_to_uint16_sse2' that is compiled without support for 'sse4.1'

Unlike clang-cl (maybe I'm not aware of a magic compiler switch) MSVC allows using SSE4.1 intrinsics (in MSVC there is no specific "-msse41" for that), if I emit that intrinsic it will insert an SSE4.1 instruction even if the project is compiled to SSE2 as general.

qyot27 commented 5 years ago

From what I understand of the way Clang works internally, if it's not mimicking MSVC on Windows, it's mimicking GCC. And that intrinsics issue is something that GCC suffers from too.

The solution, ultimately, is to do for every SIMD set what we do for avx and avx2, so that none of the intrinsics alters the way the whole project is optimized; doing so should also allow for building without any intrinsics/asm at all, which will help any possible effort to build for alternate platforms like ARM (which Windows 10 does exist for, and ReactOS may eventually become available for as well, setting aside any Linux effort that would make ARM and PowerPC relevant somewhat immediately).

fuchanghao commented 5 years ago
* v141_clang_c2

After using your guide,

I still can't build Shibatch the same as using MSVC and it will crash the Visual Studio 2017.

I also tried v142 in visual studio 2019 RC it showed the same error.

2>byte_order_helper.cpp 2>d:\source code\avisynth\avisynthplus\plugins\shibatch\pfc\ptr_list.h(190): error C2065: “delete_all”: 未声明的标识符 2>d:\source code\avisynth\avisynthplus\plugins\shibatch\pfc\ptr_list.h(190): error C3861: “delete_all”: 找不到标识符 2>d:\source code\avisynth\avisynthplus\plugins\shibatch\pfc\ptr_list.h(190): note: “delete_all”: 函数声明必须可用,因为所有参数都不依赖于模板参数 2>d:\source code\avisynth\avisynthplus\plugins\shibatch\pfc\ptr_list.h(191): note: 参见对正在编译的 类 模板 实例化 "ptr_list_autodel_t" 的引用 2>d:\source code\avisynth\avisynthplus\plugins\shibatch\pfc\ptr_list.h(198): error C2065: “free_all”: 未声明的标识符 2>d:\source code\avisynth\avisynthplus\plugins\shibatch\pfc\ptr_list.h(198): error C3861: “free_all”: 找不到标识符 2>d:\source code\avisynth\avisynthplus\plugins\shibatch\pfc\ptr_list.h(198): note: “free_all”: 函数声明必须可用,因为所有参数都不依赖于模板参数 2>d:\source code\avisynth\avisynthplus\plugins\shibatch\pfc\ptr_list.h(199): note: 参见对正在编译的 类 模板 实例化 "ptr_list_autofree_t" 的引用

Clang-cl won't cause that error.

but it also has the error:

3>D:\Source code\AviSynth\AviSynthPlus\plugins\Shibatch\ssrc.cpp(162): error : expected parentheses around type name in sizeof expression

pinterf commented 5 years ago

In newer gcc (and clang?) function level attributes exist. https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes See "target" section. E.g.

int core2_func (void) __attribute__ ((__target__ ("arch=core2")));
int sse3_func (void) __attribute__ ((__target__ ("sse3")));

This is an easy way to go.

Still I think that functions that are compiled with sse2 or sse4.1 chosen purely on a template parameter should be reorganized a bit and should really be separated/moved to an include file. Plus some constexpr will also help which inactivates parts of code on compile time and does not depend on optimizer's choice whether it is included or not (like non-constexpr paths are existing in Debug builds).

Seems I'll have some work on this topic.

pinterf commented 5 years ago

Actually Shibatch source needed a minor fix to compile properly.

fuchanghao commented 5 years ago

Actually Shibatch source needed a minor fix to compile properly.

It works fine now.

pinterf commented 5 years ago

Those attributes will work, I'll probably implement them. I've just tried it on RemoveDirt project. So this is the way to go, probably works for gcc as well (contrary to the name of the option: no-gcc-compat) https://github.com/pinterf/RemoveDirt/blob/master/RemoveDirt/RemoveDirt.cpp#L955

pinterf commented 5 years ago

Please check latest commits. I'm using LLVM 8.0. Lots of code changes, mainly in order to let clang (and hopefully gcc) to apply special code generation attributes for CPU extensions (e.g. SSE4.1) for specific functions, without the need for moving those functions in a different source file.

@qyot27: could not try gcc, feel free to modify the #ifdef clang sections for gcc as well, when applying function attributes. I hope it'll work for you. I'll wait for your results.

qyot27 commented 5 years ago

Any particular reason to use __clang__ instead of the CLANG define provided by avs/config.h?

Anyway, modifying all the places where #ifdef __clang__ showed up to #if defined(CLANG) || defined(GCC), unsetting -march=native in CMakeLists.txt, and attempting to build, it failed. GCC wants the attributes before the function definition. So I moved the ones that actually were setting attributes to up above the functions they were defined for, and this mostly succeeded. There were build errors in only two spots left: blend_common.cpp and resample.cpp:

[i686:$] ninja
[2/4] Building CXX object avs_core/CMa...r/filters/overlay/blend_common.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -c ../../avs_core/filters/overlay/blend_common.cpp
../../avs_core/filters/overlay/blend_common.cpp: In function 'void overlay_blend_sse41_plane_masked(BYTE*, const BYTE*, const BYTE*, int, int, int, int, int) [with pixel_t = unsigned char; int bits_per_pixel = 8]':
../../avs_core/filters/overlay/blend_common.cpp:314:30: error: inlining failed in call to always_inline '__m128i simd_blend_epi8_sse41(const __m128i&, const __m128i&, const __m128i&)': target specific option mismatch
 static __forceinline __m128i simd_blend_epi8_sse41(__m128i const &selector, __m128i const &a, __m128i const &b)
                              ^~~~~~~~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:443:39: note: called from here
         result = simd_blend_epi8_sse41(mask_00, dst, result); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:314:30: error: inlining failed in call to always_inline '__m128i simd_blend_epi8_sse41(const __m128i&, const __m128i&, const __m128i&)': target specific option mismatch
 static __forceinline __m128i simd_blend_epi8_sse41(__m128i const &selector, __m128i const &a, __m128i const &b)
                              ^~~~~~~~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:443:39: note: called from here
         result = simd_blend_epi8_sse41(mask_00, dst, result); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:314:30: error: inlining failed in call to always_inline '__m128i simd_blend_epi8_sse41(const __m128i&, const __m128i&, const __m128i&)': target specific option mismatch
 static __forceinline __m128i simd_blend_epi8_sse41(__m128i const &selector, __m128i const &a, __m128i const &b)
                              ^~~~~~~~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:446:39: note: called from here
         result = simd_blend_epi8_sse41(mask_FF, src, result); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:314:30: error: inlining failed in call to always_inline '__m128i simd_blend_epi8_sse41(const __m128i&, const __m128i&, const __m128i&)': target specific option mismatch
 static __forceinline __m128i simd_blend_epi8_sse41(__m128i const &selector, __m128i const &a, __m128i const &b)
                              ^~~~~~~~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:446:39: note: called from here
         result = simd_blend_epi8_sse41(mask_FF, src, result); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
[3/4] Building CXX object avs_core/CMa...s/AvsCore.dir/filters/resample.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -c ../../avs_core/filters/resample.cpp
../../avs_core/filters/resample.cpp: In function 'void resize_v_ssse3_planar(BYTE*, const BYTE*, int, int, ResamplingProgram*, int, int, int, const int*, const void*) [with __m128i (* load)(const __m128i*) = simd_load_streaming]':
../../avs_core/filters/resample.cpp:81:23: error: inlining failed in call to always_inline '__m128i simd_load_streaming(const __m128i*)': target specific option mismatch
 __forceinline __m128i simd_load_streaming(const __m128i* adr)
                       ^~~~~~~~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:415:29: note: called from here
         __m128i src_p = load(reinterpret_cast<const __m128i*>(src2_ptr));
                         ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
[i686:$] 

There were also errors relating to extern/static definitions in field.cpp, stemming from a mismatch in the "Factory methods" section between it and field.h, which has a similar section without the static keywords on the corresponding names.

pinterf commented 5 years ago

I understood the resampler troubles, giving an SSE4.1 forceinlined function as template parameter for an SSSE3 function, strange clang did not noticed. A similar issue was fixed earlier at an other place which even caused internal compiler error :).

The other sse41 blend issue is probably solved by inserting that single instruction directly.

I have not yet changed the ifdefs for GCC and CLANG And I simply forgot that we have already a CLANG define About placing the attribute after the function: the sample I found and provided previously was using it in such a way.

So next try please, I hope we are getting closer to the final success.

fuchanghao commented 5 years ago

I understood the resampler troubles, giving an SSE4.1 forceinlined function as template parameter for an SSSE3 function, strange clang did not noticed. A similar issue was fixed earlier at an other place which even caused internal compiler error :).

The other sse41 blend issue is probably solved by inserting that single instruction directly.

I have not yet changed the ifdefs for GCC and CLANG And I simply forgot that we have already a CLANG define About placing the attribute after the function: the sample I found and provided previously was using it in such a way.

So next try please, I hope we are getting closer to the final success.

r2842 build with VS 2019 RC4 & LLVM 8.0 works fine.

Not test LLVM built's WinXP support. (MSVC v142 no longer support WinXP)

pinterf commented 5 years ago

LLVM dropped XP support 3 years ago.

@qyot27: by this documentation function attributes appear after the function: https://gcc.gnu.org/onlinedocs/gcc-4.9.1/gcc/Function-Attributes.html#Function-Attributes On the other hand, there are situations which feel better with placing them before the function. https://stackoverflow.com/questions/41159934/where-to-place-gcc-function-attribute-in-auto-function. Can you tell me which kind of functions (templated ones?) are those which do not like the 'after' syntax?

qyot27 commented 5 years ago

After disabling the use of -march=native:

mkdir -p avisynth-build/i686 avisynth-build/amd64 && \

cd avisynth-build/i686 && \
    cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=$HOME/avisynth+_build/32bit \
    -DCMAKE_TOOLCHAIN_FILE="/usr/x86_64-w64-mingw32/toolchain-x86_64-w64-mingw32.cmake" \
    -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" -DCMAKE_RC_FLAGS="-F pe-i386" \
    -DENABLE_PLUGINS:bool=off

-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.19.1") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/qyot27/AviSynthPlus/avisynth-build/i686
[i686:$] ninja
[3/86] Building CXX object avs_core/CM...vsCore.dir/convert/convert_rgb.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/convert/convert_rgb.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/convert/convert_rgb.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/convert/convert_rgb.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/convert/convert_rgb.cpp.obj -c ../../avs_core/convert/convert_rgb.cpp
In file included from ../../avs_core/convert/convert_rgb.cpp:37:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/tmmintrin.h: In function 'void convert_rgb48_to_rgb64_ssse3(const BYTE*, BYTE*, size_t, size_t, size_t, size_t)':
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/tmmintrin.h:136:1: error: inlining failed in call to always_inline '__m128i _mm_shuffle_epi8(__m128i, __m128i)': target specific option mismatch
 _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:71:33: note: called from here
       __m128i dst = _mm_or_si128(alpha, _mm_shuffle_epi8(src0, mask0));
                     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/convert/convert_rgb.cpp:37:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/tmmintrin.h:136:1: error: inlining failed in call to always_inline '__m128i _mm_shuffle_epi8(__m128i, __m128i)': target specific option mismatch
 _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:71:33: note: called from here
       __m128i dst = _mm_or_si128(alpha, _mm_shuffle_epi8(src0, mask0));
                     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/convert/convert_rgb.cpp:37:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/tmmintrin.h:136:1: error: inlining failed in call to always_inline '__m128i _mm_shuffle_epi8(__m128i, __m128i)': target specific option mismatch
 _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:76:25: note: called from here
       dst = _mm_or_si128(alpha, _mm_shuffle_epi8(tmp, mask0));
             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/convert/convert_rgb.cpp:37:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/tmmintrin.h:136:1: error: inlining failed in call to always_inline '__m128i _mm_shuffle_epi8(__m128i, __m128i)': target specific option mismatch
 _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:81:25: note: called from here
       dst = _mm_or_si128(alpha, _mm_shuffle_epi8(tmp, mask0));
             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/convert/convert_rgb.cpp:37:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/tmmintrin.h:136:1: error: inlining failed in call to always_inline '__m128i _mm_shuffle_epi8(__m128i, __m128i)': target specific option mismatch
 _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:84:25: note: called from here
       dst = _mm_or_si128(alpha, _mm_shuffle_epi8(src2, mask1));
             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[4/86] Building CXX object avs_core/CM...ore.dir/convert/convert_planar.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/convert/convert_planar.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/convert/convert_planar.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/convert/convert_planar.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/convert/convert_planar.cpp.obj -c ../../avs_core/convert/convert_planar.cpp
In file included from ../../avs_core/convert/convert_planar.cpp:47:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h: In function 'void convert_planarrgb_to_yuv_uint16_sse41(BYTE* (&)[3], int (&)[3], const BYTE* (&)[3], const int (&)[3], int, int, const ConversionMatrix&) [with int bits_per_pixel = 16]':
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:558:1: error: inlining failed in call to always_inline '__m128i _mm_packus_epi32(__m128i, __m128i)': target specific option mismatch
 _mm_packus_epi32 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_planar.cpp:1209:28: note: called from here
       vi = _mm_packus_epi32(vi, zero);
            ~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from ../../avs_core/convert/convert_planar.cpp:47:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:558:1: error: inlining failed in call to always_inline '__m128i _mm_packus_epi32(__m128i, __m128i)': target specific option mismatch
 _mm_packus_epi32 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_planar.cpp:1194:28: note: called from here
       ui = _mm_packus_epi32(ui, zero);
            ~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from ../../avs_core/convert/convert_planar.cpp:47:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:558:1: error: inlining failed in call to always_inline '__m128i _mm_packus_epi32(__m128i, __m128i)': target specific option mismatch
 _mm_packus_epi32 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_planar.cpp:1179:28: note: called from here
       yi = _mm_packus_epi32(yi, zero);
            ~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from ../../avs_core/convert/convert_planar.cpp:47:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:558:1: error: inlining failed in call to always_inline '__m128i _mm_packus_epi32(__m128i, __m128i)': target specific option mismatch
 _mm_packus_epi32 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_planar.cpp:1179:28: note: called from here
       yi = _mm_packus_epi32(yi, zero);
            ~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from ../../avs_core/convert/convert_planar.cpp:47:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:558:1: error: inlining failed in call to always_inline '__m128i _mm_packus_epi32(__m128i, __m128i)': target specific option mismatch
 _mm_packus_epi32 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_planar.cpp:1194:28: note: called from here
       ui = _mm_packus_epi32(ui, zero);
            ~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from ../../avs_core/convert/convert_planar.cpp:47:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:558:1: error: inlining failed in call to always_inline '__m128i _mm_packus_epi32(__m128i, __m128i)': target specific option mismatch
 _mm_packus_epi32 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert_planar.cpp:1209:28: note: called from here
       vi = _mm_packus_epi32(vi, zero);
            ~~~~~~~~~~~~~~~~^~~~~~~~~~
[8/86] Building CXX object avs_core/CM...es/AvsCore.dir/convert/convert.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/convert/convert.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/convert/convert.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/convert/convert.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/convert/convert.cpp.obj -c ../../avs_core/convert/convert.cpp
In file included from /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/immintrin.h:37,
                 from ../../avs_core/convert/convert.cpp:45:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h: In function 'void convert_32_to_uintN_sse41(const BYTE*, BYTE*, int, int, int, int) [with pixel_t = short unsigned int; unsigned char targetbits = 10; bool chroma = false; bool fulls = true; bool fulld = true]':
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:288:1: error: inlining failed in call to always_inline '__m128i _mm_min_epu16(__m128i, __m128i)': target specific option mismatch
 _mm_min_epu16 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~
../../avs_core/convert/convert.cpp:1654:33: note: called from here
           result = _mm_min_epu16(result, max_pixel_value_128); // sse41, extra clamp for 10, 12, 14 bits
                    ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/immintrin.h:37,
                 from ../../avs_core/convert/convert.cpp:45:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:558:1: error: inlining failed in call to always_inline '__m128i _mm_packus_epi32(__m128i, __m128i)': target specific option mismatch
 _mm_packus_epi32 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert.cpp:1652:34: note: called from here
         result = _mm_packus_epi32(result_0, result_1); // sse41
                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/immintrin.h:37,
                 from ../../avs_core/convert/convert.cpp:45:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:288:1: error: inlining failed in call to always_inline '__m128i _mm_min_epu16(__m128i, __m128i)': target specific option mismatch
 _mm_min_epu16 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~
../../avs_core/convert/convert.cpp:1654:33: note: called from here
           result = _mm_min_epu16(result, max_pixel_value_128); // sse41, extra clamp for 10, 12, 14 bits
                    ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/immintrin.h:37,
                 from ../../avs_core/convert/convert.cpp:45:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:558:1: error: inlining failed in call to always_inline '__m128i _mm_packus_epi32(__m128i, __m128i)': target specific option mismatch
 _mm_packus_epi32 (__m128i __X, __m128i __Y)
 ^~~~~~~~~~~~~~~~
../../avs_core/convert/convert.cpp:1652:34: note: called from here
         result = _mm_packus_epi32(result_0, result_1); // sse41
                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
[i686:$] 

After changing the Clang ifdefs to Clang or GCC ifdefs:

[i686:$] ninja
[3/86] Building CXX object avs_core/CM...vsCore.dir/convert/convert_rgb.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/convert/convert_rgb.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/convert/convert_rgb.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/convert/convert_rgb.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/convert/convert_rgb.cpp.obj -c ../../avs_core/convert/convert_rgb.cpp
../../avs_core/convert/convert_rgb.cpp:53:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:102:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:249:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:292:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:452:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/convert/convert_rgb.cpp:550:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
[4/86] Building CXX object avs_core/CM...ore.dir/convert/convert_planar.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/convert/convert_planar.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/convert/convert_planar.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/convert/convert_planar.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/convert/convert_planar.cpp.obj -c ../../avs_core/convert/convert_planar.cpp
../../avs_core/convert/convert_planar.cpp:1137:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/convert/convert_planar.cpp:1879:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/convert/convert_planar.cpp:2062:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
[8/86] Building CXX object avs_core/CM...es/AvsCore.dir/convert/convert.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/convert/convert.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/convert/convert.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/convert/convert.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/convert/convert.cpp.obj -c ../../avs_core/convert/convert.cpp
../../avs_core/convert/convert.cpp:1581:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/convert/convert.cpp:1943:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
[i686:$] 

After moving the target declarations above the definitions for only those in convert[_rgb|_planar].cpp:

[i686:$] ninja
[6/82] Building CXX object avs_core/CM...les/AvsCore.dir/core/AviHelper.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/core/AviHelper.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/core/AviHelper.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/core/AviHelper.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/core/AviHelper.cpp.obj -c ../../avs_core/core/AviHelper.cpp
../../avs_core/core/AviHelper.cpp:246:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/core/AviHelper.cpp:297:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/core/AviHelper.cpp:519:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
[11/82] Building CXX object avs_core/C...es/AvsCore.dir/convert/convert.cpp.obj
ninja: build stopped: subcommand failed.
[i686:$] 

After moving the target declarations above the definitions for only those in AviHelper.cpp: The field.cpp static keyword issue I mentioned before:

[27/64] Building CXX object avs_core/C...iles/AvsCore.dir/filters/field.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/field.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/field.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/field.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/field.cpp.obj -c ../../avs_core/filters/field.cpp
../../avs_core/filters/field.cpp:955:25: error: 'AVSValue Create_DoubleWeave(AVSValue, void*, IScriptEnvironment*)' was declared 'extern' and later 'static' [-fpermissive]
 static AVSValue __cdecl Create_DoubleWeave(AVSValue args, void*, IScriptEnvironment* env)
                         ^~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/field.cpp:36:
../../avs_core/filters/field.h:424:18: note: previous declaration of 'AVSValue Create_DoubleWeave(AVSValue, void*, IScriptEnvironment*)'
 AVSValue __cdecl Create_DoubleWeave(AVSValue args, void*, IScriptEnvironment* env);
                  ^~~~~~~~~~~~~~~~~~
../../avs_core/filters/field.cpp:966:25: error: 'AVSValue Create_Weave(AVSValue, void*, IScriptEnvironment*)' was declared 'extern' and later 'static' [-fpermissive]
 static AVSValue __cdecl Create_Weave(AVSValue args, void*, IScriptEnvironment* env)
                         ^~~~~~~~~~~~
In file included from ../../avs_core/filters/field.cpp:36:
../../avs_core/filters/field.h:425:18: note: previous declaration of 'AVSValue Create_Weave(AVSValue, void*, IScriptEnvironment*)'
 AVSValue __cdecl Create_Weave(AVSValue args, void*, IScriptEnvironment* env);
                  ^~~~~~~~~~~~
../../avs_core/filters/field.cpp:975:25: error: 'AVSValue Create_Pulldown(AVSValue, void*, IScriptEnvironment*)' was declared 'extern' and later 'static' [-fpermissive]
 static AVSValue __cdecl Create_Pulldown(AVSValue args, void*, IScriptEnvironment* env)
                         ^~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/field.cpp:36:
../../avs_core/filters/field.h:426:18: note: previous declaration of 'AVSValue Create_Pulldown(AVSValue, void*, IScriptEnvironment*)'
 AVSValue __cdecl Create_Pulldown(AVSValue args, void*, IScriptEnvironment* env);
                  ^~~~~~~~~~~~~~~
../../avs_core/filters/field.cpp:985:25: error: 'AVSValue Create_SwapFields(AVSValue, void*, IScriptEnvironment*)' was declared 'extern' and later 'static' [-fpermissive]
 static AVSValue __cdecl Create_SwapFields(AVSValue args, void*, IScriptEnvironment* env)
                         ^~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/field.cpp:36:
../../avs_core/filters/field.h:427:18: note: previous declaration of 'AVSValue Create_SwapFields(AVSValue, void*, IScriptEnvironment*)'
 AVSValue __cdecl Create_SwapFields(AVSValue args, void*, IScriptEnvironment* env);
                  ^~~~~~~~~~~~~~~~~
../../avs_core/filters/field.cpp:992:25: error: 'AVSValue Create_Bob(AVSValue, void*, IScriptEnvironment*)' was declared 'extern' and later 'static' [-fpermissive]
 static AVSValue __cdecl Create_Bob(AVSValue args, void*, IScriptEnvironment* env)
                         ^~~~~~~~~~
In file included from ../../avs_core/filters/field.cpp:36:
../../avs_core/filters/field.h:428:18: note: previous declaration of 'AVSValue Create_Bob(AVSValue, void*, IScriptEnvironment*)'
 AVSValue __cdecl Create_Bob(AVSValue args, void*, IScriptEnvironment* env);
                  ^~~~~~~~~~

[29/64] Building CXX object avs_core/C...iles/AvsCore.dir/filters/focus.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/focus.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/focus.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/focus.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/focus.cpp.obj -c ../../avs_core/filters/focus.cpp
../../avs_core/filters/focus.cpp:195:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/focus.cpp:244:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/focus.cpp:314:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/focus.cpp:758:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/focus.cpp:1346:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/focus.cpp:1883:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/focus.cpp:1954:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/filters/focus.cpp:2071:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~

After moving the target declarations above the definitions for only those in focus.cpp and removing the static keywords in field.cpp:

[i686:$] ninja
[2/31] Building CXX object avs_core/CM.../AvsCore.dir/filters/greyscale.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/greyscale.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/greyscale.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/greyscale.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/greyscale.cpp.obj -c ../../avs_core/filters/greyscale.cpp
../../avs_core/filters/greyscale.cpp:136:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
[3/31] Building CXX object avs_core/CM...es/AvsCore.dir/filters/limiter.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/limiter.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/limiter.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/limiter.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/limiter.cpp.obj -c ../../avs_core/filters/limiter.cpp
../../avs_core/filters/limiter.cpp:77:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
[7/31] Building CXX object avs_core/CM...les/AvsCore.dir/filters/levels.cpp.obj
ninja: build stopped: subcommand failed.
[i686:$] 

After moving the target declarations above the definitions for only those in greyscale.cpp and limiter.cpp:

[i686:$] ninja
[11/27] Building CXX object avs_core/C...dir/filters/overlay/444convert.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/overlay/444convert.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/overlay/444convert.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/overlay/444convert.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/overlay/444convert.cpp.obj -c ../../avs_core/filters/overlay/444convert.cpp
../../avs_core/filters/overlay/444convert.cpp:421:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/overlay/444convert.cpp:507:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/overlay/444convert.cpp:707:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/overlay/444convert.cpp:777:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
[16/27] Building CXX object avs_core/C...r/filters/overlay/blend_common.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -c ../../avs_core/filters/overlay/blend_common.cpp
../../avs_core/filters/overlay/blend_common.cpp:105:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:149:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:388:3: error: attributes are not allowed on a function-definition
   __attribute__((__target__("sse4.1")))
   ^~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:719:3: error: attributes are not allowed on a function-definition
   __attribute__((__target__("sse4.1")))
   ^~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:1061:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:1381:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
[i686:$] 

After moving the target declarations above the definitions for only those in 444convert.cpp and blend_common.cpp:

[i686:$] ninja
[2/14] Building CXX object avs_core/CM...r/filters/overlay/blend_common.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -c ../../avs_core/filters/overlay/blend_common.cpp
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h: In function 'void overlay_blend_sse41_plane_masked(BYTE*, const BYTE*, const BYTE*, int, int, int, int, int) [with pixel_t = unsigned char; int bits_per_pixel = 8]':
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
[3/14] Building CXX object avs_core/CM.../AvsCore.dir/filters/planeswap.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/planeswap.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/planeswap.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/planeswap.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/planeswap.cpp.obj -c ../../avs_core/filters/planeswap.cpp
../../avs_core/filters/planeswap.cpp:106:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
[5/14] Building CXX object avs_core/CM...s/AvsCore.dir/filters/resample.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -c ../../avs_core/filters/resample.cpp
../../avs_core/filters/resample.cpp: In function 'void resize_v_sse41_planar(BYTE*, const BYTE*, int, int, ResamplingProgram*, int, int, int, const int*, const void*)':
../../avs_core/filters/resample.cpp:413:47: error: invalid conversion from 'const __m128i*' {aka 'const __vector(2) long long int*'} to '__m128i*' {aka '__vector(2) long long int*'} [-fpermissive]
         __m128i src_p = _mm_stream_load_si128(reinterpret_cast<const __m128i*>(src2_ptr));
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/resample.cpp:50:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:582:33: note:   initializing argument 1 of '__m128i _mm_stream_load_si128(__m128i*)'
 _mm_stream_load_si128 (__m128i *__X)
                        ~~~~~~~~~^~~
../../avs_core/filters/resample.cpp: At global scope:
../../avs_core/filters/resample.cpp:461:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:709:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:903:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:979:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:1055:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:1071:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:1219:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:1420:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("sse4.1")))
 ^~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:1643:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
../../avs_core/filters/resample.cpp:1727:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
[7/14] Building CXX object avs_core/CM...Core.dir/filters/resample_avx2.cpp.obj
ninja: build stopped: subcommand failed.
[2]+  Done                    leafpad ../../avs_core/filters/overlay/blend_common.cpp
[i686:$] 

After moving the target declarations above the definitions for only those in planeswap.cpp and resample.cpp:

[i686:$] ninja
[2/11] Building CXX object avs_core/CM...r/filters/overlay/blend_common.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -c ../../avs_core/filters/overlay/blend_common.cpp
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h: In function 'void overlay_blend_sse41_plane_masked(BYTE*, const BYTE*, const BYTE*, int, int, int, int, int) [with pixel_t = unsigned char; int bits_per_pixel = 8]':
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
[6/11] Building CXX object avs_core/CM...s/AvsCore.dir/filters/resample.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -c ../../avs_core/filters/resample.cpp
../../avs_core/filters/resample.cpp: In function 'void resize_v_sse41_planar(BYTE*, const BYTE*, int, int, ResamplingProgram*, int, int, int, const int*, const void*)':
../../avs_core/filters/resample.cpp:413:47: error: invalid conversion from 'const __m128i*' {aka 'const __vector(2) long long int*'} to '__m128i*' {aka '__vector(2) long long int*'} [-fpermissive]
         __m128i src_p = _mm_stream_load_si128(reinterpret_cast<const __m128i*>(src2_ptr));
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/resample.cpp:50:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:582:33: note:   initializing argument 1 of '__m128i _mm_stream_load_si128(__m128i*)'
 _mm_stream_load_si128 (__m128i *__X)
                        ~~~~~~~~~^~~
[7/11] Building CXX object avs_core/CM...les/AvsCore.dir/filters/source.cpp.obj
ninja: build stopped: subcommand failed.
[2]+  Done                    leafpad ../../avs_core/filters/resample.cpp
[i686:$] 

Successive runs of ninja will continue building other files while still erroring on unfixed sources:

[i686:$] ninja
[2/7] Building CXX object avs_core/CMa...r/filters/overlay/blend_common.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -c ../../avs_core/filters/overlay/blend_common.cpp
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h: In function 'void overlay_blend_sse41_plane_masked(BYTE*, const BYTE*, const BYTE*, int, int, int, int, int) [with pixel_t = unsigned char; int bits_per_pixel = 8]':
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
[3/7] Building CXX object avs_core/CMa...Files/AvsCore.dir/filters/turn.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/turn.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/turn.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/turn.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/turn.cpp.obj -c ../../avs_core/filters/turn.cpp
../../avs_core/filters/turn.cpp:540:1: error: attributes are not allowed on a function-definition
 __attribute__((__target__("ssse3")))
 ^~~~~~~~~~~~~
[5/7] Building CXX object avs_core/CMa...s/AvsCore.dir/filters/resample.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -c ../../avs_core/filters/resample.cpp
../../avs_core/filters/resample.cpp: In function 'void resize_v_sse41_planar(BYTE*, const BYTE*, int, int, ResamplingProgram*, int, int, int, const int*, const void*)':
../../avs_core/filters/resample.cpp:413:47: error: invalid conversion from 'const __m128i*' {aka 'const __vector(2) long long int*'} to '__m128i*' {aka '__vector(2) long long int*'} [-fpermissive]
         __m128i src_p = _mm_stream_load_si128(reinterpret_cast<const __m128i*>(src2_ptr));
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/resample.cpp:50:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:582:33: note:   initializing argument 1 of '__m128i _mm_stream_load_si128(__m128i*)'
 _mm_stream_load_si128 (__m128i *__X)
                        ~~~~~~~~~^~~
[6/7] Building CXX object avs_core/CMa...sCore.dir/filters/text-overlay.cpp.obj
ninja: build stopped: subcommand failed.
[i686:$] 

After moving the target declarations above the definitions for only those in turn.cpp:

[i686:$] ninja
[2/5] Building CXX object avs_core/CMa...r/filters/overlay/blend_common.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -c ../../avs_core/filters/overlay/blend_common.cpp
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h: In function 'void overlay_blend_sse41_plane_masked(BYTE*, const BYTE*, const BYTE*, int, int, int, int, int) [with pixel_t = unsigned char; int bits_per_pixel = 8]':
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
[4/5] Building CXX object avs_core/CMa...s/AvsCore.dir/filters/resample.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -c ../../avs_core/filters/resample.cpp
../../avs_core/filters/resample.cpp: In function 'void resize_v_sse41_planar(BYTE*, const BYTE*, int, int, ResamplingProgram*, int, int, int, const int*, const void*)':
../../avs_core/filters/resample.cpp:413:47: error: invalid conversion from 'const __m128i*' {aka 'const __vector(2) long long int*'} to '__m128i*' {aka '__vector(2) long long int*'} [-fpermissive]
         __m128i src_p = _mm_stream_load_si128(reinterpret_cast<const __m128i*>(src2_ptr));
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/resample.cpp:50:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:582:33: note:   initializing argument 1 of '__m128i _mm_stream_load_si128(__m128i*)'
 _mm_stream_load_si128 (__m128i *__X)
                        ~~~~~~~~~^~~
ninja: build stopped: subcommand failed.
[i686:$] 

Successive runs:

[i686:$] ninja
[2/4] Building CXX object avs_core/CMa...r/filters/overlay/blend_common.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/overlay/blend_common.cpp.obj -c ../../avs_core/filters/overlay/blend_common.cpp
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h: In function 'void overlay_blend_sse41_plane_masked(BYTE*, const BYTE*, const BYTE*, int, int, int, int, int) [with pixel_t = unsigned char; int bits_per_pixel = 8]':
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:436:33: note: called from here
         result = _mm_blendv_epi8(result, dst, mask_00); // ensure that zero mask value returns dst
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/overlay/blend_common.cpp:44:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:179:1: error: inlining failed in call to always_inline '__m128i _mm_blendv_epi8(__m128i, __m128i, __m128i)': target specific option mismatch
 _mm_blendv_epi8 (__m128i __X, __m128i __Y, __m128i __M)
 ^~~~~~~~~~~~~~~
../../avs_core/filters/overlay/blend_common.cpp:439:33: note: called from here
         result = _mm_blendv_epi8(result, src, mask_FF); // ensure that max mask value returns src
                  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
[3/4] Building CXX object avs_core/CMa...s/AvsCore.dir/filters/resample.cpp.obj
FAILED: avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj 
/usr/bin/x86_64-w64-mingw32-g++  -DAvsCore_EXPORTS -DBUILDING_AVSCORE -I../../avs_core/include -Iavs_core -m32 -std=c++17 -MD -MT avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -MF avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj.d -o avs_core/CMakeFiles/AvsCore.dir/filters/resample.cpp.obj -c ../../avs_core/filters/resample.cpp
../../avs_core/filters/resample.cpp: In function 'void resize_v_sse41_planar(BYTE*, const BYTE*, int, int, ResamplingProgram*, int, int, int, const int*, const void*)':
../../avs_core/filters/resample.cpp:413:47: error: invalid conversion from 'const __m128i*' {aka 'const __vector(2) long long int*'} to '__m128i*' {aka '__vector(2) long long int*'} [-fpermissive]
         __m128i src_p = _mm_stream_load_si128(reinterpret_cast<const __m128i*>(src2_ptr));
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../avs_core/filters/resample.cpp:50:
/usr/lib/gcc/x86_64-w64-mingw32/8.3.0/include/smmintrin.h:582:33: note:   initializing argument 1 of '__m128i _mm_stream_load_si128(__m128i*)'
 _mm_stream_load_si128 (__m128i *__X)
                        ~~~~~~~~~^~~
ninja: build stopped: subcommand failed.
[i686:$] 

And that's it.

pinterf commented 5 years ago

There was a forgotten local commit for the "blend" issue which I have finally sync'd today, maybe that is missing? I hope that is the only problem.

qyot27 commented 5 years ago

All of that was with the three commits that were pushed today.

pinterf commented 5 years ago

That last one is strange, the problem with the stream_load: In old headers: __m128i _mm_stream_load_si128(__m128i *p);

In latest smmintrin.h versions:

#if defined(_CRT_WINDOWS) || defined(BUILD_WINDOWS)
        extern __m128i _mm_stream_load_si128(__m128i*);
#else /* defined(_CRT_WINDOWS) || defined(BUILD_WINDOWS) */
        extern __m128i _mm_stream_load_si128(const __m128i*);
#endif /* defined(_CRT_WINDOWS) || defined(BUILD_WINDOWS) */

The latter is the enabled live definition.

I wonder, what's in GCC's smmintrin.h

Still don't understand why it is hectic just on the _mm_blendv_epi8 function.

qyot27 commented 5 years ago

In GCC's 8.3 release (and in the master branch): https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/i386/smmintrin.h;h=b7257a562eae4958538733c3b092457525f94c31;hb=refs/heads/gcc-8-branch#l580

No ifdef at all, defined as

 580 /* Load double quadword using non-temporal aligned hint.  */
 581 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 582 _mm_stream_load_si128 (__m128i *__X)
 583 {
 584   return (__m128i) __builtin_ia32_movntdqa ((__v2di *) __X);
 585 }
 586 
pinterf commented 5 years ago

Can I theoretically repeat your process on Windows? I'm trying gcc (8.2 - but I don't think it's that big difference) installed following the instructions from here: https://www.youtube.com/watch?v=sXW2VLrQ3Bs

Run cmake

del CMakeCache.txt
"c:\Program Files\CMake\bin\cmake.exe" -G "MinGW Makefiles" .

Got output like this

-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.17.1.windows.2")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Github/AviSynthPlusPf

Then mingw32-make -f makefile clean mingw32-make -f makefile

I have totally different stoppers

[  1%] Building CXX object avs_core/CMakeFiles/AvsCore.dir/core/AviHelper.cpp.obj
C:\Github\AviSynthPlusPf\avs_core\core\AviHelper.cpp:38:10: fatal error: intrin.h: No such file or directory
 #include <intrin.h>
          ^~~~~~~~~~

?! No intrin.h indeed in my gcc. O.K., commented out. Then it has problems with mutex class, std::mutex basically. Works or not: articles say pthreads support, maybe there should exist a special build with https://stackoverflow.com/questions/24009821/mingw-4-8-1-c11-thread-support

So it seems I am using a MinGW toolset which is old?

This article says that they use MSYS2 and install MinGW-w64 compilers from there, which do support the required functionality. https://stackoverflow.com/questions/27939393/getting-error-mutex-in-namespace-std-does-not-name-a-type-in-mingw-mysys-pr?noredirect=1&lq=1 At the moment it's beyond my actual knowledge, I have installed mingw-w64 but having zero overview how it should work, I have an MSYS console and was able to do nothing, perhaps I even need to compile my own gcc?

These are the errors which I could not even get past.

[  2%] Building CXX object avs_core/CMakeFiles/AvsCore.dir/core/MTGuard.cpp.obj
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp: In destructor 'virtual MTGuard::~MTGuard()':
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:65:10: warning: possible problem detected in invocation of delete operator: [-Wdelete-incomplete]
   delete FilterMutex;
          ^~~~~~~~~~~
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:65:10: warning: invalid use of incomplete type 'class std::mutex'
In file included from C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:35:
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.h:12:9: note: forward declaration of 'class std::mutex'
   class mutex;
         ^~~~~
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:65:10: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined
   delete FilterMutex;
          ^~~~~~~~~~~
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp: In member function 'void MTGuard::EnableMT(size_t)':
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:99:44: error: invalid use of incomplete type 'class std::mutex'
         this->FilterMutex = new std::mutex();
                                            ^
In file included from C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:35:
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.h:12:9: note: forward declaration of 'class std::mutex'
   class mutex;
         ^~~~~
In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\mutex:43,
                 from C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:41:
c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\std_mutex.h: In instantiation of 'std::lock_guard<_Mutex>::lock_guard(std::lock_guard<_Mutex>::mutex_type&) [with _Mutex = std::mutex; std::lock_guard<_Mutex>::mutex_type = std::mutex]':
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:139:52:   required from here
c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\std_mutex.h:162:19: error: invalid use of incomplete type 'std::lock_guard<std::mutex>::mutex_type' {aka 'class std::mutex'}
       { _M_device.lock(); }
         ~~~~~~~~~~^~~~
In file included from C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:35:
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.h:12:9: note: forward declaration of 'std::lock_guard<std::mutex>::mutex_type' {aka 'class std::mutex'}
   class mutex;
         ^~~~~
In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\mutex:43,
                 from C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:41:
c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\std_mutex.h: In instantiation of 'std::lock_guard<_Mutex>::~lock_guard() [with _Mutex = std::mutex]':
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:139:52:   required from here
c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\std_mutex.h:168:19: error: invalid use of incomplete type 'std::lock_guard<std::mutex>::mutex_type' {aka 'class std::mutex'}
       { _M_device.unlock(); }
         ~~~~~~~~~~^~~~~~
In file included from C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.cpp:35:
C:\Github\AviSynthPlusPf\avs_core\core\MTGuard.h:12:9: note: forward declaration of 'std::lock_guard<std::mutex>::mutex_type' {aka 'class std::mutex'}
   class mutex;
         ^~~~~
avs_core\CMakeFiles\AvsCore.dir\build.make:216: recipe for target 'avs_core/CMakeFiles/AvsCore.dir/core/MTGuard.cpp.obj' failed
mingw32-make[2]: *** [avs_core/CMakeFiles/AvsCore.dir/core/MTGuard.cpp.obj] Error 1
CMakeFiles\Makefile2:122: recipe for target 'avs_core/CMakeFiles/AvsCore.dir/all' failed
mingw32-make[1]: *** [avs_core/CMakeFiles/AvsCore.dir/all] Error 2
makefile:128: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
qyot27 commented 5 years ago

Yeah, that's definitely not correct. The video is instructing for the old pre-w64 MinGW, although I only skimmed it. You'll want to use the MSys2 installer to set up the environment, and then you can enter the MSys2 shell (or rather, the MinGW alternate shell installed alongside it) and while inside the shell, use the pacman package manager to install all the dependencies. Unfortunately, I don't have a complete list of the dependencies as they're provided by MSys2.

I've been toying with the idea of adapting my crosscompile guide to a Cygwin environment, just to have a ready-to-use solution (and because Cygwin is closer to a native Linux crosscompiler than MSys2 is). That should be more of a 1:1 equal guide, apart from getting the basic stuff to get GCC compiled.

pinterf commented 5 years ago

Thanks, MSYS2 was the keyword for me. Installation is on the way.

pinterf commented 5 years ago

Ok, msys2 and gcc8.3 is working, built all module but Shibatch with a single -msse2. Let me have some more time this week since I have to clean up the mess of source movements I've done around blend_common. I also got an 'alignas(32) too much"-like warning in ExprFilter I have to look at. The build output is also a mess for my first trial, I found modules in arbitrary folders, e.g. libConvertStacked.dll and libConvertStacked.dll.a generated in the same folder as ConvertStacked.cpp.

qyot27 commented 5 years ago

The build output is also a mess for my first trial, I found modules in arbitrary folders, e.g. libConvertStacked.dll and libConvertStacked.dll.a generated in the same folder as ConvertStacked.cpp.

That sounds normal if you were doing an in-tree build? make install (or ninja install) takes care of the installation of the generated stuff into the correct directory structure. Unless you mean that make install wasn't installing the plugins (and based on that comment, I guess the plugins also need to have the same ifdef that omits the lib- prefix if building on/for Windows) - I always disable the plugins when testing GCC because I wasn't aware they'd been fixed up enough to build under GCC.

pinterf commented 5 years ago

Huh, next try, please. Updated the small readme as well with gcc things and todos. Build instructions and environment for VS, CLANG and GCC now deserve a separate documentation I think.

fuchanghao commented 5 years ago

r2855 did not work with LLVM-Clang 8.0.0 again. I tried both /std:c++17 & /std:c++latest it won't solve the problem like you wrote in the comment.

Tools: LLVM 8.0.0 Visual Studio 2019 16.0.1 / Visual studio 2017 15.9.11 Cmake 3.14.1 NASM 2.14.02

Seems the commit 3be8306618fda9bfeb82f1630f6e4e1b9e1970e7 makes the problem.

error message:

Clang

9>D:\Source code\AviSynth\AviSynthPlus\avs_core\filters\exprfilter\exprfilter.cpp(3403): error : reinterpret_cast from 'int' to 'intptr_t' (aka 'long long') is not allowed

pinterf commented 5 years ago

Failed for 64bit builds. I checked the mods for all three compilers but have not switched to x64.

fuchanghao commented 5 years ago

Failed for 64bit builds. I checked the mods for all three compilers but have not switched to x64.

r2856 works fine in both Clang & MSVC 142 (GCC with msys2 MINGW-W64 not tested.)

qyot27 commented 5 years ago

Builds with GCC given some of the changes in pull #31 (it also fixes a couple things that cropped up during testing the plugins).

Is the v14*_xp toolset gone from VS2019? Just wondering for the documentation, since VS2017 still has it.

fuchanghao commented 5 years ago

Builds with GCC given some of the changes in pull #31 (it also fixes a couple things that cropped up during testing the plugins).

Is the v14*_xp toolset gone from VS2019? Just wondering for the documentation, since VS2017 still has it.

VS2019 only have v141_xp with Deprecated tag. v142 no longer support WinXP.

From the road map, Visual Studio 2017 no longer support Any new features after 2018 Q4. https://docs.microsoft.com/visualstudio/productinfo/vs-roadmap

pinterf commented 5 years ago

RgTools source finally became gcc (through makefile/CMakeLists) and clang (included in Visual Studio .sln) compatible. https://github.com/pinterf/RgTools @qyot27: I was trying to create a makefile for mingw build, I'm sure it's not nice but I was able to build the dll with gcc 8.3 using the generated makefile.

fuchanghao commented 5 years ago

RgTools source finally became gcc (through makefile/CMakeLists) and clang (included in Visual Studio .sln) compatible. https://github.com/pinterf/RgTools @qyot27: I was trying to create a makefile for mingw build, I'm sure it's not nice but I was able to build the dll with gcc 8.3 using the generated makefile.

seems clang build not work in r138.

llvm 8.0.0 with lastest windows 10 SDK.

1>lld-link : error : undefined symbol: __imp_MapViewOfFileNuma2 1>>>> referenced by C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\memoryapi.h:965 1>>>> D:\Source code\AviSynth\RgTools\Build\x64\Temp\Release LLVM\RemoveGrainT.obj:(MapViewOfFile2)

qyot27 commented 5 years ago

Installed the GCC 8.3.0 package I generated last time I went through the process of updating the tedious build guide, on a fresh install of Ubuntu 19.04. A full refresh of the cross environment with GCC 9.1.0 will occur when that's released in the coming weeks.

CMake 3.14.x might not have hit all package management systems yet, so that's something to look out for (even if there's nothing we can do about that because of MSVC 2019 support):

    cmake ../../ -G "Ninja" -DCMAKE_INSTALL_PREFIX=$HOME/avisynth+_build/32bit \
    -DCMAKE_TOOLCHAIN_FILE="/usr/x86_64-w64-mingw32/toolchain-x86_64-w64-mingw32.cmake" \
    -DCMAKE_C_FLAGS="-m32" -DCMAKE_CXX_FLAGS="-m32" -DCMAKE_RC_FLAGS="-F pe-i386"
ninja
ninja install

(not really sure if CMAKE_RC_FLAGS was necessary here, and I doubt CMAKE_C_FLAGS was, but I just copy-pasted...didn't harm anything, at any rate)

Issues:

But with those changes, the plugin built and I did a quick test to confirm that it works. Seems okay, but as I don't use RemoveGrain/RgTools I couldn't really tell (and I just used the defaults).

pinterf commented 5 years ago

Thanks, RgTools updated, removed some unnecessary includes, plus now compiles clang again

magiblot commented 5 years ago

How far are we from a linux release build? img

pinterf commented 5 years ago

Quite a few lightyears

fuchanghao commented 5 years ago

A better way to use clang in VS2019 after 16.2 is out.

https://devblogs.microsoft.com/cppblog/clang-llvm-support-for-msbuild-projects/

pinterf commented 5 years ago

Yep. 8.0. When I have to benchmark plugin versions, I'm using the 9.0 snapshot build because it has a fix the the very inefficient and sloooooow _mm_avg_epu8 implementation. Rarely used but when a code contains it, 9.0 is a must have.

fuchanghao commented 4 years ago

Yep. 8.0. When I have to benchmark plugin versions, I'm using the 9.0 snapshot build because it has a fix the the very inefficient and sloooooow _mm_avg_epu8 implementation. Rarely used but when a code contains it, 9.0 is a must have.

Now in VS2019 16.4 is use llvm 9.0.0 now.

Can you update the cmake to support build-in LLVM/Clang-CL.

Like

(CMAKE_GENERATOR_TOOLSET STREQUAL "LLVM" OR CMAKE_GENERATOR_TOOLSET STREQUAL "llvm" OR CMAKE_GENERATOR_TOOLSET STREQUAL "ClangCL")

pinterf commented 4 years ago

I checked that it doesn't work out of box when providing llvm or LLVM for Cmake -T option. I was a bit confused because I had previously a separate LLVM 9.0 install, and now I also checkboxed LLVM 9.0 support in VS Installer. When I manually set Platform Toolset in Project Properties|General, I have a list:

v141_clang_c2
LLVM (clang-cl)
llvm

I wondered which is the embedded one, but yes, providing "ClangCL" will choose the compiler in C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe while choosing llvm will invoke C:/Program Files/LLVM/bin/clang-cl.exe