Skip to content

Commit d0f1ed6

Browse files
authored
Skip Intel x86 SSE tests on ARM64 platforms that cannot natively compile SSE code. (#24432)
Also remove one case of @requires_native_clang that wasn't needed.
1 parent 564ec88 commit d0f1ed6

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/test_core.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import json
77
import logging
88
import os
9+
import platform
910
import random
1011
import re
1112
import shutil
@@ -139,6 +140,18 @@ def decorated(self, *args, **kwargs):
139140
return decorated
140141

141142

143+
def requires_x64_cpu(func):
144+
assert callable(func)
145+
146+
@wraps(func)
147+
def decorated(self, *args, **kwargs):
148+
if platform.machine().lower() not in ['x86_64', 'amd64']:
149+
return self.skipTest(f'This test requires a native x64 CPU. Current CPU is {platform.machine()}.')
150+
return func(self, *args, **kwargs)
151+
152+
return decorated
153+
154+
142155
def with_dylink_reversed(func):
143156
assert callable(func)
144157

@@ -6537,6 +6550,7 @@ def test_neon_wasm_simd(self):
65376550
@wasm_simd
65386551
@crossplatform
65396552
@requires_native_clang
6553+
@requires_x64_cpu
65406554
@no_safe_heap('has unaligned 64-bit operations in wasm')
65416555
@no_ubsan('test contains UB')
65426556
@parameterized({
@@ -6556,6 +6570,7 @@ def test_sse1(self, args):
65566570
# Tests invoking the SIMD API via x86 SSE2 emmintrin.h header (_mm_x() functions)
65576571
@wasm_simd
65586572
@requires_native_clang
6573+
@requires_x64_cpu
65596574
@no_safe_heap('has unaligned 64-bit operations in wasm')
65606575
@is_slow_test
65616576
@no_ubsan('https://github.com/emscripten-core/emscripten/issues/19688')
@@ -6578,6 +6593,7 @@ def test_sse2(self, args):
65786593
# Tests invoking the SIMD API via x86 SSE3 pmmintrin.h header (_mm_x() functions)
65796594
@wasm_simd
65806595
@requires_native_clang
6596+
@requires_x64_cpu
65816597
def test_sse3(self):
65826598
src = test_file('sse/test_sse3.cpp')
65836599
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)
@@ -6590,6 +6606,7 @@ def test_sse3(self):
65906606
# Tests invoking the SIMD API via x86 SSSE3 tmmintrin.h header (_mm_x() functions)
65916607
@wasm_simd
65926608
@requires_native_clang
6609+
@requires_x64_cpu
65936610
def test_ssse3(self):
65946611
src = test_file('sse/test_ssse3.cpp')
65956612
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)
@@ -6603,6 +6620,7 @@ def test_ssse3(self):
66036620
@no_ubsan('https://github.com/emscripten-core/emscripten/issues/19749')
66046621
@wasm_simd
66056622
@requires_native_clang
6623+
@requires_x64_cpu
66066624
@is_slow_test
66076625
def test_sse4_1(self):
66086626
if self.is_wasm64():
@@ -6622,6 +6640,7 @@ def test_sse4_1(self):
66226640
# Tests invoking the SIMD API via x86 SSE4.2 nmmintrin.h header (_mm_x() functions)
66236641
@wasm_simd
66246642
@requires_native_clang
6643+
@requires_x64_cpu
66256644
@parameterized({
66266645
'': (False,),
66276646
'2': (True,),
@@ -6639,6 +6658,7 @@ def test_sse4(self, use_4_2):
66396658
# Tests invoking the SIMD API via x86 AVX avxintrin.h header (_mm_x() functions)
66406659
@wasm_simd
66416660
@requires_native_clang
6661+
@requires_x64_cpu
66426662
@is_slow_test
66436663
@no_asan('local count too large')
66446664
@no_ubsan('local count too large')
@@ -6658,6 +6678,7 @@ def test_avx(self, args):
66586678
# Tests invoking the SIMD API via x86 AVX2 avx2intrin.h header (_mm_x()/_mm256_x() functions)
66596679
@wasm_simd
66606680
@requires_native_clang
6681+
@requires_x64_cpu
66616682
@is_slow_test
66626683
@no_asan('local count too large')
66636684
@no_ubsan('local count too large')
@@ -6684,7 +6705,6 @@ def test_sse_diagnostics(self):
66846705
stderr=PIPE)
66856706
self.assertContained('Instruction emulated via slow path.', p.stderr)
66866707

6687-
@requires_native_clang
66886708
@wasm_relaxed_simd
66896709
def test_relaxed_simd_implies_simd128(self):
66906710
src = test_file('sse/test_sse1.cpp')

0 commit comments

Comments
 (0)