[PATCH] D67446: [ConstProp] allow folding for fma that produces NaN

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 07:31:15 PDT 2019


spatel created this revision.
spatel added reviewers: arsenm, fhahn, reames, hfinkel.
Herald added subscribers: hiraditya, wdng, mcrosier.
Herald added a project: LLVM.

Folding for fma/fmuladd was added here:
rL202914 <https://reviews.llvm.org/rL202914>
...and as seen in existing/unchanged tests, that works to propagate NaN if it's already an input, but we should fold an fma() that creates NaN too.

>From IEEE-754-2008 7.2 "Invalid Operation", there are 2 clauses that apply to fma, so I added tests for those patterns:

  c) fusedMultiplyAdd: fusedMultiplyAdd(0, ∞, c) or fusedMultiplyAdd(∞, 0, c) unless c is a quiet NaN; if c is a quiet NaN then it is implementation defined whether the invalid operation exception is signaled
  d) addition or subtraction or fusedMultiplyAdd: magnitude subtraction of infinities, such as: addition(+∞, −∞)


https://reviews.llvm.org/D67446

Files:
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/test/Transforms/ConstProp/fma.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67446.219711.patch
Type: text/x-patch
Size: 6306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190911/3eb1a38a/attachment.bin>


More information about the llvm-commits mailing list