Author: Richard Plangger <planri...@gmail.com>
Branch: s390x-backend
Changeset: r81571:38d3cd409efc
Date: 2016-01-05 10:35 +0100
http://bitbucket.org/pypy/pypy/changeset/38d3cd409efc/

Log:    added more failing tests for the pool, filling the literal pool
        after the trace list has been rewritten (did not switch the order
        for bridges, fixes more tests)

diff --git a/rpython/jit/backend/zarch/assembler.py 
b/rpython/jit/backend/zarch/assembler.py
--- a/rpython/jit/backend/zarch/assembler.py
+++ b/rpython/jit/backend/zarch/assembler.py
@@ -608,13 +608,13 @@
 
         arglocs = self.rebuild_faillocs_from_descr(faildescr, inputargs)
         regalloc = Regalloc(assembler=self)
-        self.pool.pre_assemble(self, operations, bridge=True)
-        startpos = self.mc.get_relative_pos()
-        self.mc.LARL(r.POOL, l.halfword(self.pool.pool_start - startpos))
         operations = regalloc.prepare_bridge(inputargs, arglocs,
                                              operations,
                                              self.current_clt.allgcrefs,
                                              self.current_clt.frame_info)
+        self.pool.pre_assemble(self, operations, bridge=True)
+        startpos = self.mc.get_relative_pos()
+        self.mc.LARL(r.POOL, l.halfword(self.pool.pool_start - startpos))
         self._check_frame_depth(self.mc, regalloc.get_gcmap())
         frame_depth_no_fixed_size = self._assemble(regalloc, inputargs, 
operations)
         codeendpos = self.mc.get_relative_pos()
diff --git a/rpython/jit/backend/zarch/test/test_pool.py 
b/rpython/jit/backend/zarch/test/test_pool.py
--- a/rpython/jit/backend/zarch/test/test_pool.py
+++ b/rpython/jit/backend/zarch/test/test_pool.py
@@ -2,8 +2,10 @@
 from rpython.jit.metainterp.history import (AbstractFailDescr,
          AbstractDescr, BasicFailDescr, BasicFinalDescr, JitCellToken,
          TargetToken, ConstInt, ConstPtr, Const, ConstFloat)
-from rpython.jit.metainterp.resoperation import ResOperation, rop
+from rpython.jit.metainterp.resoperation import (ResOperation, rop,
+         InputArgInt)
 from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
+from rpython.jit.backend.zarch.helper.regalloc import check_imm32
 import py
 
 class TestPoolZARCH(object):
@@ -30,3 +32,18 @@
         self.ensure_can_hold(rop.CALL_MALLOC_GC, [c], descr=self.calldescr)
         assert self.const_in_pool(c)
         assert self.const_in_pool(ConstPtr(rffi.cast(llmemory.GCREF, 
0xdeadbeef)))
+
+    @py.test.mark.parametrize('opnum',
+            [rop.INT_ADD, rop.INT_SUB, rop.INT_MUL])
+    def test_constants_arith(self, opnum):
+        for c1 in [ConstInt(1), ConstInt(2**44), InputArgInt(1)]:
+            for c2 in [InputArgInt(1), ConstInt(1), ConstInt(2**55)]:
+                self.ensure_can_hold(opnum, [c1,c2])
+                if c1.is_constant() and check_imm32(c1):
+                    assert self.const_in_pool(c1)
+                else:
+                    assert not self.const_in_pool(c1)
+                if c2.is_constant() and check_imm32(c2):
+                    assert self.const_in_pool(c2)
+                else:
+                    assert not self.const_in_pool(c2)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to