mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
8190869: C2: missing strength reduction of Math.pow(x, 2.0D) to x*x
Reviewed-by: kvn
This commit is contained in:
parent
3541733024
commit
0c05e5a478
2 changed files with 25 additions and 3 deletions
|
@ -1789,10 +1789,19 @@ bool LibraryCallKit::inline_math_native(vmIntrinsics::ID id) {
|
|||
return StubRoutines::dexp() != NULL ?
|
||||
runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dexp(), "dexp") :
|
||||
runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dexp), "EXP");
|
||||
case vmIntrinsics::_dpow:
|
||||
return StubRoutines::dpow() != NULL ?
|
||||
runtime_math(OptoRuntime::Math_DD_D_Type(), StubRoutines::dpow(), "dpow") :
|
||||
case vmIntrinsics::_dpow: {
|
||||
Node* exp = round_double_node(argument(2));
|
||||
const TypeD* d = _gvn.type(exp)->isa_double_constant();
|
||||
if (d != NULL && d->getd() == 2.0) {
|
||||
// Special case: pow(x, 2.0) => x * x
|
||||
Node* base = round_double_node(argument(0));
|
||||
set_result(_gvn.transform(new MulDNode(base, base)));
|
||||
return true;
|
||||
}
|
||||
return StubRoutines::dexp() != NULL ?
|
||||
runtime_math(OptoRuntime::Math_DD_D_Type(), StubRoutines::dpow(), "dpow") :
|
||||
runtime_math(OptoRuntime::Math_DD_D_Type(), FN_PTR(SharedRuntime::dpow), "POW");
|
||||
}
|
||||
#undef FN_PTR
|
||||
|
||||
// These intrinsics are not yet correctly implemented
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue