Hi, On Fri, Jul 1, 2011 at 2:41 PM, Zariko Taba <zariko.t...@gmail.com> wrote: > // 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 ...
There is a third solution: do exactly the same kind of code, but in RPython instead of in C. This means using the rffi module. For example: builtin_ia32_sqrtss = rffi.llexternal("__builtin_ia32_sqrtss", [argtypes...], restype, _nowrapper=True, _callable=emulate_ia32_sqrtss) def f(..): ... builtin_ia32_sqrtss(..) ... with emulate_ia32_sqrtss() being a pure Python function that is going to be called only during tests. After translation to C, it will just turn into the C code that you posted above. For more examples, grep for "llexternal" in pypy/rlib/. A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev