[PATCH] D149729: [X86] Avoid usage constant NaN for fminimum/fmaximum lowering

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 00:54:41 PDT 2023


skatkov created this revision.
skatkov added reviewers: RKSimon, pengfei, goldstein.w.n, e-kud.
Herald added a subscriber: hiraditya.
Herald added a project: All.
skatkov requested review of this revision.
Herald added a project: LLVM.

After applying FMIN/FMAX, if any of operands is NaN, the second operand will be the result.
So all we need is to check whether first operand is NaN and return it or result of FMIN/FMAX.

So we avoid usage of constant NaN in the lowering.

Additionally we can avoid handling NaN after FMIN/FMAX if we are sure that first operand is not NaN.


https://reviews.llvm.org/D149729

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/test/CodeGen/X86/avx512fp16-fminimum-fmaximum.ll
  llvm/test/CodeGen/X86/extract-fp.ll
  llvm/test/CodeGen/X86/extractelement-fp.ll
  llvm/test/CodeGen/X86/fminimum-fmaximum.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149729.518994.patch
Type: text/x-patch
Size: 42570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230503/a3c877ee/attachment.bin>


More information about the llvm-commits mailing list