[pypy-commit] pypy arm-backend-2: Support math_sqrt operation in llgraph

bivab noreply at buildbot.pypy.org
Fri Feb 24 11:37:10 CET 2012


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r52846:521049834e9b
Date: 2012-02-24 10:35 +0000
http://bitbucket.org/pypy/pypy/changeset/521049834e9b/

Log:	Support math_sqrt operation in llgraph

diff --git a/pypy/jit/backend/llgraph/llimpl.py b/pypy/jit/backend/llgraph/llimpl.py
--- a/pypy/jit/backend/llgraph/llimpl.py
+++ b/pypy/jit/backend/llgraph/llimpl.py
@@ -20,6 +20,7 @@
 from pypy.jit.metainterp.resoperation import rop
 from pypy.jit.backend.llgraph import symbolic
 from pypy.jit.codewriter import longlong
+from pypy.jit.codewriter.effectinfo import EffectInfo
 
 from pypy.rlib import libffi, clibffi
 from pypy.rlib.objectmodel import ComputedIntSymbolic, we_are_translated
@@ -929,6 +930,11 @@
             raise NotImplementedError
 
     def op_call(self, calldescr, func, *args):
+        effectinfo = calldescr.get_extra_info()
+        if effectinfo is not None:
+            oopspecindex = effectinfo.oopspecindex
+            if oopspecindex == EffectInfo.OS_MATH_SQRT:
+                return do_math_sqrt(args[0])
         return self._do_call(calldescr, func, args, call_with_llptr=False)
 
     def op_call_release_gil(self, calldescr, func, *args):
@@ -1626,6 +1632,12 @@
     assert 0 <= dststart <= dststart + length <= len(dst.chars)
     rstr.copy_unicode_contents(src, dst, srcstart, dststart, length)
 
+def do_math_sqrt(value):
+    import math
+    y = cast_from_floatstorage(lltype.Float, value)
+    x = math.sqrt(y)
+    return cast_to_floatstorage(x)
+
 # ---------- call ----------
 
 _call_args_i = []


More information about the pypy-commit mailing list