Re: Why Plan 9 C compilers don't have asm("")

From: Linus Torvalds (
Date: Fri Jul 06 2001 - 13:44:31 EST

In article <>,
Cort Dougan <> wrote:
>I'm talking about _modern_ processors, not processors that dominate the
>modern age. This isn't x86.

NONE of my examples were about the x86.

I gave the alpha as a specific example. The same issues are true on
ia64, sparc64, and mips64. How more "modern" can you get? Name _one_
reasonably important high-end CPU that is more modern than alpha and

On ia64, you probably end up with function calls costing even more than
alpha, because not only does the function call end up being a
synchronization point for the compiler, it also means that the compiler
cannot expose any parallelism, so you get an added hit from there. At
least with other CPU's that find the parallelism dynamically they can do
out-of-order stuff across function calls.

>Unconditional branches are definitely predictable so icache pre-fetches are
>not more complicated that straight-line code.

Did you READ my mail at all?

Most of these "unconditional branches" are indirect, because rather few
64-bit architectures have a full 64-bit branch. That means that in
order to predict them, you either have to do data-prediction (pretty
much nobody does this), or you have a branch target prediction cache,
which works very well indeed but has the problem that it only works for
stuff in the cache, and the cache tends to be fairly limited (because
you need to cache the whole address - it's more than a "which direction
do we go in").

There are lots of good arguments for function calls: they improve icache
when done right, but if you have some non-C-semantics assembler sequence
like "cli" or a spinlock that you use a function call for, that would
_decrease_ icache effectiveness simply because the call itself is bigger
than the instruction (and it breaks up the instruction sequence so you
get padding issues).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sat Jul 07 2001 - 21:00:19 EST