[pypy-commit] pypy s390x-backend: SG substracts, STG stores. fixed problem that did not remap locations correctly, test_jump now passes
plan_rich
noreply at buildbot.pypy.org
Tue Nov 24 03:45:24 EST 2015
Author: Richard Plangger <planrichi at gmail.com>
Branch: s390x-backend
Changeset: r80877:bc5a54c347e6
Date: 2015-11-24 09:45 +0100
http://bitbucket.org/pypy/pypy/changeset/bc5a54c347e6/
Log: SG substracts, STG stores. fixed problem that did not remap
locations correctly, test_jump now passes
diff --git a/rpython/jit/backend/test/runner_test.py b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -1222,6 +1222,59 @@
got = self.cpu.get_float_value(deadframe, k)
assert got == retvalues[k]
+ def test_jump_simple(self):
+ # this test generates small loops where the JUMP passes many
+ # arguments of various types, shuffling them around.
+ arg_count = 15
+ inputargs = [InputArgInt() for i in range(arg_count)]
+ #
+ index_counter = len(inputargs)
+ i0 = InputArgInt()
+
+ jumpargs = inputargs[:]
+ remixing = [(0,1),(2,1),(4,7)]
+ for a,b in remixing:
+ jumpargs[a],jumpargs[b] = jumpargs[b],jumpargs[a]
+ #
+ looptoken = JitCellToken()
+ targettoken = TargetToken()
+ faildescr = BasicFailDescr(15)
+ inputargs.append(i0)
+ op0 = ResOperation(rop.LABEL, inputargs, descr=targettoken)
+ op1 = ResOperation(rop.INT_SUB, [i0, ConstInt(1)])
+ op2 = ResOperation(rop.INT_GE, [op1, ConstInt(0)])
+ op3 = ResOperation(rop.GUARD_TRUE, [op2])
+ jumpargs.append(op1)
+ op4 = ResOperation(rop.JUMP, jumpargs, descr=targettoken)
+ operations = [op0, op1, op2, op3, op4]
+ operations[3].setfailargs(inputargs[:])
+ operations[3].setdescr(faildescr)
+ #
+ loop_count = 11
+ self.cpu.compile_loop(inputargs, operations, looptoken)
+ values = [i for i in range(arg_count)]
+ #
+ vals = values + [loop_count]
+ print("args", inputargs)
+ print("jump", jumpargs)
+ print("entering with values", vals)
+ deadframe = self.cpu.execute_token(looptoken, *vals)
+ fail = self.cpu.get_latest_descr(deadframe)
+ assert fail.identifier == 15
+ #
+ dstvalues = values[:]
+ for _ in range(loop_count):
+ for a,b in remixing:
+ dstvalues[a],dstvalues[b] = dstvalues[b],dstvalues[a]
+ #
+ #assert dstvalues[index_counter] == loop_count
+ #dstvalues[index_counter] = 0
+ expected = [self.cpu.get_int_value(deadframe, i) for i in range(arg_count)]
+ for i, (box, val) in enumerate(zip(inputargs[:-1], dstvalues)):
+ got = self.cpu.get_int_value(deadframe, i)
+ assert type(got) == type(val)
+ assert got == val
+
def test_jump(self):
# this test generates small loops where the JUMP passes many
# arguments of various types, shuffling them around.
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
@@ -382,6 +382,7 @@
loc"""
index = WORD * (~already_pushed)
+ print("regalloc push", index)
if loc.type == FLOAT:
if not loc.is_fp_reg():
@@ -392,12 +393,13 @@
if not loc.is_core_reg():
self.regalloc_mov(loc, r.SCRATCH)
loc = r.SCRATCH
- self.mc.SG(loc, l.addr(index, r.SP))
+ self.mc.STG(loc, l.addr(index, r.SP))
def regalloc_pop(self, loc, already_pushed):
"""Pops the value on top of the stack to loc. Can trash the current
value of SCRATCH when popping to a stack loc"""
index = WORD * (~already_pushed)
+ print("regalloc pop", index)
if loc.type == FLOAT:
if loc.is_fp_reg():
diff --git a/rpython/jit/backend/zarch/instructions.py b/rpython/jit/backend/zarch/instructions.py
--- a/rpython/jit/backend/zarch/instructions.py
+++ b/rpython/jit/backend/zarch/instructions.py
@@ -137,7 +137,6 @@
# store memory
'STMG': ('rsy_a', ['\xEB','\x24']),
- 'ST': ('rx', ['\x50']),
'STG': ('rxy', ['\xE3','\x24']),
'STY': ('rxy', ['\xE3','\x50']),
diff --git a/rpython/jit/backend/zarch/regalloc.py b/rpython/jit/backend/zarch/regalloc.py
--- a/rpython/jit/backend/zarch/regalloc.py
+++ b/rpython/jit/backend/zarch/regalloc.py
@@ -816,7 +816,7 @@
# get temporary locs
tmploc = r.SCRATCH
- fptmploc = r.f0
+ fptmploc = r.FP_SCRATCH
# Part about non-floats
src_locations1 = []
More information about the pypy-commit
mailing list