qt5base-lts/cmake/QtCompilerOptimization.cmake
Simon Hausmann e9c45bbddd Begin port of qtbase to CMake
Done-by: Alexandru Croitor <alexandru.croitor@qt.io>
Done-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Done-by: Kevin Funk <kevin.funk@kdab.com>
Done-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Done-by: Simon Hausmann <simon.hausmann@qt.io>
Done-by: Tobias Hunger <tobias.hunger@qt.io>
Done-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Done-by: Volker Krause <volker.krause@kdab.com>
Change-Id: Ida4f8bd190f9a4849a1af7b5b7981337a5df5310
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
2018-11-01 11:48:46 +00:00

107 lines
4.0 KiB
CMake

if (QCC)
set(QT_CFLAGS_SSE2 "-msse2")
set(QT_CFLAGS_SSE3 "-msse3")
set(QT_CFLAGS_SSSE3 "-mssse3")
set(QT_CFLAGS_SSE4_1 "-msse4.1")
set(QT_CFLAGS_SSE4_2 "-msse4.2")
set(QT_CFLAGS_AVX "-mavx")
set(QT_CFLAGS_AVX2 "-mavx2")
set(QT_CFLAGS_AESNI "-maes")
set(QT_CFLAGS_SHANI "-msha")
endif()
if (MSVC)
if (QT_64BIT)
# SSE2 is mandatory on 64-bit mode, so skip the option. It triggers:
# cl : Command line warning D9002 : ignoring unknown option '-arch:SSE2'
set(QT_CFLAGS_SSE2 "")
else()
set(QT_CFLAGS_SSE2 "-arch:SSE2")
endif()
set(QT_CFLAGS_SSE3 "${QT_CFLAGS_SSE2}")
set(QT_CFLAGS_SSSE3 "${QT_CFLAGS_SSE2}")
set(QT_CFLAGS_SSE4_1 "${QT_CFLAGS_SSE2}")
set(QT_CFLAGS_SSE4_2 "${QT_CFLAGS_SSE2}")
set(QT_CFLAGS_AESNI "${QT_CFLAGS_SSE2}")
set(QT_CFLAGS_SHANI "${QT_CFLAGS_SSE2}")
endif()
if(GCC OR CLANG)
set(QT_CFLAGS_SSE2 "-msse2")
set(QT_CFLAGS_SSE3 "-msse3")
set(QT_CFLAGS_SSSE3 "-mssse3")
set(QT_CFLAGS_SSE4_1 "-msse4.1")
set(QT_CFLAGS_SSE4_2 "-msse4.2")
set(QT_CFLAGS_F16C "-mf16c")
set(QT_CFLAGS_RDRND "-mrdrnd")
set(QT_CFLAGS_AVX "-mavx")
set(QT_CFLAGS_AVX2 "-mavx2")
set(QT_CFLAGS_AVX512F "-mavx512f")
set(QT_CFLAGS_AVX512ER "-mavx512er")
set(QT_CFLAGS_AVX512CD "-mavx512cd")
set(QT_CFLAGS_AVX512PF "-mavx512pf")
set(QT_CFLAGS_AVX512DQ "-mavx512dq")
set(QT_CFLAGS_AVX512BW "-mavx512bw")
set(QT_CFLAGS_AVX512VL "-mavx512vl")
set(QT_CFLAGS_AVX512IFMA "-mavx512ifma")
set(QT_CFLAGS_AVX512VBMI "-mavx512vbmi")
set(QT_CFLAGS_AESNI "-maes")
set(QT_CFLAGS_SHANI "-msha")
set(QT_CFLAGS_NEON "-mfpu=neon")
set(QT_CFLAGS_MIPS_DSP "-mdsp")
set(QT_CFLAGS_MIPS_DSPR2 "-mdspr2")
endif()
if (winrt) # FIXME: Correct variable
set(QT_CFLAGS_SSE2 "-arch:SSE2")
set(QT_CFLAGS_SSE3 "-arch:SSE2")
set(QT_CFLAGS_SSSE3 "-arch:SSE2")
set(QT_CFLAGS_SSE4_1 "-arch:SSE2")
set(QT_CFLAGS_SSE4_2 "-arch:SSE2")
set(QT_CFLAGS_AVX "-arch:AVX")
set(QT_CFLAGS_AVX2 "-arch:AVX")
set(QT_CFLAGS_AESNI "-arch:SSE2")
set(QT_CFLAGS_SHANI "-arch:SSE2")
endif()
if (ICC)
if (MSVC)
set(QT_CFLAGS_SSE2 "-QxSSE2")
set(QT_CFLAGS_SSE3 "-QxSSE3")
set(QT_CFLAGS_SSSE3 "-QxSSSE3")
set(QT_CFLAGS_SSE4_1 "-QxSSE4.1")
set(QT_CFLAGS_SSE4_2 "-QxSSE4.2")
set(QT_CFLAGS_AVX "-QxAVX")
set(QT_CFLAGS_AVX2 "-QxCORE-AVX2")
set(QT_CFLAGS_AVX512F "-QxCOMMON-AVX512")
set(QT_CFLAGS_AVX512CD "-QxCOMMON-AVX512")
set(QT_CFLAGS_AVX512ER "-QxMIC-AVX512")
set(QT_CFLAGS_AVX512PF "-QxMIC-AVX512")
set(QT_CFLAGS_AVX512DQ "-QxCORE-AVX512")
set(QT_CFLAGS_AVX512BW "-QxCORE-AVX512")
set(QT_CFLAGS_AVX512VL "-QxCORE-AVX512")
set(QT_CFLAGS_F16C "${QT_CFLAGS_AVX2}")
set(QT_CFLAGS_AESNI "-QxSSE2")
set(QT_CFLAGS_SHANI "-QxSSE4.2")
else()
set(QT_CFLAGS_SSE2 "-msse2")
set(QT_CFLAGS_SSE3 "-msse3")
set(QT_CFLAGS_SSSE3 "-mssse3")
set(QT_CFLAGS_SSE4_1 "-msse4.1")
set(QT_CFLAGS_SSE4_2 "-msse4.2")
set(QT_CFLAGS_AVX "-march=core-avx")
set(QT_CFLAGS_AVX2 "-march=core-avx2")
set(QT_CFLAGS_AVX512F "-march=broadwell -xCOMMON-AVX512")
set(QT_CFLAGS_AVX512CD "-march=broadwell -xCOMMON-AVX512")
set(QT_CFLAGS_AVX512ER "-march=knl")
set(QT_CFLAGS_AVX512PF "-march=knl")
set(QT_CFLAGS_AVX512DQ "-march=skylake-avx512")
set(QT_CFLAGS_AVX512BW "-march=skylake-avx512")
set(QT_CFLAGS_AVX512VL "-march=skylake-avx512")
set(QT_CFLAGS_AESNI "-maes")
set(QT_CFLAGS_F16C "${QT_CFLAGS_AVX2}")
set(QT_CFLAGS_RDRND "-mrdrnd")
set(QT_CFLAGS_SHANI "-msha")
endif()
endif()