From 692a2e827bb9ddabbf877bea6af0d2b4656651bb Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Mon, 13 Nov 2023 10:21:25 +0100 Subject: [PATCH] sse2 mm_pause: more archs, add a basic test --- simde/x86/sse2.h | 18 ++++++++++++++++++ test/x86/sse2.c | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/simde/x86/sse2.h b/simde/x86/sse2.h index 96a8163b6..024fe26ac 100644 --- a/simde/x86/sse2.h +++ b/simde/x86/sse2.h @@ -4770,6 +4770,24 @@ void simde_mm_pause (void) { #if defined(SIMDE_X86_SSE2_NATIVE) _mm_pause(); + #elif defined(SIMDE_ARCH_X86) + __asm__ __volatile__("pause"); + #elif defined(SIMDE_ARCH_ARM_NEON) + #if defined(_MSC_VER) + __isb(_ARM64_BARRIER_SY); + #else + __asm__ __volatile__("isb\n"); + #endif + #elif defined(SIMDE_ARCH_POWER) + __asm__ __volatile__ ("or 27,27,27" ::: "memory"); + #elif defined(SIMDE_ARCH_WASM) + __asm__ __volatile__ ("nop"); + #elif defined(HEDLEY_GCC_VERSION) + #if defined(SIMDE_ARCH_RISCV) + __builtin_riscv_pause(); + #else + __asm__ __volatile__ ("nop" ::: "memory"); + #endif #endif } #if defined(SIMDE_X86_SSE2_ENABLE_NATIVE_ALIASES) diff --git a/test/x86/sse2.c b/test/x86/sse2.c index 085a74d9a..ae44eaf91 100644 --- a/test/x86/sse2.c +++ b/test/x86/sse2.c @@ -6142,6 +6142,12 @@ test_simde_mm_packus_epi16(SIMDE_MUNIT_TEST_ARGS) { return 0; } +static int +test_simde_mm_pause(SIMDE_MUNIT_TEST_ARGS) { + simde_mm_pause(); + return 0; +} + static int test_simde_mm_sad_epu8(SIMDE_MUNIT_TEST_ARGS) { const struct { @@ -10687,6 +10693,8 @@ SIMDE_TEST_FUNC_LIST_BEGIN SIMDE_TEST_FUNC_LIST_ENTRY(mm_packs_epi32) SIMDE_TEST_FUNC_LIST_ENTRY(mm_packus_epi16) + SIMDE_TEST_FUNC_LIST_ENTRY(mm_pause) + SIMDE_TEST_FUNC_LIST_ENTRY(mm_undefined_pd) SIMDE_TEST_FUNC_LIST_ENTRY(mm_undefined_si128)