[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0805201856200.3081@woody.linux-foundation.org>
Date: Tue, 20 May 2008 19:02:08 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...IV.linux.org.uk>
cc: Harvey Harrison <harvey.harrison@...il.com>,
Al Viro <viro@....linux.org.uk>, mchehab@...radead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] or51132.c: unaligned
On Wed, 21 May 2008, Al Viro wrote:
>
> FWIW, I wonder how they really compare on misaligned and whether it would
> make sense for gcc to try and generate a single load on targets that are
> known to allow that...
It would almost certainly help on x86. The cost of an unaligned integer
access that doesn't cross a cache-fetch boundary (8 bytes on older CPU's,
16 or 32 bytes on newer ones) is zero, last I saw. IOW, there are
misaligned cases that have a higher cost, but they are pretty rare, and
especially so with small data and modern CPU's.
So no disadvantage for 95% of all cases, and the advantage of doing just a
single instruction, rather than four (2 zero-extending loads, a shift and
an add/or, with data dependencies on most of them).
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists