dtstsfi

Decimal Test Significance Immediate

dtstsfi BF, U, FRB

Tests the significance of a decimal floating-point value in FPR[FRB] against an immediate value UIM.

Details

The instruction compares the number of significant digits (NSDb) of the DFP value in FPR[FRB] with the reference significance specified by UIM. The result is placed into CR field BF and FPCC.

Pseudocode Operation

NSDb <- number of significant digits in FPR[FRB]
if UIM != 0 and UIM < NSDb then
    CR[BF] <- 0b0010
    FPCC <- 0b0010
else if UIM != 0 and UIM > NSDb or UIM = 0 then
    CR[BF] <- 0b0100
    FPCC <- 0b0100
else if UIM != 0 and UIM = NSDb then
    CR[BF] <- 0b1000
    FPCC <- 0b1000
else
    CR[BF] <- 0b0001
    FPCC <- 0b0001

Programming Note

The dtstsfi instruction is used to compare the number of significant digits in a DFP value with a specified reference significance. Ensure that the UIM (Upper Immediate) is correctly set according to the desired comparison. This instruction operates at the problem state and may raise exceptions if the FPR[FRB] contains an invalid DFP value. Performance can be optimized by minimizing the use of this instruction in critical loops due to its dependency on floating-point operations.

Example

dtstsfi cr0, 0, f3

Encoding

Binary Layout
59
0
BF
6
/
9
U
10
FRB
675
 
Format X-form
Opcode 0xEC000543
Extension Decimal Floating-Point
Registers Altered CR, FPSCR

Operands

  • BF
    CR Field
  • U
    Imm
  • FRB
    Source
  • UIM
    Immediate Reference Significance