Merge pull request #617 from notaz/arm_fixes

really fix ARM64 locking
This commit is contained in:
Zhang Xianyi 2015-08-17 15:22:37 -05:00
commit 4b7381b7a4
1 changed files with 8 additions and 15 deletions

View File

@ -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){ static void __inline blas_lock(volatile BLASULONG *address){
int register ret; long register ret;
int register tmp;
do { do {
while (*address) {YIELDING;}; while (*address) {YIELDING;};
__asm__ __volatile__( __asm__ __volatile__(
"1: \n\t" "ldaxr %0, [%1] \n\t"
"ldaxr %2, [%1] \n\t" "stlxr w2, %2, [%1] \n\t"
"mov %2, #0 \n\t" "orr %0, %0, x2 \n\t"
"stlxr %w0, %2, [%1] \n\t" : "=r"(ret)
"cbnz %w0, 1b \n\t" : "r"(address), "r"(1l)
"mov %0 , #0 \n\t" : "memory", "x2"
: "=r"(ret), "=r"(address), "=r"(tmp)
: "1"(address)
: "memory", "%w0"
//, "%r2" , "%r3"
); );
} while (ret); } while (ret);
MB;
} }
#define BLAS_LOCK_DEFINED #define BLAS_LOCK_DEFINED