Skip to content

Commit

Permalink
AArch64: Improve asynccheckEvaluator()
Browse files Browse the repository at this point in the history
This commit removes one instruction from the code generated by
asynccheckEvaluator() for AArch64.
(mov regY, #-1 + cmp regX, regY -> cmn regX, #1)

Signed-off-by: KONNO Kazuhiro <[email protected]>
  • Loading branch information
knn-k committed May 30, 2020
1 parent a0ae8b0 commit 5c055b3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,19 +453,16 @@ J9::ARM64::TreeEvaluator::asynccheckEvaluator(TR::Node *node, TR::CodeGenerator
TR::Node *firstChild = testNode->getFirstChild();
TR::Register *src1Reg = cg->evaluate(firstChild);
TR::Node *secondChild = testNode->getSecondChild();
TR::Register *src2Reg = cg->evaluate(secondChild);

TR_ASSERT(testNode->getOpCodeValue() == TR::lcmpeq, "asynccheck bad format");
TR_ASSERT(testNode->getOpCodeValue() == TR::lcmpeq && secondChild->getLongInt() == -1L, "asynccheck bad format");

TR::LabelSymbol *snippetLabel = generateLabelSymbol(cg);
TR::LabelSymbol *doneLabel = generateLabelSymbol(cg);
TR::SymbolReference *asynccheckHelper = node->getSymbolReference();
TR::Snippet *snippet = new (cg->trHeapMemory()) TR::ARM64HelperCallSnippet(cg, node, snippetLabel, asynccheckHelper, doneLabel);
cg->addSnippet(snippet);

// ToDo:
// Optimize this using "cmp (immediate)" instead of "cmp (register)" when possible
generateCompareInstruction(cg, node, src1Reg, src2Reg, true); // 64-bit compare
generateCompareImmInstruction(cg, node, src1Reg, secondChild->getLongInt(), true); // 64-bit compare

TR::Instruction *gcPoint = generateConditionalBranchInstruction(cg, TR::InstOpCode::b_cond, node, snippetLabel, TR::CC_EQ);
gcPoint->ARM64NeedsGCMap(cg, 0xFFFFFFFF);
Expand Down

0 comments on commit 5c055b3

Please sign in to comment.