From abade3f896634ebf6b9097469a05cb72d8fd7860 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Mon, 17 Aug 2015 01:27:45 +0200 Subject: [PATCH] really fix ARM64 locking --- common_arm64.h | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/common_arm64.h b/common_arm64.h index c4e588d..15987c6 100644 --- a/common_arm64.h +++ b/common_arm64.h @@ -45,29 +45,22 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. static void __inline blas_lock(volatile BLASULONG *address){ - int register ret; - int register tmp; + long register ret; do { while (*address) {YIELDING;}; __asm__ __volatile__( - "1: \n\t" - "ldaxr %2, [%1] \n\t" - "mov %2, #0 \n\t" - "stlxr %w0, %2, [%1] \n\t" - "cbnz %w0, 1b \n\t" - "mov %0 , #0 \n\t" - : "=r"(ret), "=r"(address), "=r"(tmp) - : "1"(address) - : "memory", "%w0" - //, "%r2" , "%r3" - - + "ldaxr %0, [%1] \n\t" + "stlxr w2, %2, [%1] \n\t" + "orr %0, %0, x2 \n\t" + : "=r"(ret) + : "r"(address), "r"(1l) + : "memory", "x2" ); } while (ret); - + MB; } #define BLAS_LOCK_DEFINED -- 2.7.4