[PATCH] D52764: [Intrinsic] Add llvm.minimum and llvm.maximum instrinsic functions

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 1 19:52:50 PDT 2018


tlively created this revision.
tlively added reviewers: aheejin, dschuff, sunfish.
Herald added a reviewer: javed.absar.
Herald added subscribers: llvm-commits, kristina, dexonsmith, kristof.beyls.

These new intrinsics have the semantics of the `minimum` and `maximum`
operations specified by the latest draft of IEEE 754-2018. Unlike
llvm.minnum and llvm.maxnum, these new intrinsics propagate NaNs and
always treat -0.0 as less than 0.0. `minimum` and `maximum` lower
directly to the existing `fminnan` and `fmaxnan` ISel DAG nodes. It is
safe to reuse these DAG nodes because before this patch were only
emitted in situations where there were known to be no NaN arguments or
where NaN propagation was correct and there were known to be no zero
arguments. I know of only four backends that lower fminnan and
fmaxnan: WebAssembly, ARM, AArch64, and SystemZ, and each of these
lowers fminnan and fmaxnan to instructions that are compatible with
the IEEE 754-2018 semantics.


Repository:
  rL LLVM

https://reviews.llvm.org/D52764

Files:
  docs/LangRef.rst
  include/llvm/ADT/APFloat.h
  include/llvm/CodeGen/ISDOpcodes.h
  include/llvm/IR/IRBuilder.h
  include/llvm/IR/Intrinsics.td
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  unittests/ADT/APFloatTest.cpp
  unittests/IR/IRBuilderTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52764.167874.patch
Type: text/x-patch
Size: 9281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181002/b6840750/attachment.bin>


More information about the llvm-commits mailing list