Skip to content

Commit e94590e

Browse files
authored
Merge pull request #2468 from AGSaidi/wfe
Use wait-for-event to not spin in the blas_lock
2 parents 69d4687 + 0af9991 commit e94590e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

common_arm64.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ static void __inline blas_lock(volatile BLASULONG *address){
5353
BLASULONG ret;
5454

5555
do {
56-
while (*address) {YIELDING;};
57-
5856
__asm__ __volatile__(
5957
"mov x4, #1 \n\t"
58+
"sevl \n\t"
6059
"1: \n\t"
60+
"wfe \n\t"
61+
"2: \n\t"
6162
"ldaxr x2, [%1] \n\t"
6263
"cbnz x2, 1b \n\t"
63-
"2: \n\t"
6464
"stxr w3, x4, [%1] \n\t"
65-
"cbnz w3, 1b \n\t"
65+
"cbnz w3, 2b \n\t"
6666
"mov %0, #0 \n\t"
6767
: "=r"(ret), "=r"(address)
6868
: "1"(address)

0 commit comments

Comments
 (0)