[pypy-svn] r63762 - in pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86: . test
fijal at codespeak.net
fijal at codespeak.net
Tue Apr 7 02:50:00 CEST 2009
Author: fijal
Date: Tue Apr 7 02:49:58 2009
New Revision: 63762
Modified:
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_exception.py
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py
Log:
implement int_lshift and int_lshift_ovf
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py Tue Apr 7 02:49:58 2009
@@ -403,14 +403,20 @@
def genop_bool_not(self, op, arglocs, resloc):
self.mc.XOR(arglocs[0], imm8(1))
- #def genop_int_lshift(self, op):
- # self.load(eax, op.args[0])
- # self.load(ecx, op.args[1])
- # self.mc.SHL(eax, cl)
- # self.mc.CMP(ecx, imm8(32))
- # self.mc.SBB(ecx, ecx)
- # self.mc.AND(eax, ecx)
- # self.save(eax, op.results[0])
+ def genop_int_lshift(self, op, arglocs, resloc):
+ loc = arglocs[0]
+ assert arglocs[1] is ecx
+ self.mc.SHL(loc, cl)
+ #self.mc.CMP(ecx, imm8(32)) XXX <- what's that???
+ #self.mc.SBB(ecx, ecx)
+ #self.mc.AND(loc, ecx)
+
+ def genop_guard_int_lshift_ovf(self, op, guard_op, addr, arglocs, resloc):
+ loc = arglocs[0]
+ self.mc.CMP(ecx, imm(31))
+ self.mc.JG(rel32(addr))
+ self.mc.SHL(loc, cl)
+ self.mc.JO(rel32(addr))
def genop_int_rshift(self, op, arglocs, resloc):
(x, y, tmp) = arglocs
@@ -427,6 +433,16 @@
self.mc.CMOVBE(tmp, y)
self.mc.SAR(resloc, cl)
+ def genop_uint_rshift(self, op, arglocs, resloc):
+ return
+ self.mc.MOV(eax, gv_x.operand(self))
+ self.mc.MOV(ecx, gv_y.operand(self))
+ self.mc.SHR(eax, cl)
+ self.mc.CMP(ecx, imm8(32))
+ self.mc.SBB(ecx, ecx)
+ self.mc.AND(eax, ecx)
+ return self.returnintvar(eax)
+
def genop_int_is_true(self, op, arglocs, resloc):
argloc = arglocs[0]
self.mc.TEST(argloc, argloc)
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py Tue Apr 7 02:49:58 2009
@@ -733,17 +733,24 @@
self.eventually_free_vars(op.args + [tmpvar])
self.Perform(op, [x, y, reg], x)
- def xxx_consider_int_lshift(self, op, guard_op):
- if guard_op is None:
- xxx
- self.mc.MOV(eax, gv_x.operand(self))
- self.mc.MOV(ecx, gv_y.operand(self))
- self.mc.SHL(eax, cl)
- self.mc.CMP(ecx, imm8(32))
- self.mc.SBB(ecx, ecx)
- self.mc.AND(eax, ecx)
- else:
- yyy
+ consider_uint_rshift = consider_int_rshift
+
+ def consider_int_lshift(self, op, ignored):
+ loc2 = self.make_sure_var_in_reg(op.args[1], [], ecx)
+ loc1 = self.force_result_in_reg(op.result, op.args[0], op.args)
+ self.Perform(op, [loc1, loc2], loc1)
+ self.eventually_free_vars(op.args)
+
+ def consider_int_lshift_ovf(self, op, guard_op):
+ loc2 = self.make_sure_var_in_reg(op.args[1], [], ecx)
+ loc1 = self.force_result_in_reg(op.result, op.args[0], op.args)
+ self.eventually_free_vars(op.args)
+ self.position += 1
+ regalloc = self.regalloc_for_guard(guard_op)
+ self.perform_with_guard(op, guard_op, regalloc, [loc1, loc2], loc1,
+ overflow=True)
+ self.eventually_free_vars(guard_op.inputargs)
+ self.eventually_free_var(guard_op.result)
def consider_int_mod(self, op, ignored):
l0 = self.make_sure_var_in_reg(op.args[0], [], eax)
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_exception.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_exception.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_exception.py Tue Apr 7 02:49:58 2009
@@ -6,8 +6,6 @@
class TestExceptions(Jit386Mixin, ExceptionTests):
# for the individual tests see
# ====> ../../../metainterp/test/test_exception.py
- def test_int_lshift_ovf(self):
- py.test.skip("XXX")
def test_bridge_from_interpreter_exc(self):
py.test.skip("Widening to trash")
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/test/test_runner.py Tue Apr 7 02:49:58 2009
@@ -485,9 +485,6 @@
cpu.do_strsetitem([x, BoxInt(4), BoxInt(ord('/'))])
assert x.getptr(lltype.Ptr(rstr.STR)).chars[4] == '/'
- def test_lshift(self):
- py.test.skip("XXX")
-
def test_oononnull_with_guard(self):
p = lltype.cast_opaque_ptr(llmemory.GCREF,
lltype.malloc(lltype.GcStruct('x')))
More information about the Pypy-commit
mailing list