[pypy-svn] pypy jit-longlong: LLONG_FROM_INT.
arigo
commits-noreply at bitbucket.org
Sun Jan 9 12:02:46 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: jit-longlong
Changeset: r40509:729a3885effb
Date: 2011-01-09 11:58 +0100
http://bitbucket.org/pypy/pypy/changeset/729a3885effb/
Log: LLONG_FROM_INT.
diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -1115,6 +1115,17 @@
else:
not_implemented("llong_to_int: %s" % (loc,))
+ def genop_llong_from_int(self, op, arglocs, resloc):
+ assert isinstance(resloc, StackLoc)
+ loc = arglocs[0]
+ if isinstance(loc, ImmedLoc):
+ self.mc.MOV_bi(resloc.value, loc.value)
+ self.mc.MOV_bi(resloc.value + 4, loc.value >> 31)
+ else:
+ assert loc is eax
+ self.mc.CDQ() # eax -> eax:edx
+ self.mc.MOV_br(resloc.value, eax.value)
+ self.mc.MOV_br(resloc.value + 4, edx.value)
def genop_new_with_vtable(self, op, arglocs, result_loc):
assert result_loc is eax
diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py
--- a/pypy/jit/backend/x86/regalloc.py
+++ b/pypy/jit/backend/x86/regalloc.py
@@ -646,6 +646,19 @@
self.PerformLLong(op, [loc1], loc0)
self.xrm.possibly_free_var(op.getarg(1))
+ def _consider_llong_from_int(self, op):
+ # requires the argument to be in eax, and trash edx.
+ # requires the result to be in the stack.
+ loc0 = self.fm.loc(op.result)
+ loc1 = self.rm.make_sure_var_in_reg(op.getarg(1), selected_reg=eax)
+ if not isinstance(loc1, ImmedLoc):
+ tmpvar = TempBox()
+ self.rm.force_allocate_reg(tmpvar, [op.getarg(1)],
+ selected_reg=edx)
+ self.rm.possibly_free_var(tmpvar)
+ self.PerformLLong(op, [loc1], loc0)
+ self.rm.possibly_free_var(op.getarg(1))
+
def _call(self, op, arglocs, force_store=[], guard_not_forced_op=None):
save_all_regs = guard_not_forced_op is not None
self.rm.before_call(force_store, save_all_regs=save_all_regs)
@@ -691,6 +704,8 @@
return self._consider_llong_binop_rr(op)
if oopspecindex == EffectInfo.OS_LLONG_TO_INT:
return self._consider_llong_to_int(op)
+ if oopspecindex == EffectInfo.OS_LLONG_FROM_INT:
+ return self._consider_llong_from_int(op)
#
self._consider_call(op)
More information about the Pypy-commit
mailing list