From b02bb2b805c970e6ef90e8e15daafa5d78cb195f Mon Sep 17 00:00:00 2001 From: Paul Khuong Date: Wed, 21 Aug 2019 10:08:10 -0400 Subject: [PATCH] x86/ck_pr: fix register constraint for ck_pr_foo_is_zero setcc works with byte registers, so we want `q` to ensure the low byte register is encodable, not the general `r`. Fixes https://github.com/concurrencykit/ck/issues/142. --- include/gcc/x86/ck_pr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gcc/x86/ck_pr.h b/include/gcc/x86/ck_pr.h index e678e83..8ef8864 100644 --- a/include/gcc/x86/ck_pr.h +++ b/include/gcc/x86/ck_pr.h @@ -239,7 +239,7 @@ CK_PR_FAA_S(8, uint8_t, "xaddb") bool ret; \ __asm__ __volatile__(CK_PR_LOCK_PREFIX I " %0; setz %1" \ : "+m" (*(C *)target), \ - "=rm" (ret) \ + "=qm" (ret) \ : \ : "memory", "cc"); \ return ret; \ @@ -354,7 +354,7 @@ CK_PR_CAS_S(8, uint8_t, "cmpxchgb") : "q" (set), \ "a" (compare) \ : "memory", "cc"); \ - return (bool)z; \ + return z; \ } CK_PR_CAS_O(ptr, void, void *, char, "l", "eax")