fnmsub

Floating Negative Multiply-Subtract

fnmsub FRT, FRA, FRC, FRB

-(A*C - B)

Encoding

Binary Layout
63
0:5
FRT
6:10
FRA
11:15
FRB
16:20
FRC
21:25
30
26:30
/
31
 
Format A-form
Opcode 0xFC00003C
Extension Floating-Point

Operands

  • FRT
    Target
  • FRA
    A
  • FRC
    C
  • FRB
    B

Example

fnmsub f1, f2, f4, f3

Registers Altered

FPSCR

Related

More in Floating-Point

Reference

Description

Floating Negative Multiply-Subtract computes -(A*C - B) using fused multiply-subtract, where the intermediate product is not rounded. The result is rounded to the target precision according to the current rounding mode in FPSCR. FPSCR is updated with FPRF, FR, FI, and exception flags based on the result.

Operation

FRT ← -((FRA × FRC) - FRB)
Update FPSCR[FPRF, FR, FI, exception flags]

Programming Note

The fnmsub instruction is commonly used in scenarios requiring efficient floating-point arithmetic operations, such as in scientific computations or graphics processing. Ensure that the input registers FRA, FRC, and FRB are properly aligned to avoid precision loss. Be aware of potential exceptions like underflow or overflow, which can be managed by checking the FPSCR register after execution.