Hi pypy list,
I'd like to prototype an interpreter in rpython. But this interpreter must
feature floating point support. Something like the context in the decimal
module of python : (decimal is basically a floating point unit in python)
import decimal
# do an operation
decimal.Decimal("6e4565465") * decimal.Decimal("6e67654")
# Verify overflow
decimal.getcontext().flags[decimal.Overflow] # leads 1 => overflow !
My interpreter must provide access to the "flags" field (OverFlow, Inexact,
DivisionByZero...) Currently I have a prototype in c and I directly use the
intrinsics of X86 (sse2) to retrieve theses flags :
// compute a sqrt using intrinsics
__builtin_ia32_sqrtss(...);
// get status register of sse2 fpu
int mxcsr = __builtin_ia32_stmxcsr();
// extract overflow bit :
overflow = (mxcsr & 0x8);
// extract ...
If I want to implement this in rpython, I see 2 solutions :
1. Porting decimal to rpython : seems to be a lot of work and I wonder about
the performances.
2. Wrapping floating in a c library and use ctype : code clarity and jit
integration will be bad.
Do you see another possibility ? Any advices on this ?
Thanks !
Zariko.
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev