[x86] fix fmaxnum/fminnum with nnan
authorSanjay Patel <spatel@rotateright.com>
Thu, 10 May 2018 15:40:49 +0000 (15:40 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 10 May 2018 15:40:49 +0000 (15:40 +0000)
commitb4e7893ba8db8ceead3ae1c113598e5a107deaa2
treeb6295376561b90d0f6fb3c9604cebc811dfacad5
parent71fa1b904a1fb55391cecc874c64020e29d0a5e5
[x86] fix fmaxnum/fminnum with nnan

With nnan, there's no need for the masked merge / blend
sequence (that probably costs much more than the min/max
instruction).

Somewhere between clang 5.0 and 6.0, we started producing
these intrinsics for fmax()/fmin() in C source instead of
libcalls or fcmp/select. The backend wasn't prepared for
that, so we regressed perf in those cases.

Note: it's possible that other targets have similar problems
as seen here.

Noticed while investigating PR37403 and related bugs:
https://bugs.llvm.org/show_bug.cgi?id=37403

The IR FMF propagation cases still don't work. There's
a proposal that might fix those cases in D46563.

llvm-svn: 331992
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/fmaxnum.ll
llvm/test/CodeGen/X86/fminnum.ll