Mercurial > hg > truffle
diff src/cpu/x86/vm/assembler_x86.hpp @ 6084:6759698e3140
7133857: exp() and pow() should use the x87 ISA on x86
Summary: use x87 instructions to implement exp() and pow() in interpreter/c1/c2.
Reviewed-by: kvn, never, twisti
author | roland |
---|---|
date | Tue, 15 May 2012 10:10:23 +0200 |
parents | fd8114661503 |
children | e7715c222897 |
line wrap: on
line diff
--- a/src/cpu/x86/vm/assembler_x86.hpp Mon May 14 09:36:00 2012 -0700 +++ b/src/cpu/x86/vm/assembler_x86.hpp Tue May 15 10:10:23 2012 +0200 @@ -1148,6 +1148,9 @@ void fxsave(Address dst); void fyl2x(); + void frndint(); + void f2xm1(); + void fldl2e(); void hlt(); @@ -2387,7 +2390,28 @@ void ldmxcsr(Address src) { Assembler::ldmxcsr(src); } void ldmxcsr(AddressLiteral src); + // compute pow(x,y) and exp(x) with x86 instructions. Don't cover + // all corner cases and may result in NaN and require fallback to a + // runtime call. + void fast_pow(); + void fast_exp(); + + // computes exp(x). Fallback to runtime call included. + void exp_with_fallback(int num_fpu_regs_in_use) { pow_or_exp(true, num_fpu_regs_in_use); } + // computes pow(x,y). Fallback to runtime call included. + void pow_with_fallback(int num_fpu_regs_in_use) { pow_or_exp(false, num_fpu_regs_in_use); } + private: + + // call runtime as a fallback for trig functions and pow/exp. + void fp_runtime_fallback(address runtime_entry, int nb_args, int num_fpu_regs_in_use); + + // computes 2^(Ylog2X); Ylog2X in ST(0) + void pow_exp_core_encoding(); + + // computes pow(x,y) or exp(x). Fallback to runtime call included. + void pow_or_exp(bool is_exp, int num_fpu_regs_in_use); + // these are private because users should be doing movflt/movdbl void movss(Address dst, XMMRegister src) { Assembler::movss(dst, src); }