Skip to content

Commit

Permalink
Fix invalid use of stdbrx on P6 and before
Browse files Browse the repository at this point in the history
Previously, the codegen optimization for performing an lbyteswap and an
lstore in one stdbrx instruction was not properly checking that the
stdbrx instruction was actually available on the current processor.
Since this instruction was only added in P7, this could result in P6 and
earlier processors encountering an illegal instruction.

Signed-off-by: Ben Thomas <ben@benthomas.ca>
  • Loading branch information
aviansie-ben committed Nov 4, 2020
1 parent bc1c204 commit b022576
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/p/codegen/OMRTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,8 @@ TR::Register *OMR::Power::TreeEvaluator::lstoreEvaluator(TR::Node *node, TR::Cod
}

bool reverseStore = false;
if (valueChild->getOpCodeValue() == TR::lbyteswap && valueChild->isSingleRefUnevaluated())
if (valueChild->getOpCodeValue() == TR::lbyteswap && valueChild->isSingleRefUnevaluated() &&
cg->comp()->target().cpu.isAtLeast(OMR_PROCESSOR_PPC_P7))
{
reverseStore = true;

Expand Down

0 comments on commit b022576

Please sign in to comment.