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

Måns Rullgård mans at mansr.com
Fri May 10 18:56:39 CEST 2013


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?  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.

-- 
Måns Rullgård
mans at mansr.com


More information about the U-Boot mailing list