[parisc-linux-cvs] linux tsbogend

Thomas Bogendoerfer tsbogend@alpha.franken.de
Mon, 25 Feb 2002 21:41:23 +0100


On Mon, Feb 25, 2002 at 10:32:59AM -0700, Grant Grundler wrote:
> Thomas Bogendoerfer wrote:
> > URL of patch: ftp://ftp.parisc-linux.org/patches/eisa_enum2.diff
> 
> In drivers/gsc/eisa_enumerator.c:
> +static inline u_int16_t get_16(const unsigned char *x)
> +{ 
> +       return (x[1] << 8) | x[0];
> +}
> +
> +static inline u_int32_t get_32(const unsigned char *x)
> +{
> +       return (x[3] << 24) | (x[2] << 16) | (x[1] << 8) | x[0];
> +}
> 
> Thought this works, this generates horribly code. At least the
> HPUX compiler did when I looked at it 5 years (or so) ago.
> If anyone cares about EISA perf, stealing inline asm from
> include/asm/byteorder.h (eg ___arch__swab32) would help.

that isn't fast path stuff, it's executed only during startup and never
involved in data transfers. We could use le32/le16_to_cpu for this, but
we don't operate on natural aligned data all the time. So we would have
to do unaligned accesses and swap it afterwards. I don't think this will buy
us much. 

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                 [ Alexander Viro on linux-kernel ]