[PATCH v2 0/4] MR375: ntdll: Fixes for runtime 64-bit shift functions.

Zebediah Figura (she/her) zfigura at codeweavers.com
Wed Jul 6 21:46:58 CDT 2022


On 7/6/22 10:50, Jinoh Kang (@iamahuman) wrote:
> Jinoh Kang (@iamahuman) commented about dlls/ntdll/large_int.c:
>> +LONGLONG __regs__allshl( LONGLONG a, unsigned char b )
>> +{
>> +    const LARGE_INTEGER x = { .QuadPart = a };
>> +    LARGE_INTEGER ret;
>> +
>> +    if (b >= 64)
>> +        return 0;
>> +
>> +    if (b >= 32)
>> +    {
>> +        ret.HighPart = x.LowPart << (b & 31);
>> +        ret.LowPart = 0;
>> +    }
>> +    else
>> +    {
>> +        ret.HighPart = (x.LowPart >> (32 - b)) | (x.HighPart << b);
> Shall we use intrinsics such as `__ll_lshift` (`shld` instruction)? Ditto for other functions.
> 

I suppose we could, although ideally GCC would just recognize this 
pattern and generate shld.



More information about the wine-devel mailing list