This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Rewrite x86-64 IFUNC selector in C


On Wed, Jun 7, 2017 at 5:01 PM, Erich Elsen <eriche@google.com> wrote:
> Here's a patch for memcmp.

The patch has many issues,  I fixed it on hjl/ifunc/c branch.

> I haven't investigated that.  I don't think I understand the implications.

Many string/memory functions used internally by glibc aren't the best
for the processor.  Only SSE2 version is used.  If IFUNC is used, the
best one will be used, but it will be called indirectly via PLT.

> On Wed, Jun 7, 2017 at 3:21 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Jun 7, 2017 at 1:39 PM, Erich Elsen <eriche@google.com> wrote:
>>> Here's a patch that also moves memset.S to memset.c.
>>
>> I integrated your patch into hjl/ifunc/c branch.  Thanks.
>>
>> BTW, have you investigated using IFUNC internally in libc,so?
>>
>>> On Tue, May 30, 2017 at 1:32 PM, Adhemerval Zanella
>>> <adhemerval.zanella@linaro.org> wrote:
>>>>
>>>>
>>>> On 30/05/2017 17:13, H.J. Lu wrote:
>>>>> On Tue, May 30, 2017 at 12:50 PM, Adhemerval Zanella
>>>>> <adhemerval.zanella@linaro.org> wrote:
>>>>>>
>>>>>>
>>>>>> On 30/05/2017 13:24, H.J. Lu wrote:
>>>>>>> On Mon, May 29, 2017 at 1:34 PM, Adhemerval Zanella
>>>>>>> <adhemerval.zanella@linaro.org> wrote:
>>>>>>>>
>>>>>>>> I think we can simplify it further and use the already existent ifunc macros on
>>>>>>>> libc-symbols.h.  Also, for memmove I think we can organize the code better (at
>>>>>>>> least for ifunc) and build a extra object with a more meaningful name.  I used
>>>>>>>> your logic for the ifunc selection and extended for memmove as well.
>>>>>>>>
>>>>>>> Here is the combined patch.
>>>>>>
>>>>>>
>>>>>>> diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
>>>>>>> index 3736f54..8a6ff00 100644
>>>>>>> --- a/sysdeps/x86_64/multiarch/Makefile
>>>>>>> +++ b/sysdeps/x86_64/multiarch/Makefile
>>>>>>> @@ -19,6 +19,7 @@ sysdep_routines += strncat-c stpncpy-c strncpy-c strcmp-ssse3 \
>>>>>>>                  strchr-sse2-no-bsf memcmp-ssse3 strstr-sse2-unaligned \
>>>>>>>                  strcspn-c strpbrk-c strspn-c varshift \
>>>>>>>                  memset-avx512-no-vzeroupper \
>>>>>>> +                memmove-sse2-unaligned-erms \
>>>>>>
>>>>>> I still think this is a misleading name file since it build not only memmove but
>>>>>> also memcpy and mempcpy implementations.  I would prefer to rename to a more
>>>>>> general name as in my suggestion.
>>>>>
>>>>> I'd like to keep it consistent with memmove-avx-unaligned-erms.S and
>>>>> memmove-avx512-unaligned-erms.S.   As for making memcpy an alias
>>>>> of memmove, and embedding mempcpy, __memcpy_chk,
>>>>> __mempcpy_chk, __memmove_chk is an implementation detail.
>>>>>
>>>>
>>>> Alright, at least I think it should add some comments that the object
>>>> is building multiple symbols (it wasn't clear when I started to work
>>>> on the patch).
>>
>>
>>
>> --
>> H.J.



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]