[PATCH] powerpc64le: add optimized strlen for P9
Paul E Murphy
murphyp@linux.ibm.com
Fri Jun 5 20:39:47 GMT 2020
On 6/4/20 8:55 AM, Paul E Murphy wrote:
>
>
> On 6/3/20 3:44 PM, Paul A. Clarke wrote:
>>> + vctzlsbb r3,v6
>>> + blr
>>> +
>>> + /* Test 64B 16B at a time. The 64B vector loop is optimized for
>>> + longer strings. Likewise, we check a multiple of 64B to avoid
>>> + breaking the alignment calculation below. */
>>> +L(aligned):
>>> + add r4,r3,r9
>>> + rldicl. r5,r4,60,62 /* Determine the number of 48B loops
>>> needed for
>>> + alignment to 64B. And test for
>>> zero. */
>>
>> Would it be bad to move the "rldicl." down...
>>
>>> +
>>> + lxv v0+32,0(r4)
>>> + vcmpequb. v6,v0,v18
>>> + bne cr6,L(tail1)
>>> +
>>> + lxv v0+32,16(r4)
>>> + vcmpequb. v6,v0,v18
>>> + bne cr6,L(tail2)
>>> +
>>> + lxv v0+32,32(r4)
>>> + vcmpequb. v6,v0,v18
>>> + bne cr6,L(tail3)
>>> +
>>> + lxv v0+32,48(r4)
>>> + vcmpequb. v6,v0,v18
>>> + bne cr6,L(tail4)
>>
>> ...to here, to avoid needlessly penalizing the cases above?
>
> My thinking is the integer op is basically free while we're busy
> executing vector ops (similarly for li). Likewise, this may put enough
> space between the conditional branch below to ease prediction. I don't
> claim to have run this against a cycle accurate simulator, so it may not
> really matter.
>
> Similarly, binutils 2.26 should support all P9 instructions here and in
> Anton's other patches. I did check before pushing the rawmemchr/stpcpy.
And pushed with extra space removed and rewritten comment for li r0,0.
Thank you for the feedback Paul.
More information about the Libc-alpha
mailing list