Skip to content

Commit

Permalink
Address PR Comment: Accelerate DAA ExternalDecimal.checkExternalDecim…
Browse files Browse the repository at this point in the history
…al api

Signed-off-by: Rahil Shah <[email protected]>
  • Loading branch information
r30shah committed Jan 28, 2025
1 parent de59a99 commit 7366e65
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions runtime/compiler/z/codegen/J9BCDTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5178,37 +5178,37 @@ J9::Z::TreeEvaluator::zdchkEvaluator(TR::Node *node, TR::CodeGenerator *cg)
* - Leading Sign (LS) : 1 if sign is leading, otherwise 0 for trailing sign.
* - Disallowed-Spaces Count (DSC): DC is total number of digits, DSC represents number of digits
* with zone and digit format, rest can have space.
* Only relevant when LS and SSC are 0.
* Only relevant when SSC is 0.
* - Sign-Test Control (STC) : Specifies which codes are considered as valid sign codes.
* 110 (C,D,F) for embedded sign (will return false for non-preferred sign codes).
* 010 (4e,60) for sign separate (leading/trailing).
* 000 all sign codes are considered valid (hex) (A-F).
* - Digits Count (DC) : Integer specifying number of bytes to be verified. Does not include sign byte.
*/
uint16_t zonedDecimalInfo = 0x0; // I3 operandgit d
uint8_t stc = 0x0;
#define I3_SSC_SEPARATE 0x1
#define I3_STC_SIGN_SEPARATE 0x2
#define I3_LS_LEADING 0x1
#define I3_STC_EMBEDDED_SIGN 0x6

uint16_t zonedDecimalInfo = static_cast<uint16_t>(precision); // I3 operand
int8_t dsc = static_cast<int8_t>(precision - bytesWithSpacesConst);

if (dataType == TR::ZonedDecimalSignTrailingSeparate) // Sign trailing separate
{
zonedDecimalInfo = 0x2; // set SSC bit
stc = 0x2;
dsc = 0x0;
zonedDecimalInfo |= ((I3_SSC_SEPARATE << 14) | (I3_STC_SIGN_SEPARATE << 5));
}
else if (dataType == TR::ZonedDecimalSignLeadingEmbedded) // Sign leading embedded
{
zonedDecimalInfo = 0x1; // set LC bit
zonedDecimalInfo |= ((I3_LS_LEADING << 13) | (dsc << 8));
}
else if (dataType == TR::ZonedDecimalSignLeadingSeparate) // Sign leading separate
{
zonedDecimalInfo = 0x3; // set SSC and LS bits
stc = 0x2;
dsc = 0x0;
zonedDecimalInfo |= ((I3_SSC_SEPARATE << 14) | (I3_LS_LEADING << 13) | (I3_STC_SIGN_SEPARATE << 5));
}
else if (dataType == TR::ZonedDecimal) // Sign embedded trailing
{
zonedDecimalInfo |= (dsc << 8);
}
zonedDecimalInfo = (zonedDecimalInfo << 5) | dsc;
zonedDecimalInfo = (zonedDecimalInfo << 3) | stc;
zonedDecimalInfo = (zonedDecimalInfo << 5) | precision; // DC

// Must use decimalLength because precision does not equal length when sign is separate
int8_t firstByteIndexToLoad = decimalLength - 1;
Expand Down Expand Up @@ -5243,7 +5243,7 @@ J9::Z::TreeEvaluator::zdchkEvaluator(TR::Node *node, TR::CodeGenerator *cg)
node->setRegister(chkResultReg);
cg->decReferenceCount(child);
cg->decReferenceCount(node->getSecondChild());
cg->traceBCDExit("zdchk",node);
cg->traceBCDExit("zdchk", node);
return chkResultReg;
}

Expand Down

0 comments on commit 7366e65

Please sign in to comment.