This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] x86: Merge i386/x86_64 atomic-machine.h
On 17/12/2018 21:38, H.J. Lu wrote:
> On Mon, Dec 17, 2018 at 11:44 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>>
>> On 12/12/2018 19:36, H.J. Lu wrote:
>>> Merge i386 and x86_64 atomic-machine.h to x86 atomic-machine.h.
>>>
>>> Tested on i686 and x86_64 as well as with build-many-glibcs.py. There
>>> are no code changes in libc.so, ld.so and libpthread.so on i686 and
>>> x86_64.
>>>
>>> * sysdeps/i386/atomic-machine.h: Merged with ...
>>> * sysdeps/x86_64/atomic-machine.h: To ...
>>> * sysdeps/x86/atomic-machine.h: This. New file.
>>
>> LGTM with the only expection where I am not sure how to handle invalid
>> sizes for x86_32 (comments below).
>>
>
>>> -#define __HAVE_64B_ATOMICS 1
>>> -#define USE_ATOMIC_COMPILER_BUILTINS 1
>>> -#define ATOMIC_EXCHANGE_USES_CAS 0
>>> +#ifdef __x86_64__
>>> +# define __HAVE_64B_ATOMICS 1
>>> +# define USE_ATOMIC_COMPILER_BUILTINS 1
>>> +# define SP_REG "rsp"
>>> +# define SEG_REG "fs"
>>> +# define BR_CONSTRAINT "q"
>>> +# define IBR_CONSTRAINT "iq"
>>> +#else
>>> +# define __HAVE_64B_ATOMICS 0
>>> +# define USE_ATOMIC_COMPILER_BUILTINS 0
>>> +# define SP_REG "esp"
>>> +# define SEG_REG "gs"
>>> +# define BR_CONSTRAINT "r"
>>> +# define IBR_CONSTRAINT "ir"
>>> +#endif
>>> +#define ATOMIC_EXCHANGE_USES_CAS 0
>>
>> Ok. As a side note, do you if we can use atomic compiler builtins for x86_32?
>>
>
>>
>> The generic include/atomic.h explicit add a linker error (__atomic_link_error)
>> when size is not supported. Since it is currently not used internally, I think
>> we can make for x86 atomic.
>>
>
> Here is the updated patch. The differences are
>
> 1. Define USE_ATOMIC_COMPILER_BUILTINS to 1 for x86.
> 2. Replace __builtin_unreachable with __atomic_link_error.
>
> OK for master?
>
LGTM, thanks.