Skip to content

Commit

Permalink
Merge pull request #4064 from simonameng/inlineSQRT
Browse files Browse the repository at this point in the history
Change the implementation of dsqrtEvaluator
  • Loading branch information
fjeremic authored Jul 10, 2019
2 parents d51a93b + 1e5c0fd commit deaaf6c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions compiler/z/codegen/UnaryEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,22 +309,20 @@ TR::Register *
OMR::Z::TreeEvaluator::dsqrtEvaluator(TR::Node * node, TR::CodeGenerator * cg)
{
TR::Node * firstChild = node->getFirstChild();
TR::Register * targetRegister = NULL;
TR::Register * opRegister = cg->evaluate(firstChild);
TR::Register * targetRegister = cg->allocateRegister(TR_FPR);

if (cg->canClobberNodesRegister(firstChild))
if (firstChild->isSingleRefUnevaluated() && firstChild->getOpCodeValue() == TR::dloadi)
{
targetRegister = opRegister;
generateRXEInstruction(cg, TR::InstOpCode::SQDB, node, targetRegister, generateS390MemoryReference(firstChild, cg), 0);
}
else
{
targetRegister = cg->allocateRegister(TR_FPR);
TR::Register * opRegister = cg->evaluate(firstChild);
generateRRInstruction(cg, TR::InstOpCode::SQDBR, node, targetRegister, opRegister);
cg->decReferenceCount(firstChild);
}
generateRRInstruction(cg, TR::InstOpCode::SQDBR, node, targetRegister, opRegister);

node->setRegister(targetRegister);
cg->decReferenceCount(firstChild);
return node->getRegister();
return targetRegister;
}

TR::Register *
Expand Down

0 comments on commit deaaf6c

Please sign in to comment.