[PATCH] fix move_to_unaligned32 for !x86

Denys Vlasenko vda.linux at googlemail.com
Mon Apr 20 00:50:22 UTC 2009


On Saturday 18 April 2009 07:10, Peter Korsgaard wrote:
> >>>>> "Denys" == Denys Vlasenko <vda.linux at googlemail.com> writes:
> 
>  Denys> On Friday 17 April 2009 20:16, Peter Korsgaard wrote:
>  >> get_unaligned() got changed into move_{from,to}_unaligned() in r24334, but
>  >> the temporary variabled used to make sure we can take the address of the
>  >> source argument for memcpy() got removed. Later on in r26068 dnsd.c got
>  >> changed to call move_to_unaligned with htons/htonl as source breaking
>  >> the build for !x86.
> 
>  Denys> Which arch do you build for?
> 
> This was for arm.

bbox has a few arch-specific ways to get smaller code.

Here, we use more efficient calling comvention:

#if __GNUC_PREREQ(3,0) && defined(i386) /* || defined(__x86_64__)? */
/* stdcall makes callee to pop arguments from stack, not caller */
# define FAST_FUNC __attribute__((regparm(3),stdcall))
/* #elif ... - add your favorite arch today! */
#else
# define FAST_FUNC
#endif

And here, we use bytes for really small variables:

#if defined(i386) || defined(__x86_64__) || defined(__mips__) || defined(__cris__)
/* add other arches which benefit from this... */
typedef signed char smallint;
typedef unsigned char smalluint;
#else
/* for arches where byte accesses generate larger code: */
typedef int smallint;
typedef unsigned smalluint;
#endif

As you see, none of these have an optimized arm version.

Can you test whether ARM benefits from smaller smallints?
(I think not, since ARM does not like bytes much, but worth checking)

Is there any FAST_FUNC tweaks for ARM?

The check would be to add a tweak, rebuild, and compare binary's syze.
--
vda


More information about the busybox mailing list