| OLD | NEW |
| 1 ============================== | 1 ============================== |
| 2 PNaCl Bitcode Reference Manual | 2 PNaCl Bitcode Reference Manual |
| 3 ============================== | 3 ============================== |
| 4 | 4 |
| 5 .. contents:: | 5 .. contents:: |
| 6 :local: | 6 :local: |
| 7 :backlinks: none | 7 :backlinks: none |
| 8 :depth: 3 | 8 :depth: 3 |
| 9 | 9 |
| 10 Introduction | 10 Introduction |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 Other kinds of LLVM metadata are not supported. | 258 Other kinds of LLVM metadata are not supported. |
| 259 | 259 |
| 260 Intrinsic Global Variables | 260 Intrinsic Global Variables |
| 261 ========================== | 261 ========================== |
| 262 | 262 |
| 263 `LLVM LangRef: Intrinsic Global Variables | 263 `LLVM LangRef: Intrinsic Global Variables |
| 264 <http://llvm.org/releases/3.3/docs/LangRef.html#intrinsic-global-variables>`_ | 264 <http://llvm.org/releases/3.3/docs/LangRef.html#intrinsic-global-variables>`_ |
| 265 | 265 |
| 266 PNaCl bitcode does not support intrinsic global variables. | 266 PNaCl bitcode does not support intrinsic global variables. |
| 267 | 267 |
| 268 .. _ir_and_errno: |
| 269 |
| 270 Errno and errors in arithmetic instructions |
| 271 =========================================== |
| 272 |
| 273 Some arithmetic instructions and intrinsics have the similar semantics to |
| 274 libc math functions, but differ in the treatment of ``errno``. While the |
| 275 libc functions may set ``errno`` for domain errors, the instructions and |
| 276 intrinsics do not. This is because the variable ``errno`` is not special |
| 277 and is not required to be part of the program. |
| 278 |
| 268 Instruction Reference | 279 Instruction Reference |
| 269 ===================== | 280 ===================== |
| 270 | 281 |
| 271 List of allowed instructions | 282 List of allowed instructions |
| 272 ---------------------------- | 283 ---------------------------- |
| 273 | 284 |
| 274 This is a list of LLVM instructions supported by PNaCl bitcode. Where | 285 This is a list of LLVM instructions supported by PNaCl bitcode. Where |
| 275 applicable, PNaCl-specific restrictions are provided. | 286 applicable, PNaCl-specific restrictions are provided. |
| 276 | 287 |
| 277 .. TODO: explain instructions or link in the future | 288 .. TODO: explain instructions or link in the future |
| (...skipping 20 matching lines...) Expand all Loading... |
| 298 guaranteed to trap in PNaCl bitcode. | 309 guaranteed to trap in PNaCl bitcode. |
| 299 | 310 |
| 300 * ``and`` | 311 * ``and`` |
| 301 * ``or`` | 312 * ``or`` |
| 302 * ``xor`` | 313 * ``xor`` |
| 303 * ``fadd`` | 314 * ``fadd`` |
| 304 * ``fsub`` | 315 * ``fsub`` |
| 305 * ``fmul`` | 316 * ``fmul`` |
| 306 * ``fdiv`` | 317 * ``fdiv`` |
| 307 * ``frem`` | 318 * ``frem`` |
| 319 |
| 320 The frem instruction has the semantics of the libc fmod function for |
| 321 computing the floating point remainder. If the numerator is infinity, or |
| 322 denominator is zero, or either are NaN, then the result is NaN. |
| 323 Unlike the libc fmod function, this does not set ``errno`` when the |
| 324 result is NaN (see the :ref:`instructions and errno <ir_and_errno>` |
| 325 section). |
| 326 |
| 308 * ``alloca`` | 327 * ``alloca`` |
| 309 | 328 |
| 310 See :ref:`alloca instructions <bitcode_allocainst>`. | 329 See :ref:`alloca instructions <bitcode_allocainst>`. |
| 311 | 330 |
| 312 * ``load``, ``store`` | 331 * ``load``, ``store`` |
| 313 | 332 |
| 314 The pointer argument of these instructions must be a *normalized* pointer (see | 333 The pointer argument of these instructions must be a *normalized* pointer (see |
| 315 :ref:`pointer types <bitcode_pointertypes>`). The ``volatile`` and ``atomic`` | 334 :ref:`pointer types <bitcode_pointertypes>`). The ``volatile`` and ``atomic`` |
| 316 attributes are not supported. Loads and stores of the type ``i1`` are not | 335 attributes are not supported. Loads and stores of the type ``i1`` are not |
| 317 supported. | 336 supported. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 * ``llvm.cttz`` | 408 * ``llvm.cttz`` |
| 390 * ``llvm.ctpop`` | 409 * ``llvm.ctpop`` |
| 391 | 410 |
| 392 The overloaded llvm.ctlz, llvm.cttz, and llvm.ctpop intrinsics are only | 411 The overloaded llvm.ctlz, llvm.cttz, and llvm.ctpop intrinsics are only |
| 393 supported with the i32 and i64 argument types (the types supported by | 412 supported with the i32 and i64 argument types (the types supported by |
| 394 C-style GCC builtins). | 413 C-style GCC builtins). |
| 395 | 414 |
| 396 * ``llvm.sqrt`` | 415 * ``llvm.sqrt`` |
| 397 | 416 |
| 398 The overloaded ``llvm.sqrt`` intrinsic is only supported for float | 417 The overloaded ``llvm.sqrt`` intrinsic is only supported for float |
| 399 and double arguments types. Unlike the standard LLVM intrinsic, | 418 and double arguments types. This has the same semantics as the libc |
| 400 PNaCl guarantees that llvm.sqrt returns a QNaN for values less than -0.0. | 419 sqrt function, returning NaN for values less than -0.0. However, this |
| 420 does not set ``errno`` when the result is NaN (see the |
| 421 :ref:`instructions and errno <ir_and_errno>` section). |
| 401 | 422 |
| 402 * ``llvm.stacksave`` | 423 * ``llvm.stacksave`` |
| 403 * ``llvm.stackrestore`` | 424 * ``llvm.stackrestore`` |
| 404 | 425 |
| 405 These intrinsics are used to implement language features like scoped automatic | 426 These intrinsics are used to implement language features like scoped automatic |
| 406 variable sized arrays in C99. ``llvm.stacksave`` returns a value that | 427 variable sized arrays in C99. ``llvm.stacksave`` returns a value that |
| 407 represents the current state of the stack. This value may only be used as the | 428 represents the current state of the stack. This value may only be used as the |
| 408 argument to ``llvm.stackrestore``, which restores the stack to the given | 429 argument to ``llvm.stackrestore``, which restores the stack to the given |
| 409 state. | 430 state. |
| 410 | 431 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 545 |
| 525 declare i1 @llvm.nacl.atomic.is.lock.free(i32 <byte_size>, i8* <address>) | 546 declare i1 @llvm.nacl.atomic.is.lock.free(i32 <byte_size>, i8* <address>) |
| 526 | 547 |
| 527 The ``llvm.nacl.atomic.is.lock.free`` intrinsic is designed to | 548 The ``llvm.nacl.atomic.is.lock.free`` intrinsic is designed to |
| 528 determine at translation time whether atomic operations of a certain | 549 determine at translation time whether atomic operations of a certain |
| 529 ``byte_size`` (a compile-time constant), at a particular ``address``, | 550 ``byte_size`` (a compile-time constant), at a particular ``address``, |
| 530 are lock-free or not. This reflects the C11 ``atomic_is_lock_free`` | 551 are lock-free or not. This reflects the C11 ``atomic_is_lock_free`` |
| 531 function from header ``<stdatomic.h>`` and the C++11 ``is_lock_free`` | 552 function from header ``<stdatomic.h>`` and the C++11 ``is_lock_free`` |
| 532 member function in header ``<atomic>``. It can be used through the | 553 member function in header ``<atomic>``. It can be used through the |
| 533 ``__nacl_atomic_is_lock_free`` builtin. | 554 ``__nacl_atomic_is_lock_free`` builtin. |
| OLD | NEW |