Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Unified Diff: native_client_sdk/src/doc/reference/pnacl-bitcode-abi.rst

Issue 169753005: [NaClDocs] Add note about errno in PNaCl ABI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reset some stuff Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/doc_generated/sitemap.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/doc/reference/pnacl-bitcode-abi.rst
diff --git a/native_client_sdk/src/doc/reference/pnacl-bitcode-abi.rst b/native_client_sdk/src/doc/reference/pnacl-bitcode-abi.rst
index 0aa9a9929b02f68af0704a63b29807acb5cab46f..9758eb4f47c2261357ed7d630359bb5ad781744f 100644
--- a/native_client_sdk/src/doc/reference/pnacl-bitcode-abi.rst
+++ b/native_client_sdk/src/doc/reference/pnacl-bitcode-abi.rst
@@ -265,6 +265,17 @@ Intrinsic Global Variables
PNaCl bitcode does not support intrinsic global variables.
+.. _ir_and_errno:
+
+Errno and errors in arithmetic instructions
+===========================================
+
+Some arithmetic instructions and intrinsics have the similar semantics to
+libc math functions, but differ in the treatment of ``errno``. While the
+libc functions may set ``errno`` for domain errors, the instructions and
+intrinsics do not. This is because the variable ``errno`` is not special
+and is not required to be part of the program.
+
Instruction Reference
=====================
@@ -305,6 +316,14 @@ Only the LLVM instructions listed here are supported by PNaCl bitcode.
* ``fmul``
* ``fdiv``
* ``frem``
+
+ The frem instruction has the semantics of the libc fmod function for
+ computing the floating point remainder. If the numerator is infinity, or
+ denominator is zero, or either are NaN, then the result is NaN.
+ Unlike the libc fmod function, this does not set ``errno`` when the
+ result is NaN (see the :ref:`instructions and errno <ir_and_errno>`
+ section).
+
* ``alloca``
See :ref:`alloca instructions <bitcode_allocainst>`.
@@ -396,8 +415,10 @@ The only intrinsics supported by PNaCl bitcode are the following.
* ``llvm.sqrt``
The overloaded ``llvm.sqrt`` intrinsic is only supported for float
- and double arguments types. Unlike the standard LLVM intrinsic,
- PNaCl guarantees that llvm.sqrt returns a QNaN for values less than -0.0.
+ and double arguments types. This has the same semantics as the libc
+ sqrt function, returning NaN for values less than -0.0. However, this
+ does not set ``errno`` when the result is NaN (see the
+ :ref:`instructions and errno <ir_and_errno>` section).
* ``llvm.stacksave``
* ``llvm.stackrestore``
« no previous file with comments | « native_client_sdk/doc_generated/sitemap.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698