From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk Behme Date: Fri, 10 May 2013 19:42:41 +0200 Subject: [U-Boot] [RFC PATCH] ARM: byteorder: add optimized swab16 and swab32 In-Reply-To: References: <1368203000-3386-1-git-send-email-dirk.behme@gmail.com> Message-ID: <518D3191.7060205@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Am 10.05.2013 18:56, schrieb M?ns Rullg?rd: > Dirk Behme 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