From ef3813fc1eaeb739a43b00032f06a870ff22105a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Fri, 7 Oct 2022 12:00:22 +0200 Subject: [PATCH] wasm: add wasm_simd configure feature Add Qt configure feature for enabling WebAssembly SIMD usage: ./configure ... -feature-wasm-simd128 Enabling this feature makes Qt add the -msimd128 flag to the compile options, which enables SIMD instruction usage for the compiler. (This should not be confused with the previously added SSE SIMD support, which uses Emscripten's support for translating SSE SIMD to WASM SIMD) Change-Id: I84a36ccef8abf9199c304d68ce371c6b1747b832 Reviewed-by: David Skoland Reviewed-by: Alexandru Croitor --- cmake/QtWasmHelpers.cmake | 3 +++ configure.cmake | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/cmake/QtWasmHelpers.cmake b/cmake/QtWasmHelpers.cmake index 96d3edbeb3a..20d4bc5c29d 100644 --- a/cmake/QtWasmHelpers.cmake +++ b/cmake/QtWasmHelpers.cmake @@ -22,6 +22,9 @@ function (qt_internal_setup_wasm_target_properties wasmTarget) "SHELL:-s EXPORT_NAME=createQtAppInstance") #simd + if (QT_FEATURE_wasm_simd128) + target_compile_options("${wasmTarget}" INTERFACE -msimd128) + endif() if (QT_FEATURE_sse2) target_compile_options("${wasmTarget}" INTERFACE -O2 -msimd128 -msse -msse2) endif() diff --git a/configure.cmake b/configure.cmake index 91a3df5f337..eaa642f4710 100644 --- a/configure.cmake +++ b/configure.cmake @@ -928,6 +928,14 @@ qt_feature("arm_crypto" PRIVATE ) qt_feature_definition("arm_crypto" "QT_COMPILER_SUPPORTS_AES" VALUE "1") qt_feature_config("arm_crypto" QMAKE_PRIVATE_CONFIG) + +qt_feature("wasm_simd128" PRIVATE + LABEL "WebAssembly SIMD128" + AUTODETECT OFF +) +qt_feature_definition("wasm_simd128" "QT_COMPILER_SUPPORTS_WASM_SIMD128" VALUE "1") +qt_feature_config("wasm_simd128" QMAKE_PRIVATE_CONFIG) + qt_feature("posix_fallocate" PRIVATE LABEL "POSIX fallocate()" CONDITION TEST_posix_fallocate @@ -1155,6 +1163,10 @@ qt_configure_add_summary_entry(ARGS "relocatable") qt_configure_add_summary_entry(ARGS "precompile_header") qt_configure_add_summary_entry(ARGS "ltcg") qt_configure_add_summary_entry(ARGS "intelcet") +qt_configure_add_summary_entry( + ARGS "wasm_simd128" + CONDITION ( TEST_architecture_arch STREQUAL wasm ) +) qt_configure_add_summary_section(NAME "Target compiler supports") qt_configure_add_summary_entry( TYPE "featureList"