Skip to content

Commit

Permalink
Merge pull request #7105 from aviansie-ben/power-cleanup-inlining
Browse files Browse the repository at this point in the history
Remove redundant recognized methods inlining code from the Power codegen
  • Loading branch information
gita-omr committed Sep 19, 2019
2 parents 8631b37 + 35e7503 commit b3ebbcd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 379 deletions.
28 changes: 27 additions & 1 deletion runtime/compiler/optimizer/J9RecognizedCallTransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,16 @@ bool J9::RecognizedCallTransformer::isInlineable(TR::TreeTop* treetop)
case TR::java_lang_Class_isAssignableFrom:
return cg()->supportsInliningOfIsAssignableFrom();
case TR::java_lang_Integer_rotateLeft:
case TR::java_lang_Integer_rotateRight:
return TR::Compiler->target.cpu.isX86() || TR::Compiler->target.cpu.isZ() || TR::Compiler->target.cpu.isPower();
case TR::java_lang_Long_rotateLeft:
case TR::java_lang_Long_rotateRight:
return TR::Compiler->target.cpu.isX86() || TR::Compiler->target.cpu.isZ() || (TR::Compiler->target.cpu.isPower() && TR::Compiler->target.is64Bit());
case TR::java_lang_Math_abs_I:
case TR::java_lang_Math_abs_L:
case TR::java_lang_Math_abs_F:
case TR::java_lang_Math_abs_D:
return TR::Compiler->target.cpu.isX86() || TR::Compiler->target.cpu.isZ();
return TR::Compiler->target.cpu.isX86() || TR::Compiler->target.cpu.isZ() || TR::Compiler->target.cpu.isPower();
case TR::java_lang_Math_max_I:
case TR::java_lang_Math_min_I:
case TR::java_lang_Math_max_L:
Expand Down Expand Up @@ -407,9 +411,31 @@ void J9::RecognizedCallTransformer::transform(TR::TreeTop* treetop)
case TR::java_lang_Integer_rotateLeft:
processIntrinsicFunction(treetop, node, TR::irol);
break;
case TR::java_lang_Integer_rotateRight:
{
// rotateRight(x, distance) = rotateLeft(x, -distance)
TR::Node *distance = TR::Node::create(node, TR::ineg, 1);
distance->setChild(0, node->getSecondChild());
node->setAndIncChild(1, distance);

processIntrinsicFunction(treetop, node, TR::irol);

break;
}
case TR::java_lang_Long_rotateLeft:
processIntrinsicFunction(treetop, node, TR::lrol);
break;
case TR::java_lang_Long_rotateRight:
{
// rotateRight(x, distance) = rotateLeft(x, -distance)
TR::Node *distance = TR::Node::create(node, TR::ineg, 1);
distance->setChild(0, node->getSecondChild());
node->setAndIncChild(1, distance);

processIntrinsicFunction(treetop, node, TR::lrol);

break;
}
case TR::java_lang_Math_abs_I:
processIntrinsicFunction(treetop, node, TR::iabs);
break;
Expand Down
19 changes: 2 additions & 17 deletions runtime/compiler/p/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,24 +335,9 @@ bool J9::Power::CodeGenerator::suppressInliningOfRecognizedMethod(TR::Recognized
return true;
}

if (method == TR::java_lang_Math_abs_F ||
method == TR::java_lang_Math_abs_D ||
method == TR::java_lang_Math_abs_I ||
method == TR::java_lang_Math_abs_L ||
method == TR::java_lang_Integer_highestOneBit ||
method == TR::java_lang_Integer_numberOfLeadingZeros ||
method == TR::java_lang_Integer_numberOfTrailingZeros ||
method == TR::java_lang_Integer_rotateLeft ||
method == TR::java_lang_Integer_rotateRight ||
method == TR::java_lang_Long_highestOneBit ||
method == TR::java_lang_Long_numberOfLeadingZeros ||
method == TR::java_lang_Long_numberOfTrailingZeros ||
method == TR::java_lang_Short_reverseBytes ||
if (method == TR::java_lang_Short_reverseBytes ||
method == TR::java_lang_Integer_reverseBytes ||
method == TR::java_lang_Long_reverseBytes ||
(TR::Compiler->target.is64Bit() &&
(method == TR::java_lang_Long_rotateLeft ||
method == TR::java_lang_Long_rotateRight)))
method == TR::java_lang_Long_reverseBytes)
{
return true;
}
Expand Down
Loading

0 comments on commit b3ebbcd

Please sign in to comment.