Re: [RFC PATCH v2 2/7] arm64/runtime-const: Introduce runtime_const_mask_32()
From: K Prateek Nayak
Date: Mon Mar 16 2026 - 13:12:02 EST
Hello David,
On 3/16/2026 5:20 PM, David Laight wrote:
>> Introduce runtime_const_mask_32 to further optimize the mask operation
>> in the futex hash computation hot path. GCC generates a:
>>
>> movz w1, #lo16, lsl #0 // w1 = bits [15:0]
>> movk w1, #hi16, lsl #16 // w1 = full 32-bit value
>> and w0, w0, w1 // w0 = w0 & w1
>
> I don't thing the '&' needs to be part of the asm block.
> Just generate the 32bit constant and do the mask in C.
> That will let the compiler schedule the instructions.
> It also make the code patching more generally useful.
Ack! That makes sense. I'll update it in the next version.
Thank you for taking a look at the series.
--
Thanks and Regards,
Prateek