diff options
author | Lorn Potter <lorn.potter@gmail.com> | 2021-04-16 15:34:57 +1000 |
---|---|---|
committer | Lorn Potter <lorn.potter@gmail.com> | 2021-10-05 11:30:06 +1000 |
commit | 0e100a4d892cbdcdb7f326213ec1e4d0d1ae6d89 (patch) | |
tree | 94cdd5d90fc1ea64bdf6e589b152687980010c0e /cmake | |
parent | ef623fd16fa8cb58e7a0f8c04af75ee8b3f2752f (diff) |
wasm: add simd support
Emscripten only supports
SSE1, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, and 128-bit AVX instruction
sets at this time.
https://emscripten.org/docs/porting/simd.html
Browsers might need to enable simd support in the advanced
configurations
about: config or chrome:flags
Enable by configuring Qt with -sse2
Pick-to: 6.2
Fixes: QTBUG-63924
Change-Id: Ifeafae20e199dee0d19689802ad20fd0bd424ca7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtCompilerOptimization.cmake | 3 | ||||
-rw-r--r-- | cmake/QtInternalTargets.cmake | 4 | ||||
-rw-r--r-- | cmake/QtWasmHelpers.cmake | 5 |
3 files changed, 12 insertions, 0 deletions
diff --git a/cmake/QtCompilerOptimization.cmake b/cmake/QtCompilerOptimization.cmake index 952ace6652..69029a59de 100644 --- a/cmake/QtCompilerOptimization.cmake +++ b/cmake/QtCompilerOptimization.cmake @@ -199,4 +199,7 @@ if(WASM) set(QT_CFLAGS_OPTIMIZE_FULL "-O3") set(QT_CFLAGS_OPTIMIZE_SIZE "-Os") set(QT_CFLAGS_OPTIMIZE_DEBUG "-g2") + + set(QT_CFLAGS_SSE2 -O2 -msimd128 -msse -msse2) + endif() diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 317deb185a..ea4157a8ba 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -177,6 +177,10 @@ if(UIKIT) qt_internal_apply_bitcode_flags(PlatformCommonInternal) endif() +if(WASM AND QT_FEATURE_sse2) + target_compile_definitions(PlatformCommonInternal INTERFACE QT_COMPILER_SUPPORTS_SSE2) +endif() + # Taken from mkspecs/common/msvc-version.conf and mkspecs/common/msvc-desktop.conf if (MSVC) if (MSVC_VERSION GREATER_EQUAL 1799) diff --git a/cmake/QtWasmHelpers.cmake b/cmake/QtWasmHelpers.cmake index 240eaa0540..b80f0d0e18 100644 --- a/cmake/QtWasmHelpers.cmake +++ b/cmake/QtWasmHelpers.cmake @@ -19,6 +19,11 @@ function (qt_internal_setup_wasm_target_properties wasmTarget) target_compile_options("${wasmTarget}" INTERFACE --bind) + #simd + if (QT_FEATURE_sse2) + target_compile_options("${wasmTarget}" INTERFACE -O2 -msimd128 -msse -msse2) + endif() + # Hardcode wasm memory size. Emscripten does not currently support memory growth # (ALLOW_MEMORY_GROWTH) in pthreads mode, and requires specifying the memory size # at build time. Further, browsers limit the maximum initial memory size to 1GB. |