OSDN Git Service

[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)
commit2a96212ada68136b19ae94f841eb04905b7859b8
tree2b8ec76e6f49f229f7a4998c2baac4133ea837ff
parent88b5ce0eea86696c7eb2aa9f902d0dbb4546d646
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331992 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/fmaxnum.ll
test/CodeGen/X86/fminnum.ll