Arithmetic Instructions
14 PTX instructions in this category - click any row for encoding, pseudocode, and full documentation.
| Mnemonic | Syntax | PTX Version | Summary |
|---|---|---|---|
| abs | abs.type d, a; | PTX ISA 1.0 | Compute the absolute value of a signed or floating-point operand. |
| add | add.type d, a, b; | PTX ISA 1.0 | Add two operands of the same type, with optional saturation for signed 32-bit integers. |
| div | div.stype d, a, b; | PTX ISA 1.0 | Divide the first operand by the second. |
| fma | fma.rn.f64 d, a, b, c; | PTX ISA 1.4 | Compute (a * b) + c with a single rounding step for improved precision over mad. |
| lg2 | lg2.approx.f32 d, a; | PTX ISA 1.0 | Fast hardware approximation of log2(x). |
| mad | mad.mode.stype d, a, b, c; | PTX ISA 1.0 | Compute (a * b) + c as two rounding steps (unlike fma, which fuses them into one). |
| max | max.type d, a, b; | PTX ISA 1.0 | Select the larger of two operands. |
| min | min.type d, a, b; | PTX ISA 1.0 | Select the smaller of two operands. |
| mul | mul.mode.stype d, a, b; | PTX ISA 1.0 | Multiply two operands, selecting the low, high, or widened part of an integer product. |
| neg | neg.type d, a; | PTX ISA 1.0 | Negate a signed or floating-point operand. |
| rem | rem.stype d, a, b; | PTX ISA 1.0 | Compute the integer remainder of division. |
| rsqrt | rsqrt.approx.f32 d, a; | PTX ISA 1.0 | Fast hardware approximation of 1/sqrt(x). |
| sin | sin.approx.f32 d, a; | PTX ISA 1.0 | Fast hardware approximation of sin(x). |
| sub | sub.type d, a, b; | PTX ISA 1.0 | Subtract the second operand from the first, with optional saturation for signed 32-bit integers. |