[pypy-svn] r53383 - in pypy/branch/jit-hotpath/pypy/jit/hintannotator: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Sat Apr 5 13:50:34 CEST 2008


Author: cfbolz
Date: Sat Apr  5 13:50:33 2008
New Revision: 53383

Modified:
   pypy/branch/jit-hotpath/pypy/jit/hintannotator/model.py
   pypy/branch/jit-hotpath/pypy/jit/hintannotator/test/test_annotator.py
Log:
add float operations to the hintannotator


Modified: pypy/branch/jit-hotpath/pypy/jit/hintannotator/model.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/hintannotator/model.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/hintannotator/model.py	Sat Apr  5 13:50:33 2008
@@ -12,12 +12,16 @@
                       indirect_call
                       int_is_true int_neg int_abs int_invert bool_not
                       int_neg_ovf int_abs_ovf
+                      float_is_true
                       uint_is_true
                       cast_int_to_char
+                      cast_int_to_float
+                      cast_float_to_int
                       cast_int_to_uint
                       cast_uint_to_int
                       cast_char_to_int
                       cast_bool_to_int
+                      cast_bool_to_float
                       cast_ptr_to_int
                       ptr_nonzero
                       ptr_iszero
@@ -43,9 +47,12 @@
                        int_floordiv_ovf int_lshift_ovf int_add_nonneg_ovf
                        uint_add uint_sub uint_mul uint_mod uint_and
                        uint_lshift uint_rshift uint_floordiv
+                       float_add float_sub float_mul float_truediv
                        char_gt char_lt char_le char_ge char_eq char_ne
                        int_gt int_lt int_le int_ge int_eq int_ne
                        uint_gt uint_lt uint_le uint_ge uint_eq uint_ne 
+
+                       float_gt float_lt float_le float_ge float_eq float_ne
                        getarrayitem setarrayitem
                        getarraysubstruct
                        ptr_eq ptr_ne""".split()

Modified: pypy/branch/jit-hotpath/pypy/jit/hintannotator/test/test_annotator.py
==============================================================================
--- pypy/branch/jit-hotpath/pypy/jit/hintannotator/test/test_annotator.py	(original)
+++ pypy/branch/jit-hotpath/pypy/jit/hintannotator/test/test_annotator.py	Sat Apr  5 13:50:33 2008
@@ -117,6 +117,21 @@
         assert len(hs.origins) == 4
         assert hs.concretetype == lltype.Signed
 
+    def test_simple_float(self):
+        def ll_function(x, y):
+            if x:
+                z = x+y * y
+            else:
+                z = x-y / y
+            if int(x):
+                z += x > y + x < y + z == y + z != y
+            else:
+                z += x >= y + x <= y
+            return z
+        hs = self.hannotate(ll_function, [float, float])
+        assert isinstance(hs, SomeLLAbstractConstant)
+        assert hs.concretetype == lltype.Float
+
     def test_simple_hint_result(self):
         def ll_function(cond, x,y):
             if cond:



More information about the Pypy-commit mailing list