Math trig intrinsics and compiler options

gustav trede gustav.trede at gmail.com
Wed Jul 15 11:52:25 UTC 2009


Hello,

Azeem Jiva told me an easy way to improve trig performance.
Changing the intrinsics to use an existing but faster path gives me a boost
of roughly 40% for the Math cos and sin on solaris x64.


library_call.cpp

bool LibraryCallKit::inline_math_native(vmIntrinsics::ID id) {
  switch (id) {

   case vmIntrinsics::_dcos: return Matcher::has_match_rule(Op_CosD) ?
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address,
SharedRuntime::dcos), "COS") : false;
   case vmIntrinsics::_dsin: return Matcher::has_match_rule(Op_SinD) ?
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address,
SharedRuntime::dsin), "SIN") : false;
   case vmIntrinsics::_dtan: return Matcher::has_match_rule(Op_TanD) ?
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address,
SharedRuntime::dtan), "TAN") : false;
   case vmIntrinsics::_dlog:   return Matcher::has_match_rule(Op_LogD) ?
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address,
SharedRuntime::dlog), "LOG") : false;
   case vmIntrinsics::_dlog10: return Matcher::has_match_rule(Op_Log10D) ?
runtime_math(OptoRuntime::Math_D_D_Type(), CAST_FROM_FN_PTR(address,
SharedRuntime::dlog10), "LOG10") : false;


Is there any potential problem with such a patch  ?





Compiler flags is another area of interest.
Both linux and windows platforms seems to turn off optimizations for
sharedRuntimeTrig.cpp :
sharedRuntimeTrig.cpp   has
#ifdef WIN32
# pragma optimize ( "", off )
#endif


hotspot/make/linux/makefiles/i486.make:# The copied fdlibm routines in
sharedRuntimeTrig.o must not be optimized
hotspot/make/linux/makefiles/i486.make:OPT_CFLAGS/sharedRuntimeTrig.o =
$(OPT_CFLAGS/NOOPT)
hotspot/make/linux/makefiles/amd64.make:# The copied fdlibm routines in
sharedRuntimeTrig.o must not be optimized
hotspot/make/linux/makefiles/amd64.make:OPT_CFLAGS/sharedRuntimeTrig.o =
$(OPT_CFLAGS/NOOPT)

Do we know if the situation has changed for these platforms ?


-- 
regards
 gustav trede
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20090715/98e80f89/attachment.html>


More information about the core-libs-dev mailing list