Boost logo

Boost :

Subject: Re: [boost] non-branching min()
From: Tim Blechmann (tim_at_[hidden])
Date: 2009-09-10 15:46:01

>> 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 am mainly working with gcc and floating point code ... i stopped
trying to optimize this kind of branching code, because the compiler did
a very good job ... i don't have any experience with msvc, though ...


I must say I find television very educational. The minute somebody
turns it on, I go to the library and read a good book.
  Groucho Marx

Boost list run by bdawes at, gregod at, cpdaniel at, john at