Skip to content

Commit

Permalink
Merge pull request #17861 from jmesyou/intrinsics/multiplyHigh
Browse files Browse the repository at this point in the history
Recognize @IntrinsicCandidate java.lang.Math.multiplyHigh
  • Loading branch information
jdmpapin committed Aug 31, 2023
2 parents ecc612b + f03f364 commit 022a2a4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions runtime/compiler/codegen/J9RecognizedMethodsEnum.hpp
Expand Up @@ -122,6 +122,7 @@
java_lang_Math_tanh,
java_lang_Math_fma_D,
java_lang_Math_fma_F,
java_lang_Math_multiplyHigh,
java_lang_Object_init,
java_lang_Object_getClass,
java_lang_Object_clone,
Expand Down
2 changes: 2 additions & 0 deletions runtime/compiler/env/j9method.cpp
Expand Up @@ -2254,6 +2254,7 @@ void TR_ResolvedJ9Method::construct()
{x(TR::java_lang_Math_tanh, "tanh", "(D)D")},
{x(TR::java_lang_Math_fma_D, "fma", "(DDD)D")},
{x(TR::java_lang_Math_fma_F, "fma", "(FFF)F")},
{x(TR::java_lang_Math_multiplyHigh, "multiplyHigh", "(JJ)J")},
{ TR::unknownMethod}
};

Expand Down Expand Up @@ -4667,6 +4668,7 @@ TR_ResolvedJ9Method::setRecognizedMethodInfo(TR::RecognizedMethod rm)
case TR::java_lang_Math_abs_L:
case TR::java_lang_Math_abs_F:
case TR::java_lang_Math_abs_D:
case TR::java_lang_Math_multiplyHigh:
case TR::java_lang_Long_reverseBytes:
case TR::java_lang_Integer_reverseBytes:
case TR::java_lang_Short_reverseBytes:
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/il/J9MethodSymbol.cpp
Expand Up @@ -67,6 +67,7 @@ J9::MethodSymbol::isPureFunction()
case TR::java_lang_Math_min_L:
case TR::java_lang_Math_min_F:
case TR::java_lang_Math_min_D:
case TR::java_lang_Math_multiplyHigh:
case TR::java_lang_Math_nextAfter_F:
case TR::java_lang_Math_nextAfter_D:
case TR::java_lang_Math_pow:
Expand Down
5 changes: 5 additions & 0 deletions runtime/compiler/optimizer/J9RecognizedCallTransformer.cpp
Expand Up @@ -1117,6 +1117,8 @@ bool J9::RecognizedCallTransformer::isInlineable(TR::TreeTop* treetop)
case TR::java_lang_Math_max_L:
case TR::java_lang_Math_min_L:
return !comp()->getOption(TR_DisableMaxMinOptimization);
case TR::java_lang_Math_multiplyHigh:
return cg()->getSupportsLMulHigh();
case TR::java_lang_StringUTF16_toBytes:
return !comp()->compileRelocatableCode();
case TR::java_lang_StrictMath_sqrt:
Expand Down Expand Up @@ -1241,6 +1243,9 @@ void J9::RecognizedCallTransformer::transform(TR::TreeTop* treetop)
case TR::java_lang_Math_min_L:
processIntrinsicFunction(treetop, node, TR::lmin);
break;
case TR::java_lang_Math_multiplyHigh:
processIntrinsicFunction(treetop, node, TR::lmulh);
break;
case TR::java_lang_StringUTF16_toBytes:
process_java_lang_StringUTF16_toBytes(treetop, node);
break;
Expand Down

0 comments on commit 022a2a4

Please sign in to comment.