[PATCH] D28797: [LangRef] Make @llvm.sqrt(x) return undef, rather than have UB, for negative x.

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 14:26:06 PST 2017

jlebar updated this revision to Diff 84744.
jlebar marked an inline comment as done.
jlebar added a comment.

Update per Eli and Mehdi's comments.



Index: llvm/docs/LangRef.rst
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -10061,10 +10061,8 @@
 The '``llvm.sqrt``' intrinsics return the sqrt of the specified operand,
 returning the same value as the libm '``sqrt``' functions would. Unlike
-``sqrt`` in libm, however, ``llvm.sqrt`` has undefined behavior for
-negative numbers other than -0.0 (which allows for better optimization,
-because there is no need to worry about errno being set).
-``llvm.sqrt(-0.0)`` is defined to return -0.0 like IEEE sqrt.
+``sqrt`` in libm, however, ``llvm.sqrt`` returns ``undef`` for negative numbers
+other than -0.0.  ``llvm.sqrt(-0.0)`` is defined to return -0.0 like IEEE sqrt.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28797.84744.patch
Type: text/x-patch
Size: 775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170117/721f074f/attachment.bin>

More information about the llvm-commits mailing list