dtstex

DFP Test Exponent X-form

dtstex BF,FRA,FRB

Compares the exponent values of two DFP operands and updates CR field BF and FPCC.

Details

The exponent value (Ea) of the DFP operand in FRA is compared to the exponent value (Eb) of the DFP operand in FRB. The result of the compare is placed into CR field BF and the FPCC.

Pseudocode Operation

Ea ← exponent of DFP operand in FRA
Eb ← exponent of DFP operand in FRB
if (FRA is F) and (FRB is F) then
    if Ea < Eb then CR_BF || FPCC ← 0b1000
    else if Ea > Eb then CR_BF || FPCC ← 0b0100
    else CR_BF || FPCC ← 0b0010
else if (FRA is ∞) and (FRB is ∞) then CR_BF || FPCC ← 0b0010
else if (FRA is QNaN or SNaN) and (FRB is QNaN or SNaN) then CR_BF || FPCC ← 0b0010
else CR_BF || FPCC ← 0b0001

Programming Note

The dtstex instruction compares the exponents of two DFP operands and sets the condition register field BF and floating-point status and control register (FPSCR) FPCC based on the comparison. Ensure that both operands are properly aligned and valid; otherwise, the instruction may raise exceptions. This instruction is useful for sorting or filtering operations where exponent values need to be compared.

Example

dtstex cr0, f2, f3

Encoding

Binary Layout
0
0
BF
6
FRA
9
FRB
11
162
16
 
Format X-form
Opcode 0xEC000144
Extension Decimal Floating-Point
Registers Altered CR field BF, FPSCR FPCC

Operands

  • BF
    Condition Register Field
  • FRA
    First Source DFP Floating-Point Register
  • FRB
    Second Source DFP Floating-Point Register