[x265] cmake: avoid different stack alignment for GCC in 32-bit Windows

chen chenm003 at 163.com
Wed Jul 27 20:17:33 CEST 2016


Since you just want to stack alignment, so -mpreferred-stack-boundary is best choice.The -msse2 will allow compiler automatic generate SSE2 code, since we use C++ code, it easy to catch compiler bugs, so I avoid to use these side effect option.--Min
At 2016-07-28 02:12:21,Mateusz <mateusz at msystem.waw.pl> wrote:
>> I suggest use gcc option -mpreferred-stack-boundary
>> 
>> Min
>
>If I change
>add_definitions(-msse)
>to
>add_definitions(-mpreferred-stack-boundary=2)
>it is working stable with all GCC that I tested (4.9.3, 5.4, 6.1, 7.0).
>There is minimal slow-down with this change to GCC 5.4.
>
>GCC 7.0 is working OK with current x265 code (so it is only GCC 6.1 problem).
>
>MSVC is now default at SSE2 level for 32-bit target.
>Intel Compiler is also at SSE2 level (-march=pentium4).
>x264 ads for 32-bit GCC options: "-march=i686 -mfpmath=sse -msse -msse2" -- so it is also default at SSE2 level.
>
>For me the best option is to change x265 default level for 32-bit GCC output to SSE2 (it was patch proposition 12954 from 2016-04-15, but it wasn't committed). It fixes GCC 6.1 problem and speed-up compression.
>
>> At 2016-07-27 16:15:41,"Pradeep Ramachandran" <pradeep at multicorewareinc.com <mailto:pradeep at multicorewareinc.com>> wrote:
>> 
>>     `-msse` only enables the use of SSE instructions with GCC. Since we already add `-march=i686` which is Pentium Pro's instruction set, sse should anyways be added.
>>     Why does adding this explicitly get rid of the stack misalignment problem that you are witnessing? Is there some new change to this option with 6.1 that I am missing?
>> 
>>     Pradeep.
>
>'-march=i686' is without MMX nor SSE, so '-msse' changes a bit. GCC 6.1 is working OK with '-msse' option (but it is only workaround to GCC bug).
>
>Mateusz
>
>> 
>>     On Tue, Jul 26, 2016 at 7:20 PM, Mateusz <mateuszb at poczta.onet.pl <mailto:mateuszb at poczta.onet.pl>> wrote:
>> 
>>         There are bugs in GCC 6.1 that prevent to compile working 32-bitx265for Windows(on default options).
>>         This patch adds '-msse' option to default 32-bit build option to avoid different stack alignment.
>> 
>>         # HG changeset patch
>>         # User Ma0 <mateuszb at poczta.onet.pl> <mailto:mateuszb at poczta.onet.pl>
>>         # Date 1469540439 -7200
>>         #      Tue Jul 26 15:40:39 2016 +0200
>>         # Node ID b95ee119b5c6ccac4892c430c494d1a5f22b2ce0
>>         # Parent  5a0e139e29386ecebafc9c555aedcd3e0f61c70c
>>         cmake: avoid different stack alignment for GCC in 32-bit Windows
>> 
>>         diff -r 5a0e139e2938 -r b95ee119b5c6 source/CMakeLists.txt
>>         --- a/source/CMakeLists.txt    Fri Jul 22 13:13:42 2016 +0530
>>         +++ b/source/CMakeLists.txt    Tue Jul 26 15:40:39 2016 +0200
>>         @@ -184,6 +184,9 @@
>>                  string(FIND "${CMAKE_CXX_FLAGS}" "-march" marchPos)
>>                  if(marchPos LESS "0")
>>                      add_definitions(-march=i686)
>>         +            if(WIN32 AND NOT INTEL_CXX)
>>         +                add_definitions(-msse)
>>         +            endif()
>>                  endif()
>>              endif()
>>              if(ARM AND CROSS_COMPILE_ARM)
>> 
>> 
>> 
>> _______________________________________________
>> x265-devel mailing list
>> x265-devel at videolan.org
>> https://mailman.videolan.org/listinfo/x265-devel
>> 
>
>_______________________________________________
>x265-devel mailing list
>x265-devel at videolan.org
>https://mailman.videolan.org/listinfo/x265-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20160728/d91d10c4/attachment.html>


More information about the x265-devel mailing list