[PATCH 2/2] P2V: Thumb2 support
Dave Martin
dave.martin at linaro.org
Mon Feb 14 07:51:02 EST 2011
On Sun, Feb 13, 2011 at 1:56 PM, Nicolas Pitre <nico at fluxnic.net> wrote:
> On Sun, 13 Feb 2011, Russell King - ARM Linux wrote:
>
>> On Sat, Feb 12, 2011 at 01:33:42PM -0500, Nicolas Pitre wrote:
>> > __fixup_a_pv_table:
>> > +#ifdef CONFIG_THUMB2_KERNEL
>> > +#ifdef CONFIG_ARM_PATCH_PHYS_VIRT_16BIT
>> > + lsls r0, r6, #24
>> > + lsr r6, #8
>> > + beq 1f
>> > + clz r7, r0
>> > + lsrs r0, #24
>> > + lsls r0, r7
>>
>> Why do these instructions need to update the PSR?
>
> Strictly speaking they don't. It's just a size optimization. There is
> a 16-bit encoding for them while their non-PSR-updating counterparts
> have only a 32-bit encoding.
More optimisations are available, but in general I'd advise against
this kind of optimisation for hand-written assembler -- it's unlikely
to help performance and impacts readability.
Using a low register in place of ip would shrink most of the loads and
stores to 16 bits for free though, if a suitable register is available
(r0?).
Cheers
---Dave
More information about the linux-arm-kernel
mailing list