diff --git a/compiler/codegen/OMRCodeGenerator.hpp b/compiler/codegen/OMRCodeGenerator.hpp index 755538f3de5..03e985bcac7 100644 --- a/compiler/codegen/OMRCodeGenerator.hpp +++ b/compiler/codegen/OMRCodeGenerator.hpp @@ -702,6 +702,19 @@ class OMR_EXTENSIBLE CodeGenerator bool opCodeIsNoOp(TR::ILOpCode &opCode); bool opCodeIsNoOpOnThisPlatform(TR::ILOpCode &opCode) {return false;} + /** + * @brief Determines whether integer multiplication decomposition should be deferred to the code generator. + * + * This function indicates if the decomposition of integer multiplication operations should + * be handled by the code generator instead of the optimizer (tree simplifier). Each architecture's + * code generator provides its own implementation of this function. By default, this function + * returns `false`, meaning that decomposition is not deferred to the code generator and the + * optimizer will attempt to simplify. + * + * @return true if integer multiplication decomposition should be deferred to the code generator, otherwise false. + */ + bool doIntMulDecompositionInCG() { return false; }; + bool supportsSinglePrecisionSQRT() {return false;} bool supportsFusedMultiplyAdd() {return false;} bool supportsNegativeFusedMultiplyAdd() {return false;} diff --git a/compiler/optimizer/OMRSimplifierHandlers.cpp b/compiler/optimizer/OMRSimplifierHandlers.cpp index fa1988ecf4b..8c0903f9f3a 100644 --- a/compiler/optimizer/OMRSimplifierHandlers.cpp +++ b/compiler/optimizer/OMRSimplifierHandlers.cpp @@ -8194,6 +8194,7 @@ TR::Node *imulSimplifier(TR::Node * node, TR::Block * block, TR::Simplifier * s) } } else if (secondChildOp == TR::iconst && + !s->comp()->cg()->doIntMulDecompositionInCG() && !s->getLastRun() && secondChild->getInt()!=0 && !isNonNegativePowerOf2(secondChild->getInt()) && secondChild->getInt() != TR::getMinSigned()) @@ -8588,7 +8589,10 @@ TR::Node *lmulSimplifier(TR::Node * node, TR::Block * block, TR::Simplifier * s) } } } - else if (s->comp()->target().is64Bit() && secondChildOp==TR::lconst && !s->getLastRun() && secondChild->getLongInt()!=0 && !isNonNegativePowerOf2(secondChild->getLongInt()) && secondChild->getLongInt() != TR::getMinSigned()) + else if (s->comp()->target().is64Bit() && !s->comp()->cg()->doIntMulDecompositionInCG() && + secondChildOp == TR::lconst && !s->getLastRun() && secondChild->getLongInt() != 0 && + !isNonNegativePowerOf2(secondChild->getLongInt()) && + secondChild->getLongInt() != TR::getMinSigned()) { decomposeMultiply(node, s, true); } diff --git a/compiler/x/codegen/OMRCodeGenerator.hpp b/compiler/x/codegen/OMRCodeGenerator.hpp index cdcabdfca65..c2cddc6e947 100644 --- a/compiler/x/codegen/OMRCodeGenerator.hpp +++ b/compiler/x/codegen/OMRCodeGenerator.hpp @@ -533,6 +533,8 @@ class OMR_EXTENSIBLE CodeGenerator : public OMR::CodeGenerator bool supportsAddressRematerialization(); bool supportsXMMRRematerialization(); + bool doIntMulDecompositionInCG() { return true; }; + TR::Instruction *setLastCatchAppendInstruction(TR::Instruction *i) {return (_lastCatchAppendInstruction=i);} TR::Instruction *getLastCatchAppendInstruction() {return _lastCatchAppendInstruction;}