Skip to content

Commit

Permalink
feat(compat): support riscv. Thanks wangzhankun
Browse files Browse the repository at this point in the history
  • Loading branch information
Codesire-Deng committed Nov 9, 2023
1 parent 6adaa37 commit 19f2d06
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions include/co_context/detail/compat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
#endif

#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
#define CO_CONTEXT_PAUSE __builtin_ia32_pause
#if defined(__i386__) || defined(__x86_64__)
#define CO_CONTEXT_PAUSE() __builtin_ia32_pause()
#elif defined(__riscv)
#define CO_CONTEXT_PAUSE() __asm__ volatile("fence iorw, iorw")
#endif
#elif defined(_MSC_VER)
#define CO_CONTEXT_PAUSE _mm_pause
#define CO_CONTEXT_PAUSE() _mm_pause()
#else
#define CO_CONTEXT_PAUSE __builtin_ia32_pause
#define CO_CONTEXT_PAUSE() __builtin_ia32_pause()
#endif

#if (defined(__GNUC__) || defined(__GNUG__)) \
Expand Down

0 comments on commit 19f2d06

Please sign in to comment.