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){
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