[llvm-commits] [llvm] r140296 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
clattner at apple.com
Thu Sep 22 13:47:09 CDT 2011
On Sep 22, 2011, at 9:08 AM, Duncan Sands wrote:
> On 09/22/11 17:38, Eli Friedman wrote:
>> On Thu, Sep 22, 2011 at 1:19 AM, Duncan Sands<baldrick at free.fr> wrote:
>>>> The SSE version differences for fmin/fmax are more involved than I thought.
>>> While on the subject of fmin/fmax, I noticed that "isCommutable" is set to
>>> zero for max/min. Yet the result of max/min presumably doesn't depend on
>>> the order of its arguments, so is this a mistake?
>> Strictly spearking, min/max on x86 are not commutable. It would
>> probably be okay to commute them when -ffast-math is turned on,
> I checked the Intel docs and you are correct. As a mathematician I find this
> pretty amazing. I particularly enjoyed how max(+0.0, -0.0) is whatever is in
> the second operand rather than +0.0.
FWIW, I think that this is what allows the compiler to use the max instruction for idioms like "(x > y) ? x : y".
More information about the llvm-commits