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.
Encoding
Binary Layout
0
0:5
BF
6:8
FRA
9:10
FRB
11:15
162
16:31
Operands
-
BF
Condition Register Field -
FRA
First Source DFP Floating-Point Register -
FRB
Second Source DFP Floating-Point Register
Example
dtstex cr0, f2, f3
Registers Altered
CR field BF, FPSCR FPCCRelated
More in Decimal Floating-Point
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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.
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.