[pypy-svn] pypy jit-longlong-2: Simplify 'llong_from_two_ints' into just 'llong_from_uint'.
arigo
commits-noreply at bitbucket.org
Sat Feb 12 17:40:24 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: jit-longlong-2
Changeset: r41849:5fddae1b98e2
Date: 2011-02-12 13:54 +0100
http://bitbucket.org/pypy/pypy/changeset/5fddae1b98e2/
Log: Simplify 'llong_from_two_ints' into just 'llong_from_uint'.
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
@@ -1151,24 +1151,11 @@
self.mc.MOVD_xr(loc2.value, edx.value)
self.mc.PUNPCKLDQ_xx(resloc.value, loc2.value)
- def genop_llong_from_two_ints(self, op, arglocs, resloc):
+ def genop_llong_from_uint(self, op, arglocs, resloc):
+ loc1, = arglocs
assert isinstance(resloc, RegLoc)
- loc1, loc2, loc3 = arglocs
- #
- if isinstance(loc1, ConstFloatLoc):
- self.mc.MOVSD(resloc, loc1)
- else:
- assert isinstance(loc1, RegLoc)
- self.mc.MOVD_xr(resloc.value, loc1.value)
- #
- if loc2 is not None:
- assert isinstance(loc3, RegLoc)
- if isinstance(loc2, ConstFloatLoc):
- self.mc.MOVSD(loc3, loc2)
- else:
- assert isinstance(loc2, RegLoc)
- self.mc.MOVD_xr(loc3.value, loc2.value)
- self.mc.PUNPCKLDQ_xx(resloc.value, loc3.value)
+ assert isinstance(loc1, RegLoc)
+ self.mc.MOVD_xr(resloc.value, loc1.value)
def genop_llong_eq(self, op, arglocs, resloc):
loc1, loc2, locxtmp = arglocs
diff --git a/pypy/jit/codewriter/support.py b/pypy/jit/codewriter/support.py
--- a/pypy/jit/codewriter/support.py
+++ b/pypy/jit/codewriter/support.py
@@ -300,9 +300,8 @@
def _ll_1_llong_from_int(x):
return r_longlong(intmask(x))
-def _ll_2_llong_from_two_ints(x_lo, x_hi):
- z = (r_ulonglong(r_uint(x_hi)) << 32) | r_ulonglong(r_uint(x_lo))
- return u_to_longlong(z)
+def _ll_2_llong_from_uint(x):
+ return r_longlong(r_uint(x))
def _ll_1_llong_to_int(xll):
return intmask(xll)
diff --git a/pypy/jit/codewriter/effectinfo.py b/pypy/jit/codewriter/effectinfo.py
--- a/pypy/jit/codewriter/effectinfo.py
+++ b/pypy/jit/codewriter/effectinfo.py
@@ -71,7 +71,7 @@
OS_LLONG_UGT = 90
OS_LLONG_UGE = 91
OS_LLONG_URSHIFT = 92
- OS_LLONG_FROM_TWO_INTS = 93
+ OS_LLONG_FROM_UINT = 93
def __new__(cls, readonly_descrs_fields,
write_descrs_fields, write_descrs_arrays,
diff --git a/pypy/jit/codewriter/jtransform.py b/pypy/jit/codewriter/jtransform.py
--- a/pypy/jit/codewriter/jtransform.py
+++ b/pypy/jit/codewriter/jtransform.py
@@ -836,8 +836,7 @@
('truncate_longlong_to_int', 'TO_INT'),
('cast_float_to_longlong', 'FROM_FLOAT'),
('cast_longlong_to_float', 'TO_FLOAT'),
- # internal pseuso-operation:
- ('two_ints_to_longlong', 'FROM_TWO_INTS'),
+ ('cast_uint_to_longlong', 'FROM_UINT'),
]:
exec py.code.Source('''
def rewrite_op_%s(self, op):
@@ -890,9 +889,7 @@
if rffi.cast(op.args[0].concretetype, -1) < 0:
opname = 'cast_int_to_longlong'
else:
- opname = 'two_ints_to_longlong'
- c_hi = Constant(0, lltype.Signed)
- args = [args[0], c_hi]
+ opname = 'cast_uint_to_longlong'
op1 = SpaceOperation(opname, args, op.result)
return self.rewrite_operation(op1)
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
@@ -726,36 +726,11 @@
self.PerformLLong(op, [loc1, loc2], loc0)
self.rm.possibly_free_var(box)
- def _consider_llong_from_two_ints(self, op):
+ def _consider_llong_from_uint(self, op):
assert IS_X86_32
- box1 = op.getarg(1)
- box2 = op.getarg(2)
loc0 = self.xrm.force_allocate_reg(op.result)
- #
- if isinstance(box1, ConstInt) and isinstance(box2, ConstInt):
- # all-constant arguments: load the result value in a single step
- value64 = r_longlong(box2.value) << 32
- value64 |= r_longlong(r_uint(box1.value))
- loc1 = self._loc_of_const_longlong(value64)
- loc2 = None # unused
- loc3 = None # unused
- #
- else:
- tmpxvar = TempBox()
- loc3 = self.xrm.force_allocate_reg(tmpxvar, [op.result])
- self.xrm.possibly_free_var(tmpxvar)
- #
- if isinstance(box1, ConstInt):
- loc1 = self._loc_of_const_longlong(r_longlong(box1.value))
- else:
- loc1 = self.rm.make_sure_var_in_reg(box1)
- #
- if isinstance(box2, ConstInt):
- loc2 = self._loc_of_const_longlong(r_longlong(box2.value))
- else:
- loc2 = self.rm.make_sure_var_in_reg(box2, [box1])
- #
- self.PerformLLong(op, [loc1, loc2, loc3], loc0)
+ loc1 = self.rm.make_sure_var_in_reg(op.getarg(1))
+ self.PerformLLong(op, [loc1], loc0)
self.rm.possibly_free_vars_for_op(op)
def _call(self, op, arglocs, force_store=[], guard_not_forced_op=None):
@@ -805,8 +780,8 @@
return self._consider_llong_to_int(op)
if oopspecindex == EffectInfo.OS_LLONG_FROM_INT:
return self._consider_llong_from_int(op)
- if oopspecindex == EffectInfo.OS_LLONG_FROM_TWO_INTS:
- return self._consider_llong_from_two_ints(op)
+ if oopspecindex == EffectInfo.OS_LLONG_FROM_UINT:
+ return self._consider_llong_from_uint(op)
if (oopspecindex == EffectInfo.OS_LLONG_EQ or
oopspecindex == EffectInfo.OS_LLONG_NE):
return self._consider_llong_eq_ne_xx(op)
More information about the Pypy-commit
mailing list