Fix blas_lock for arm64
This commit is contained in:
parent
98965da2e8
commit
1d121852c1
|
@ -43,28 +43,39 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#ifndef ASSEMBLER
|
#ifndef ASSEMBLER
|
||||||
|
|
||||||
|
|
||||||
static void __inline blas_lock(volatile BLASULONG *address){
|
static void __inline blas_lock(volatile BLASULONG *address){
|
||||||
|
|
||||||
long register ret;
|
BLASULONG ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
while (*address) {YIELDING;};
|
while (*address) {YIELDING;};
|
||||||
|
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
"ldaxr %0, [%1] \n\t"
|
"mov x4, #1 \n\t"
|
||||||
"stlxr w2, %2, [%1] \n\t"
|
"1: \n\t"
|
||||||
"orr %0, %0, x2 \n\t"
|
"ldaxr x2, [%1] \n\t"
|
||||||
: "=r"(ret)
|
"cbnz x2, 1b \n\t"
|
||||||
: "r"(address), "r"(1l)
|
"2: \n\t"
|
||||||
: "memory", "x2"
|
"stxr w3, x4, [%1] \n\t"
|
||||||
|
"cbnz w3, 1b \n\t"
|
||||||
|
"mov %0, #0 \n\t"
|
||||||
|
: "=r"(ret), "=r"(address)
|
||||||
|
: "1"(address)
|
||||||
|
: "memory", "x2" , "x3", "x4"
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
} while (ret);
|
} while (ret);
|
||||||
MB;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BLAS_LOCK_DEFINED
|
#define BLAS_LOCK_DEFINED
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static inline int blas_quickdivide(blasint x, blasint y){
|
static inline int blas_quickdivide(blasint x, blasint y){
|
||||||
return x / y;
|
return x / y;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue