[aarch64-port-dev ] Fix string_compare for chars that have the top bit set

Andrew Haley aph at redhat.com
Fri Jul 4 10:21:12 UTC 2014


On 07/04/2014 11:10 AM, Edward Nevill wrote:
> I believe the following generate the required result in all cases.
> 
>     rev(rscratch2, rscratch2);
>     clz(rscratch2, rscratch2);
>     andr(rscratch2, rscratch2, -16);
>     lsrv(result, result, rscratch2);
>     uxth(result, result);
>     lsrv(cnt1, cnt1, rscratch2);
>     uxth(cnt1, cnt1);
>     subw(result, result, cnt1);
> 
> IE. we zero extend the characters and then do the subtraction.

Yes, I think you're right.

It doesn't make any practical difference, but we are working on words
rather than xwords, so I kinda think that should be

>     uxthw(result, result);
>     lsrv(cnt1, cnt1, rscratch2);
>     uxthw(cnt1, cnt1);
>     subw(result, result, cnt1);

But that's up to you if you strongly disagree.  Approved.

Andrew.



More information about the aarch64-port-dev mailing list