maddhd
Multiply-Add High Doubleword
Multiplies two 64-bit operands and adds the result to a third 64-bit operand, placing the high-order 64 bits of the sum into a target register.
Details
The 64-bit operands (RA) and (RB) are multiplied to produce a 128-bit product. This product is then added to the 64-bit operand (RC). The high-order 64 bits of the resulting sum are placed into register RT.
Pseudocode Operation
prod0:127 ← (RA) × (RB)
sum0:127 ← prod + EXTS(RC)
RT ← sum0:63
Programming Note
The maddhd instruction is useful for performing high-precision arithmetic operations where the product of two 64-bit numbers needs to be added to another 64-bit number, and only the high-order bits of the result are required. Ensure that the operands are correctly aligned and consider the potential for overflow in the intermediate product before adding RC. This instruction operates at a privilege level that allows it to be used in both user and supervisor modes.
Example
Encoding
Operands
-
RT
Target General Purpose Register -
RA
Source General Purpose Register -
RB
Source General Purpose Register -
RC
Source General Purpose Register