8330242: RISC-V: Simplify and remove CORRECT_COMPILER_ATOMIC_SUPPORT in atomic_linux_riscv.hpp
Reviewed-by: fyang, rehn
This commit is contained in:
parent
e57a322d70
commit
cd4c3aac63
@ -35,16 +35,10 @@
|
|||||||
|
|
||||||
#if defined(__clang_major__)
|
#if defined(__clang_major__)
|
||||||
#define FULL_COMPILER_ATOMIC_SUPPORT
|
#define FULL_COMPILER_ATOMIC_SUPPORT
|
||||||
#elif (__GNUC__ > 13) || ((__GNUC__ == 13) && (__GNUC_MINOR__ >= 2))
|
#elif (__GNUC__ > 13) || ((__GNUC__ == 13) && (__GNUC_MINOR__ > 2))
|
||||||
#define FULL_COMPILER_ATOMIC_SUPPORT
|
#define FULL_COMPILER_ATOMIC_SUPPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__clang_major__)
|
|
||||||
#define CORRECT_COMPILER_ATOMIC_SUPPORT
|
|
||||||
#elif defined(__GNUC__) && (__riscv_xlen <= 32 || __GNUC__ > 13)
|
|
||||||
#define CORRECT_COMPILER_ATOMIC_SUPPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<size_t byte_size>
|
template<size_t byte_size>
|
||||||
struct Atomic::PlatformAdd {
|
struct Atomic::PlatformAdd {
|
||||||
template<typename D, typename I>
|
template<typename D, typename I>
|
||||||
@ -120,9 +114,9 @@ inline T Atomic::PlatformCmpxchg<1>::operator()(T volatile* dest __attribute__((
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CORRECT_COMPILER_ATOMIC_SUPPORT
|
#ifndef FULL_COMPILER_ATOMIC_SUPPORT
|
||||||
// The implementation of `__atomic_compare_exchange` lacks sign extensions
|
// The implementation of `__atomic_compare_exchange` lacks sign extensions
|
||||||
// in GCC 13 and lower when using with 32-bit unsigned integers on RV64,
|
// in GCC 13.2 and lower when using with 32-bit unsigned integers on RV64,
|
||||||
// so we should implement it manually.
|
// so we should implement it manually.
|
||||||
// GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114130.
|
// GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114130.
|
||||||
// See also JDK-8326936.
|
// See also JDK-8326936.
|
||||||
@ -192,11 +186,7 @@ inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T volatile* dest __attri
|
|||||||
atomic_memory_order order) const {
|
atomic_memory_order order) const {
|
||||||
|
|
||||||
#ifndef FULL_COMPILER_ATOMIC_SUPPORT
|
#ifndef FULL_COMPILER_ATOMIC_SUPPORT
|
||||||
STATIC_ASSERT(byte_size >= 4);
|
STATIC_ASSERT(byte_size > 4);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CORRECT_COMPILER_ATOMIC_SUPPORT
|
|
||||||
STATIC_ASSERT(byte_size != 4);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STATIC_ASSERT(byte_size == sizeof(T));
|
STATIC_ASSERT(byte_size == sizeof(T));
|
||||||
@ -235,6 +225,5 @@ struct Atomic::PlatformOrderedStore<byte_size, RELEASE_X_FENCE>
|
|||||||
};
|
};
|
||||||
|
|
||||||
#undef FULL_COMPILER_ATOMIC_SUPPORT
|
#undef FULL_COMPILER_ATOMIC_SUPPORT
|
||||||
#undef CORRECT_COMPILER_ATOMIC_SUPPORT
|
|
||||||
|
|
||||||
#endif // OS_CPU_LINUX_RISCV_ATOMIC_LINUX_RISCV_HPP
|
#endif // OS_CPU_LINUX_RISCV_ATOMIC_LINUX_RISCV_HPP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user