diff options
author | Lorn Potter <lorn.potter@gmail.com> | 2021-04-16 15:34:57 +1000 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-10-05 01:30:16 +0000 |
commit | 01fe5aaeea74cc25d4052fec0be6d7d03e0faec0 (patch) | |
tree | f29c53f354741b3607c2bf2a5475fa8043a3e4df /src | |
parent | dfe98121e9bbc769d06949a7d2ec6e57ae86d0b7 (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
Fixes: QTBUG-63924
Change-Id: Ifeafae20e199dee0d19689802ad20fd0bd424ca7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 0e100a4d892cbdcdb7f326213ec1e4d0d1ae6d89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qprocessordetection.h | 4 | ||||
-rw-r--r-- | src/corelib/global/qsimd_p.h | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index f7bca43345..72cc0b4ad4 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -340,6 +340,10 @@ # define Q_PROCESSOR_WASM # define Q_BYTE_ORDER Q_LITTLE_ENDIAN # define Q_PROCESSOR_WORDSIZE 8 +#ifdef QT_COMPILER_SUPPORTS_SSE2 +# define Q_PROCESSOR_X86 6 // enables SIMD support +#endif + #endif /* diff --git a/src/corelib/global/qsimd_p.h b/src/corelib/global/qsimd_p.h index 35979176fa..118a62e6ac 100644 --- a/src/corelib/global/qsimd_p.h +++ b/src/corelib/global/qsimd_p.h @@ -190,10 +190,13 @@ # define __SSE__ 1 # endif -# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) +# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_OS_WASM) // GCC 4.4 and Clang 2.8 added a few more intrinsics there # include <x86intrin.h> # endif +#ifdef Q_OS_WASM +# include <immintrin.h> +# endif # if defined(__SSE4_2__) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS) && (defined(Q_CC_INTEL) || defined(Q_CC_MSVC)) // POPCNT instructions: |