OSDN Git Service

Make the PPC fast-math sqrt expansion safe at 0
authorHal Finkel <hfinkel@anl.gov>
Thu, 12 Sep 2013 19:04:12 +0000 (19:04 +0000)
committerHal Finkel <hfinkel@anl.gov>
Thu, 12 Sep 2013 19:04:12 +0000 (19:04 +0000)
commit4a1535c0383254741bcddd3500081782aad11864
tree024a120bd85d5e80b48238be3ce46a51f2422211
parentba7183bc5284a0e4254ad12b78e2ea61e291dd88
Make the PPC fast-math sqrt expansion safe at 0

In fast-math mode sqrt(x) is calculated using the fast expansion of the
reciprocal of the reciprocal sqrt expansion. The reciprocal and reciprocal
sqrt expansions use the associated estimate instructions along with some Newton
iterations. Unfortunately, as a result, sqrt(0) was being calculated as NaN,
which is not correct. Now we explicitly return a result of zero if the input is
zero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190624 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelLowering.cpp
test/CodeGen/PowerPC/recipest.ll