ddpatel2606 / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

clangcl build fail on row_win.cc #451

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
row_win.cc almost compiles as-is if the _MSC_VER definition of SIMD_ALIGNED is 
used in row.h

and if -msse4.1 is passed to enable  _mm_maddubs_epi16

Original issue reported on code.google.com by fbarch...@chromium.org on 8 Jun 2015 at 6:54

GoogleCodeExporter commented 9 years ago
row_win.cc intrinsics produce the following errors:

>ninja -C out\Debug_x64
ninja: Entering directory `out\Debug_x64'
[31/37] CXX obj\source\libyuv.row_win.obj
FAILED: ninja -t msvc -e environment.x64 -- 
..\..\../../myllvm/build/bin/clang-cl -m64 /nologo /showIncludes /FC 
@obj\source\libyuv.row_win.obj.rsp /c ..\..\so
rce\row_win.cc /Foobj\source\libyuv.row_win.obj /Fdobj\libyuv.cc.pdb
..\..\source\row_win.cc(170,37) :  error: cannot cast from type 'lvec8' (vector 
of 32 'int8' values) to pointer type '__m128i *'
    xmm0 = _mm_maddubs_epi16(xmm0, *(__m128i*)kYuvConstants.kUVToB);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..\..\source\row_win.cc(171,37) :  error: cannot cast from type 'lvec8' (vector 
of 32 'int8' values) to pointer type '__m128i *'
    xmm1 = _mm_maddubs_epi16(xmm1, *(__m128i*)kYuvConstants.kUVToG);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..\..\source\row_win.cc(172,37) :  error: cannot cast from type 'lvec8' (vector 
of 32 'int8' values) to pointer type '__m128i *'
    xmm2 = _mm_maddubs_epi16(xmm2, *(__m128i*)kYuvConstants.kUVToR);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..\..\source\row_win.cc(173,27) :  error: cannot cast from type 'lvec16' 
(vector of 16 'int16' values) to pointer type '__m128i *'
    xmm0 = _mm_sub_epi16(*(__m128i*)kYuvConstants.kUVBiasB, xmm0);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..\..\source\row_win.cc(174,27) :  error: cannot cast from type 'lvec16' 
(vector of 16 'int16' values) to pointer type '__m128i *'
    xmm1 = _mm_sub_epi16(*(__m128i*)kYuvConstants.kUVBiasG, xmm1);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..\..\source\row_win.cc(175,27) :  error: cannot cast from type 'lvec16' 
(vector of 16 'int16' values) to pointer type '__m128i *'
    xmm2 = _mm_sub_epi16(*(__m128i*)kYuvConstants.kUVBiasR, xmm2);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..\..\source\row_win.cc(178,35) :  error: cannot cast from type 'lvec16' 
(vector of 16 'int16' values) to pointer type '__m128i *'
    xmm3 = _mm_mulhi_epu16(xmm3, *(__m128i*)kYuvConstants.kYToRgb);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..\..\source\row_win.cc(29,2) :  error: unterminated conditional directive
#if !defined(LIBYUV_DISABLE_X86) && (defined(_M_IX86) || defined(_M_X64)) && \

Original comment by fbarch...@chromium.org on 8 Jun 2015 at 7:49

GoogleCodeExporter commented 9 years ago
FAILED: ninja -t msvc -e environment.x64 -- 
..\..\../../myllvm/build/bin/clang-cl -m64 /nologo /showIncludes /FC 
@obj\source\libyuv.row_win.obj.rsp /c ..\..\sou
rce\row_win.cc /Foobj\source\libyuv.row_win.obj /Fdobj\libyuv.cc.pdb
..\..\source\row_win.cc(170,12) :  error: use of undeclared identifier 
'_mm_maddubs_epi16'
    xmm0 = _mm_maddubs_epi16(xmm0, *(__m128i*)kYuvConstants.kUVToB);
           ^
..\..\source\row_win.cc(171,12) :  error: use of undeclared identifier 
'_mm_maddubs_epi16'
    xmm1 = _mm_maddubs_epi16(xmm1, *(__m128i*)kYuvConstants.kUVToG);
           ^
..\..\source\row_win.cc(172,12) :  error: use of undeclared identifier 
'_mm_maddubs_epi16'
    xmm2 = _mm_maddubs_epi16(xmm2, *(__m128i*)kYuvConstants.kUVToR);
           ^
..\..\source\row_win.cc(29,2) :  error: unterminated conditional directive
#if !defined(LIBYUV_DISABLE_X86) && (defined(_M_IX86) || defined(_M_X64)) && \
 ^

Original comment by fbarch...@chromium.org on 8 Jun 2015 at 7:50

GoogleCodeExporter commented 9 years ago
r1425 switches back to visual c declspecs for alignment, which avoids the 
casting warning.

A crash with clangcl was reported for 64 bit clangcl on the inline win 
assembler.
https://llvm.org/bugs/show_bug.cgi?id=23787

Original comment by fbarch...@chromium.org on 8 Jun 2015 at 9:41

GoogleCodeExporter commented 9 years ago
r1427 disables the intrinsic function I422ToARGB if -mssse3 is not enabled for 
clangcl.

Original comment by fbarch...@chromium.org on 8 Jun 2015 at 10:51

GoogleCodeExporter commented 9 years ago
(I think the Real Fix is to move the intrinsics version to its own file, then 
it can be built with -msse3 with clang and gcc, and the code can be shared 
between all compilers)

Original comment by thakis@chromium.org on 8 Jun 2015 at 11:07

GoogleCodeExporter commented 9 years ago
clang for linux and mac, or gcc for android, chromeos, mingw etc, use 
row_posix.cc version of I422ToARGB for both 32 bit and 64 bit.

The intinsic version in row_win.cc is for win64 when built with visual c.
inline is used for 32 bit, and row_posix.cc for clangcl.

Original comment by fbarch...@chromium.org on 9 Jun 2015 at 12:22

GoogleCodeExporter commented 9 years ago
r1430 To simplify the builds, the source is renamed from posix to gcc and the 
win code does not include the gcc files.

Original comment by fbarch...@chromium.org on 9 Jun 2015 at 5:54