OSDN Git Service

metag: Add NPTL support
[uclinux-h8/uClibc.git] / libpthread / nptl / sysdeps / metag / pthread_spin_trylock.S
1 !    Copyright (C) 2013 Imagination Technologies Ltd.
2
3 !    Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
4
5 #include <pthread-errnos.h>
6
7         .text
8         .global _pthread_spin_trylock
9         .type   _pthread_spin_trylock,function
10 _pthread_spin_trylock:
11 1:      MOVT    D0Re0, #HI(#EBUSY)
12         ADD     D0Re0, D0Re0, #LO(#EBUSY)
13         LNKGETD D0Ar2, [D1Ar1]
14         CMP     D0Ar2, #0
15         ADD     D0Ar2, D0Ar2, #1
16         LNKSETDEQ [D1Ar1], D0Ar2
17         BNE     2f
18         DEFR    D0Ar2, TXSTAT
19         ANDT    D0Ar2, D0Ar2, #HI(0x3f000000)
20         CMPT    D0Ar2, #HI(0x02000000)
21         BNZ     1b
22         MOV     D0Re0, #0
23 2:      MOV     PC, D1RtP
24         .size   _pthread_spin_trylock,.-_pthread_spin_trylock