|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] x86/atomic: Improvements and simplifications to assembly constraints
>>> On 22.11.18 at 14:58, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 22/11/2018 13:19, Jan Beulich wrote:
>>>>> On 22.11.18 at 13:38, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> On 22/11/2018 08:57, Jan Beulich wrote:
>>>> >>> On 21.11.18 at 20:37, <andrew.cooper3@xxxxxxxxxx> wrote:
>>>>> @@ -79,31 +72,27 @@ static always_inline unsigned long __cmpxchg(
>>>>> switch ( size )
>>>>> {
>>>>> case 1:
>>>>> - asm volatile ( "lock; cmpxchgb %b1,%2"
>>>>> - : "=a" (prev)
>>>>> - : "q" (new), "m" (*__xg(ptr)),
>>>>> - "0" (old)
>>>>> + asm volatile ( "lock; cmpxchg %b[new], %[ptr]"
>>>>> + : "=a" (prev), [ptr] "+m" (*(uint8_t *)ptr)
>>>>> + : [new] "r" (new), "0" (old)
>>>> Any reason you retain the reference by number in the input
>>>> constraint here, rather than giving its corresponding output
>>>> one a name?
>>> Not specifically. I suppose this is doable because the constraint is an
>>> explicitly register.
>> I don't understand: What does register or no have to do with
>> it? Did you perhaps misunderstand? I'm asking for [prev] "a" (prev)
>> and then "[prev]" (old).
>
> Hmm - I'd forgotten that syntax, but I'm still not going to do it like that.
>
> Using "=a" (prev) : "a" (old) is fine, and slightly better than what we
> have currently. It also closely matches how the instruction is
> described in the manual, whereas using "[prev]" (old) is longer, and
> adds a level of indirection which makes the code harder to follow.
Fine with me - all I'm after it to see the "0" gone.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |