Skip to content

Commit 08c5844

Browse files
wangzwmy-ship-it
authored andcommitted
Add LoongArch(loongarch64) support to s_lock.h
1 parent 76eeb02 commit 08c5844

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/include/storage/s_lock.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,24 @@ tas(volatile slock_t *lock)
625625

626626
#endif /* __vax__ */
627627

628+
#if defined(__loongarch__)
629+
#ifdef HAVE_GCC__SYNC_INT32_TAS
630+
#define HAS_TEST_AND_SET
631+
632+
#define TAS(lock) tas(lock)
633+
634+
typedef int slock_t;
635+
636+
static __inline__ int
637+
tas(volatile slock_t *lock)
638+
{
639+
return __sync_lock_test_and_set(lock, 1);
640+
}
641+
642+
#define S_UNLOCK(lock) __sync_lock_release(lock)
643+
644+
#endif /* HAVE_GCC__SYNC_INT32_TAS */
645+
#endif /* __loongarch__ */
628646

629647
#if defined(__mips__) && !defined(__sgi) /* non-SGI MIPS */
630648
#define HAS_TEST_AND_SET

0 commit comments

Comments
 (0)