[pypy-commit] pypy faster-rstruct-2: add a passing test for single floats

antocuni pypy.commits at gmail.com
Fri May 12 10:29:21 EDT 2017


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: faster-rstruct-2
Changeset: r91264:a735e006ad8a
Date: 2017-05-12 01:18 +0200
http://bitbucket.org/pypy/pypy/changeset/a735e006ad8a/

Log:	add a passing test for single floats

diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py
--- a/rpython/jit/backend/llgraph/runner.py
+++ b/rpython/jit/backend/llgraph/runner.py
@@ -751,6 +751,8 @@
                               descr):
         T = self._get_int_type_from_size(bytes)
         val = lltype.cast_primitive(T, val)
+        if descr.A.OF == lltype.SingleFloat:
+            val = longlong.int2singlefloat(val)
         llop.gc_store_indexed(lltype.Void, struct, index, scale, base_ofs, val)
 
     def bh_gc_store_indexed_f(self, struct, index, scale, base_ofs, val, bytes,
diff --git a/rpython/rtyper/test/test_llop.py b/rpython/rtyper/test/test_llop.py
--- a/rpython/rtyper/test/test_llop.py
+++ b/rpython/rtyper/test/test_llop.py
@@ -54,6 +54,10 @@
         expected = struct.pack('d', 123.456)
         self.newlist_and_gc_store(rffi.DOUBLE, 123.456, expected)
 
+    def test_gc_store_indexed_float(self):
+        expected = struct.pack('f', 123.456)
+        self.newlist_and_gc_store(rffi.FLOAT, 123.456, expected)
+
 
 class TestDirect(BaseLLOpTest):
 


More information about the pypy-commit mailing list