[pypy-svn] r79788 - in pypy/branch/arm-backend/pypy/jit/backend/arm: . test
david at codespeak.net
david at codespeak.net
Fri Dec 3 18:15:17 CET 2010
Author: david
Date: Fri Dec 3 18:15:15 2010
New Revision: 79788
Modified:
pypy/branch/arm-backend/pypy/jit/backend/arm/opassembler.py
pypy/branch/arm-backend/pypy/jit/backend/arm/test/test_generated.py
Log:
Fix for int_sub and refactor guard_value
Modified: pypy/branch/arm-backend/pypy/jit/backend/arm/opassembler.py
==============================================================================
--- pypy/branch/arm-backend/pypy/jit/backend/arm/opassembler.py (original)
+++ pypy/branch/arm-backend/pypy/jit/backend/arm/opassembler.py Fri Dec 3 18:15:15 2010
@@ -69,17 +69,17 @@
imm_a0 = self._check_imm_arg(a0)
imm_a1 = self._check_imm_arg(a1)
if not imm_a0 and imm_a1:
- l0, box = self._ensure_value_is_boxed(a0, regalloc)
+ l0, box = self._ensure_value_is_boxed(a0, regalloc, boxes)
l1 = regalloc.make_sure_var_in_reg(a1, [a0])
boxes.append(box)
elif imm_a0 and not imm_a1:
l0 = regalloc.make_sure_var_in_reg(a0)
- l1, box = self._ensure_value_is_boxed(a1, regalloc)
+ l1, box = self._ensure_value_is_boxed(a1, regalloc, boxes)
boxes.append(box)
else:
- l0, box = self._ensure_value_is_boxed(a0, regalloc)
+ l0, box = self._ensure_value_is_boxed(a0, regalloc, boxes)
boxes.append(box)
- l1, box = self._ensure_value_is_boxed(a1, regalloc)
+ l1, box = self._ensure_value_is_boxed(a1, regalloc, boxes)
boxes.append(box)
res = regalloc.force_allocate_reg(op.result, boxes)
if l0.is_imm():
@@ -184,8 +184,7 @@
self.mc.MVN_rr(res.value, reg.value)
regalloc.possibly_free_vars_for_op(op)
- if op.result:
- regalloc.possibly_free_var(op.result)
+ regalloc.possibly_free_var(op.result)
return fcond
#XXX check for a better way of doing this
@@ -239,16 +238,23 @@
return self._emit_guard(op, regalloc, c.EQ)
def emit_op_guard_value(self, op, regalloc, fcond):
- a0 = op.getarg(0)
- a1 = op.getarg(1)
+ boxes = list(op.getarglist())
+ a0, a1 = boxes
imm_a1 = self._check_imm_arg(a1)
- l0 = regalloc.make_sure_var_in_reg(a0, imm_fine=False)
- l1 = regalloc.make_sure_var_in_reg(a1, imm_fine=imm_a1)
+ l0, box = self._ensure_value_is_boxed(a0, regalloc, boxes)
+ boxes.append(box)
+ if not imm_a1:
+ l1, box = self._ensure_value_is_boxed(a1, regalloc, boxes)
+ boxes.append(box)
+ else:
+ l1 = regalloc.make_sure_var_in_reg(a1)
+ regalloc.possibly_free_vars(boxes)
+ regalloc.possibly_free_var(op.result)
+
if l1.is_imm():
self.mc.CMP_ri(l0.value, l1.getint())
else:
self.mc.CMP_rr(l0.value, l1.value)
- regalloc.possibly_free_vars_for_op(op)
return self._emit_guard(op, regalloc, c.EQ)
emit_op_guard_nonnull = emit_op_guard_true
Modified: pypy/branch/arm-backend/pypy/jit/backend/arm/test/test_generated.py
==============================================================================
--- pypy/branch/arm-backend/pypy/jit/backend/arm/test/test_generated.py (original)
+++ pypy/branch/arm-backend/pypy/jit/backend/arm/test/test_generated.py Fri Dec 3 18:15:15 2010
@@ -383,6 +383,67 @@
assert op.identifier == 2
assert cpu.get_latest_value_int(0) == 16
assert cpu.get_latest_value_int(1) == -1
+
+ def test_wrong_guard3(self):
+ # random seed: 8029
+ # block length: 10
+ faildescr1 = BasicFailDescr(1)
+ faildescr2 = BasicFailDescr(2)
+ faildescr3 = BasicFailDescr(3)
+ faildescr4 = BasicFailDescr(4)
+ v1 = BoxInt()
+ v2 = BoxInt()
+ v3 = BoxInt()
+ v4 = BoxInt()
+ v5 = BoxInt()
+ v6 = BoxInt()
+ v7 = BoxInt()
+ v8 = BoxInt()
+ v9 = BoxInt()
+ v10 = BoxInt()
+ v11 = BoxInt()
+ v12 = BoxInt()
+ v13 = BoxInt()
+ v14 = BoxInt()
+ v15 = BoxInt()
+ v16 = BoxInt()
+ cpu = CPU(None, None)
+ inputargs = [v1, v2, v3, v4, v5, v6, v7, v8, v9, v10]
+ operations = [
+ ResOperation(rop.UINT_LT, [ConstInt(-11), v7], v11),
+ ResOperation(rop.INT_GE, [v3, v5], v12),
+ ResOperation(rop.INT_INVERT, [v9], v13),
+ ResOperation(rop.GUARD_VALUE, [v13, ConstInt(14)], None, descr=faildescr3),
+ ResOperation(rop.INT_IS_ZERO, [v12], v14),
+ ResOperation(rop.INT_SUB, [v2, v13], v15),
+ ResOperation(rop.GUARD_VALUE, [v15, ConstInt(-32)], None, descr=faildescr4),
+ ResOperation(rop.INT_FLOORDIV, [v3, ConstInt(805306366)], v16),
+ ResOperation(rop.GUARD_VALUE, [v15, ConstInt(0)], None, descr=faildescr1),
+ ResOperation(rop.FINISH, [v10, v8, v1, v6, v4], None, descr=faildescr2),
+ ]
+ operations[3].setfailargs([])
+ operations[-4].setfailargs([v15])
+ operations[-2].setfailargs([v9, v4, v10, v11, v14])
+ looptoken = LoopToken()
+ cpu.compile_loop(inputargs, operations, looptoken)
+ cpu.set_future_value_int(0, -39)
+ cpu.set_future_value_int(1, -18)
+ cpu.set_future_value_int(2, 1588243114)
+ cpu.set_future_value_int(3, -9)
+ cpu.set_future_value_int(4, -4)
+ cpu.set_future_value_int(5, 1252698794)
+ cpu.set_future_value_int(6, 0)
+ cpu.set_future_value_int(7, 715827882)
+ cpu.set_future_value_int(8, -15)
+ cpu.set_future_value_int(9, 536870912)
+ op = cpu.execute_token(looptoken)
+ assert op.identifier == 1
+ assert cpu.get_latest_value_int(0) == -15
+ assert cpu.get_latest_value_int(1) == -9
+ assert cpu.get_latest_value_int(2) == 536870912
+ assert cpu.get_latest_value_int(3) == 0
+ assert cpu.get_latest_value_int(4) == 0
+
def test_wrong_result(self):
# generated by:
# ../test/ test/test_zll_random.py -l -k arm -s --block-length=10 --random-seed=7389
More information about the Pypy-commit
mailing list