[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0701040729360.3661@woody.osdl.org>
Date: Thu, 4 Jan 2007 07:34:52 -0800 (PST)
From: Linus Torvalds <torvalds@...l.org>
To: "Zou, Nanhai" <nanhai.zou@...el.com>
cc: Grzegorz Kulewski <kangur@...com.net>,
Alan <alan@...rguk.ukuu.org.uk>,
Mikael Pettersson <mikpe@...uu.se>, s0348365@....ed.ac.uk,
76306.1226@...puserve.com, akpm@...l.org, bunk@...sta.de,
greg@...ah.com, linux-kernel@...r.kernel.org,
yanmin_zhang@...ux.intel.com
Subject: RE: kernel + gcc 4.1 = several problems
On Thu, 4 Jan 2007, Zou, Nanhai wrote:
>
> cmov will stall on eflags in your test program.
And that is EXACTLY my point.
CMOV is a piece of CRAP for most things, exactly because it serializes
three streams of data: the two inputs, and the conditional.
My test-case was actually _good_ for cmov, because there was just the one
conditional (which was 100% ALU) thing that was serialized. In real life,
the two data sources also come from memory, and _any_ of them being
delayed ends up delaying the cmov, and screwing up your out-of-order
pipeline because you now introduced a serialization point that was very
possibly not necessary at all.
In contrast, a conditional branch-around serializes absolutely NOTHING,
because branches get predicted.
> I think you will see benefit of cmov if you can manage to put some
> instructions which does NOT modify eflags between testl and cmov.
A lot of the time, the conditional _is_ the critical path.
The whole point of this discussion was that cmov isn't really all that
great. It has fundamental problems that a conditional branch that gets
predicted simply does not have.
That's qiute apart from the fact that cmov has rather limited semantics,
and that in 99% of all cases you have to use a conditional branch anyway.
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