[llvm-bugs] [Bug 25566] Possible Regression: std::max slower than std::fmax

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 18 06:21:23 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=25566

Sanjay Patel <spatel+llvm at rotateright.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #8 from Sanjay Patel <spatel+llvm at rotateright.com> ---
I'm resolving this bug because I'm not sure if the earlier comments are
meaningful anymore.

For the question of "why is std::fmax slower than std::max?", there's a
functional difference between those functions to account for that - fmax
requires dealing with NAN values. 

On x86 with SSE, the asm looks like this:

fmax:
        andpd   %xmm2, %xmm3
        maxsd   %xmm1, %xmm2
        andnpd  %xmm2, %xmm0
        orpd    %xmm3, %xmm0

max:
        maxsd   %xmm1, %xmm0


There are a number of potential perf optimizations (unrolling, vectorization,
etc) that could be done to make either of these cases better, but we should
file new bugs for those if that's important.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200618/ecc4a04c/attachment.html>


More information about the llvm-bugs mailing list