Skip to content

Commit

Permalink
Merge pull request #65 from XieJiSS/patch-1
Browse files Browse the repository at this point in the history
Implement pause support for RISC-V
  • Loading branch information
Lastique authored Jan 15, 2024
2 parents faec57c + ce34f07 commit 62c5ff9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/boost/atomic/detail/pause.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ BOOST_FORCEINLINE void pause() BOOST_NOEXCEPT
__asm__ __volatile__("pause;" : : : "memory");
#elif (defined(__ARM_ARCH) && __ARM_ARCH >= 8) || defined(__ARM_ARCH_8A__) || defined(__aarch64__)
__asm__ __volatile__("yield;" : : : "memory");
#elif defined(__riscv) && __riscv_xlen == 64
#if defined(__riscv_zihintpause)
__asm__ __volatile__("pause" : : : "memory");
#else
/* Encoding of the pause instruction */
__asm__ __volatile__ (".4byte 0x100000F");
#endif
#endif
#endif
}
Expand Down

0 comments on commit 62c5ff9

Please sign in to comment.