dsub

Decimal Subtract

dsub FRT,FRA,FRB
(Rc=0)

Subtracts the contents of two DFP registers and places the result in another DFP register.

Details

The DFP operand in FRB[p] is subtracted from the DFP operand in FRA[p]. The result is rounded to the target-format precision under control of DRN (bits 29:31 of the FPSCR). An appropriate form of the rounded result is selected based on the ideal exponent and is placed in FRT[p]. The ideal exponent is the smaller exponent of the two source operands.

Pseudocode Operation

if 'dsub' then
    FRT[p] <- (FRA[p]) - (FRB[p])

Programming Note

The dsub instruction performs a decimal subtraction between two DFP operands. Ensure that both operands are properly aligned and formatted according to the target precision specified in the FPSCR register. Be aware of potential rounding errors based on the current rounding mode set in DRN, and check for any exceptions or flags (like VXSNAN) that may indicate invalid operations or special results.

Example

dsub f1, f2, f3

Encoding

Binary Layout
59
0
FRT
6
FRA
11
FRB
16
514
31
/
 
Format X-form
Opcode 0xEC000404
Extension Decimal Floating-Point
Registers Altered FPSCR, FPRF, FR, FI, FX, OX, UX, XX, VXSNAN, VXISI, CR1

Operands

  • FRT
    Target
  • FRA
    Src A
  • FRB
    Src B