[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200701032047.02941.vda.linux@googlemail.com>
Date: Wed, 3 Jan 2007 20:47:02 +0100
From: Denis Vlasenko <vda.linux@...glemail.com>
To: Linus Torvalds <torvalds@...l.org>
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 Wednesday 03 January 2007 17:03, Linus Torvalds wrote:
> On Wed, 3 Jan 2007, Grzegorz Kulewski wrote:
> > Could you explain why CMOV is pointless now? Are there any benchmarks proving
> > that?
>
> CMOV (and, more generically, any "predicated instruction") tends to
> generally a bad idea on an aggressively out-of-order CPU. It doesn't
> always have to be horrible, but in practice it is seldom very nice, and
> (as usual) on the P4 it can be really quite bad.
>
> On a P4, I think a cmov basically takes 10 cycles.
>
> But even ignoring the usual P4 "I suck at things that aren't totally
> normal", cmov is actually not a great idea. You can always replace it by
>
> j<negated condition> forward
> mov ..., %reg
> forward:
...
...
> In contrast, if you use a predicated instruction, ALL of it is on the
> critical path. Calculating the conditional is on the critical path.
> Calculating the value that gets used is obviously ALSO on the critical
> path, but so is the calculation for the value that DOESN'T get used too.
> So the cmov - rather than speeding things up - actually slows things down,
> because it makes more code be dependent on each other.
Why CPU people do not internally convert cmov into jmp,mov pair?
--
vda
-
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