[DAGCombiner] Fold fmin/fmax with INF / FLT_MAX
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 12 Sep 2020 22:12:30 +0000 (00:12 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 14 Sep 2020 17:59:33 +0000 (19:59 +0200)
commit8e69c3cde8eed94be226bdef1ff6cedda3a33bc4
tree45209f8bb134f6372c02cbabbbf0a50529247b72
parenta3bc0401d436d8c7d2dd5b54e13b81333d53bdff
[DAGCombiner] Fold fmin/fmax with INF / FLT_MAX

Similar to D87415, this folds the various float min/max opcodes
with a constant INF or -INF operand, or FLT_MAX / -FLT_MAX operand
if the ninf flag is set. Some of the folds are only possible under
nnan.

The fminnum(X, INF) with nnan and fmaxnum(X, -INF) with nnan cases
are needed to improve the VECREDUCE_FMIN/FMAX lowerings on X86,
the rest is here for the sake of completeness.

Differential Revision: https://reviews.llvm.org/D87571
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/ARM/fminmax-folds.ll