1716 PhiNode* result_val = new (C) PhiNode(result_region, Type::DOUBLE);
1717
1718 result_region->init_req(1, if_fast);
1719 result_val->init_req(1, result);
1720
1721 set_control(if_slow);
1722
1723 const TypePtr* no_memory_effects = NULL;
1724 Node* rt = make_runtime_call(RC_LEAF, call_type, funcAddr, funcName,
1725 no_memory_effects,
1726 x, top(), y, y ? top() : NULL);
1727 Node* value = _gvn.transform(new (C) ProjNode(rt, TypeFunc::Parms+0));
1728 #ifdef ASSERT
1729 Node* value_top = _gvn.transform(new (C) ProjNode(rt, TypeFunc::Parms+1));
1730 assert(value_top == top(), "second value must be top");
1731 #endif
1732
1733 result_region->init_req(2, control());
1734 result_val->init_req(2, value);
1735 set_control(_gvn.transform(result_region));
1736 return result_val;
1737 } else {
1738 return result;
1739 }
1740 }
1741 }
1742
1743 //------------------------------inline_exp-------------------------------------
1744 // Inline exp instructions, if possible. The Intel hardware only misses
1745 // really odd corner cases (+/- Infinity). Just uncommon-trap them.
1746 bool LibraryCallKit::inline_exp() {
1747 Node* arg = round_double_node(argument(0));
1748 Node* n = _gvn.transform(new (C) ExpDNode(C, control(), arg));
1749
1750 n = finish_pow_exp(n, arg, NULL, OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP");
1751 set_result(n);
1752
1753 C->set_has_split_ifs(true); // Has chance for split-if optimization
1754 return true;
1755 }
1756
1911 // Set complex path fast result
1912 r->init_req(2, ylong_path);
1913 phi->init_req(2, signresult);
1914
1915 static const jlong nan_bits = CONST64(0x7ff8000000000000);
1916 Node *slow_result = makecon(TypeD::make(*(double*)&nan_bits)); // return NaN
1917 r->init_req(1,slow_path);
1918 phi->init_req(1,slow_result);
1919
1920 // Post merge
1921 set_control(_gvn.transform(r));
1922 record_for_igvn(r);
1923 result = _gvn.transform(phi);
1924 }
1925
1926 result = finish_pow_exp(result, x, y, OptoRuntime::Math_DD_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dpow), "POW");
1927
1928 // control from finish_pow_exp is now input to the region node
1929 region_node->set_req(2, control());
1930 // the result from finish_pow_exp is now input to the phi node
1931 phi_node->init_req(2, _gvn.transform(result));
1932 set_control(_gvn.transform(region_node));
1933 record_for_igvn(region_node);
1934 set_result(_gvn.transform(phi_node));
1935
1936 C->set_has_split_ifs(true); // Has chance for split-if optimization
1937 return true;
1938 }
1939
1940 //------------------------------runtime_math-----------------------------
1941 bool LibraryCallKit::runtime_math(const TypeFunc* call_type, address funcAddr, const char* funcName) {
1942 assert(call_type == OptoRuntime::Math_DD_D_Type() || call_type == OptoRuntime::Math_D_D_Type(),
1943 "must be (DD)D or (D)D type");
1944
1945 // Inputs
1946 Node* a = round_double_node(argument(0));
1947 Node* b = (call_type == OptoRuntime::Math_DD_D_Type()) ? round_double_node(argument(2)) : NULL;
1948
1949 const TypePtr* no_memory_effects = NULL;
1950 Node* trig = make_runtime_call(RC_LEAF, call_type, funcAddr, funcName,
1951 no_memory_effects,
|
1716 PhiNode* result_val = new (C) PhiNode(result_region, Type::DOUBLE);
1717
1718 result_region->init_req(1, if_fast);
1719 result_val->init_req(1, result);
1720
1721 set_control(if_slow);
1722
1723 const TypePtr* no_memory_effects = NULL;
1724 Node* rt = make_runtime_call(RC_LEAF, call_type, funcAddr, funcName,
1725 no_memory_effects,
1726 x, top(), y, y ? top() : NULL);
1727 Node* value = _gvn.transform(new (C) ProjNode(rt, TypeFunc::Parms+0));
1728 #ifdef ASSERT
1729 Node* value_top = _gvn.transform(new (C) ProjNode(rt, TypeFunc::Parms+1));
1730 assert(value_top == top(), "second value must be top");
1731 #endif
1732
1733 result_region->init_req(2, control());
1734 result_val->init_req(2, value);
1735 set_control(_gvn.transform(result_region));
1736 return _gvn.transform(result_val);
1737 } else {
1738 return result;
1739 }
1740 }
1741 }
1742
1743 //------------------------------inline_exp-------------------------------------
1744 // Inline exp instructions, if possible. The Intel hardware only misses
1745 // really odd corner cases (+/- Infinity). Just uncommon-trap them.
1746 bool LibraryCallKit::inline_exp() {
1747 Node* arg = round_double_node(argument(0));
1748 Node* n = _gvn.transform(new (C) ExpDNode(C, control(), arg));
1749
1750 n = finish_pow_exp(n, arg, NULL, OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dexp), "EXP");
1751 set_result(n);
1752
1753 C->set_has_split_ifs(true); // Has chance for split-if optimization
1754 return true;
1755 }
1756
1911 // Set complex path fast result
1912 r->init_req(2, ylong_path);
1913 phi->init_req(2, signresult);
1914
1915 static const jlong nan_bits = CONST64(0x7ff8000000000000);
1916 Node *slow_result = makecon(TypeD::make(*(double*)&nan_bits)); // return NaN
1917 r->init_req(1,slow_path);
1918 phi->init_req(1,slow_result);
1919
1920 // Post merge
1921 set_control(_gvn.transform(r));
1922 record_for_igvn(r);
1923 result = _gvn.transform(phi);
1924 }
1925
1926 result = finish_pow_exp(result, x, y, OptoRuntime::Math_DD_D_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::dpow), "POW");
1927
1928 // control from finish_pow_exp is now input to the region node
1929 region_node->set_req(2, control());
1930 // the result from finish_pow_exp is now input to the phi node
1931 phi_node->init_req(2, result);
1932 set_control(_gvn.transform(region_node));
1933 record_for_igvn(region_node);
1934 set_result(_gvn.transform(phi_node));
1935
1936 C->set_has_split_ifs(true); // Has chance for split-if optimization
1937 return true;
1938 }
1939
1940 //------------------------------runtime_math-----------------------------
1941 bool LibraryCallKit::runtime_math(const TypeFunc* call_type, address funcAddr, const char* funcName) {
1942 assert(call_type == OptoRuntime::Math_DD_D_Type() || call_type == OptoRuntime::Math_D_D_Type(),
1943 "must be (DD)D or (D)D type");
1944
1945 // Inputs
1946 Node* a = round_double_node(argument(0));
1947 Node* b = (call_type == OptoRuntime::Math_DD_D_Type()) ? round_double_node(argument(2)) : NULL;
1948
1949 const TypePtr* no_memory_effects = NULL;
1950 Node* trig = make_runtime_call(RC_LEAF, call_type, funcAddr, funcName,
1951 no_memory_effects,
|