Skip to content

Commit

Permalink
sse2 mm_pause: more archs, add a basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Nov 13, 2023
1 parent 643c419 commit 692a2e8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions simde/x86/sse2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions test/x86/sse2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 692a2e8

Please sign in to comment.