[U-Boot] [RFC PATCH] ARM: byteorder: add optimized swab16 and swab32

Dirk Behme dirk.behme at gmail.com
Fri May 10 19:42:41 CEST 2013


Am 10.05.2013 18:56, schrieb Måns Rullgård:
> Dirk Behme <dirk.behme at gmail.com> writes:
>
>> Use the specialized ARM instructions for swapping 16 and 32 bit values
>> instead of using the generic ones from include/linux/byteorder/swab.h.
>>
>> The x86 version in arch/x86/include/asm/byteorder.h was taken as an
>> example for this.
>>
>> E.g. for the mx6qsabrelite target this results in ~4k less code.
>
> Which compiler are you using?

An older gcc 4.4.4 version.

> GCC 4.5 and later recognises the byteswap
> pattern and emits these instructions automatically.  This gives better
> code than the inline asm since it allows the compiler to do proper
> instruction scheduling, and in the 16-bit case it avoids extraneous
> masking.

Thanks,

Dirk



More information about the U-Boot mailing list