Boost logo

Boost :

Subject: Re: [boost] non-branching min()
From: DE (satan66613_at_[hidden])
Date: 2009-09-10 13:48:08


on 10.09.2009 at 21:31
 Tim Blechmann wrote :
> well, depending on your compiler optimization and cpu architecture, the
> compiler is able to optimize it, removing the branch ...
> e.g. different revisions of sse provide opcodes for min/max of
> floats/doubles and different kinds of integers ...
> in those cases, your branchless code may be even slower, unless it isn't
> optimized to use these instructions as well :)
i could not get rid of a jump with msvc80
maybe other compiler can do it (tell me if you find out)
i looked at what sseX can offer but unfortunately it isn't portable
besides AFAIK all modern cpus have pipeline (at least 2 stages) so you
probably will not miss if you count on it

-- 
Pavel

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk