Merge pull request #2468 from AGSaidi/wfe
Use wait-for-event to not spin in the blas_lock
This commit is contained in:
commit
e94590e400
|
@ -53,16 +53,16 @@ static void __inline blas_lock(volatile BLASULONG *address){
|
||||||
BLASULONG ret;
|
BLASULONG ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
while (*address) {YIELDING;};
|
|
||||||
|
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
"mov x4, #1 \n\t"
|
"mov x4, #1 \n\t"
|
||||||
|
"sevl \n\t"
|
||||||
"1: \n\t"
|
"1: \n\t"
|
||||||
|
"wfe \n\t"
|
||||||
|
"2: \n\t"
|
||||||
"ldaxr x2, [%1] \n\t"
|
"ldaxr x2, [%1] \n\t"
|
||||||
"cbnz x2, 1b \n\t"
|
"cbnz x2, 1b \n\t"
|
||||||
"2: \n\t"
|
|
||||||
"stxr w3, x4, [%1] \n\t"
|
"stxr w3, x4, [%1] \n\t"
|
||||||
"cbnz w3, 1b \n\t"
|
"cbnz w3, 2b \n\t"
|
||||||
"mov %0, #0 \n\t"
|
"mov %0, #0 \n\t"
|
||||||
: "=r"(ret), "=r"(address)
|
: "=r"(ret), "=r"(address)
|
||||||
: "1"(address)
|
: "1"(address)
|
||||||
|
|
Loading…
Reference in New Issue