Skip to content

Skip Intel x86 SSE tests on ARM64 platforms that cannot natively compile SSE code. #24432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import json
import logging
import os
import platform
import random
import re
import shutil
Expand Down Expand Up @@ -139,6 +140,18 @@ def decorated(self, *args, **kwargs):
return decorated


def requires_x64_cpu(func):
assert callable(func)

@wraps(func)
def decorated(self, *args, **kwargs):
if platform.machine().lower() not in ['x86_64', 'amd64']:
return self.skipTest(f'This test requires a native x64 CPU. Current CPU is {platform.machine()}.')
return func(self, *args, **kwargs)

return decorated


def with_dylink_reversed(func):
assert callable(func)

Expand Down Expand Up @@ -6537,6 +6550,7 @@ def test_neon_wasm_simd(self):
@wasm_simd
@crossplatform
@requires_native_clang
@requires_x64_cpu
@no_safe_heap('has unaligned 64-bit operations in wasm')
@no_ubsan('test contains UB')
@parameterized({
Expand All @@ -6556,6 +6570,7 @@ def test_sse1(self, args):
# Tests invoking the SIMD API via x86 SSE2 emmintrin.h header (_mm_x() functions)
@wasm_simd
@requires_native_clang
@requires_x64_cpu
@no_safe_heap('has unaligned 64-bit operations in wasm')
@is_slow_test
@no_ubsan('https://github.com/emscripten-core/emscripten/issues/19688')
Expand All @@ -6578,6 +6593,7 @@ def test_sse2(self, args):
# Tests invoking the SIMD API via x86 SSE3 pmmintrin.h header (_mm_x() functions)
@wasm_simd
@requires_native_clang
@requires_x64_cpu
def test_sse3(self):
src = test_file('sse/test_sse3.cpp')
self.run_process([shared.CLANG_CXX, src, '-msse3', '-Wno-argument-outside-range', '-o', 'test_sse3', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
Expand All @@ -6590,6 +6606,7 @@ def test_sse3(self):
# Tests invoking the SIMD API via x86 SSSE3 tmmintrin.h header (_mm_x() functions)
@wasm_simd
@requires_native_clang
@requires_x64_cpu
def test_ssse3(self):
src = test_file('sse/test_ssse3.cpp')
self.run_process([shared.CLANG_CXX, src, '-mssse3', '-Wno-argument-outside-range', '-o', 'test_ssse3', '-D_CRT_SECURE_NO_WARNINGS=1'] + clang_native.get_clang_native_args(), stdout=PIPE)
Expand All @@ -6603,6 +6620,7 @@ def test_ssse3(self):
@no_ubsan('https://github.com/emscripten-core/emscripten/issues/19749')
@wasm_simd
@requires_native_clang
@requires_x64_cpu
@is_slow_test
def test_sse4_1(self):
if self.is_wasm64():
Expand All @@ -6622,6 +6640,7 @@ def test_sse4_1(self):
# Tests invoking the SIMD API via x86 SSE4.2 nmmintrin.h header (_mm_x() functions)
@wasm_simd
@requires_native_clang
@requires_x64_cpu
@parameterized({
'': (False,),
'2': (True,),
Expand All @@ -6639,6 +6658,7 @@ def test_sse4(self, use_4_2):
# Tests invoking the SIMD API via x86 AVX avxintrin.h header (_mm_x() functions)
@wasm_simd
@requires_native_clang
@requires_x64_cpu
@is_slow_test
@no_asan('local count too large')
@no_ubsan('local count too large')
Expand All @@ -6658,6 +6678,7 @@ def test_avx(self, args):
# Tests invoking the SIMD API via x86 AVX2 avx2intrin.h header (_mm_x()/_mm256_x() functions)
@wasm_simd
@requires_native_clang
@requires_x64_cpu
@is_slow_test
@no_asan('local count too large')
@no_ubsan('local count too large')
Expand All @@ -6684,7 +6705,6 @@ def test_sse_diagnostics(self):
stderr=PIPE)
self.assertContained('Instruction emulated via slow path.', p.stderr)

@requires_native_clang
@wasm_relaxed_simd
def test_relaxed_simd_implies_simd128(self):
src = test_file('sse/test_sse1.cpp')
Expand Down