[pypy-commit] pypy float-bytes: mostly working on 32-bit, reslts are still in longs, unclear if that's a bug on my end or I just need to call getfloatstorage in the tests
alex_gaynor
noreply at buildbot.pypy.org
Sat Mar 17 15:32:13 CET 2012
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: float-bytes
Changeset: r53759:441eaef46d36
Date: 2012-03-17 15:30 +0100
http://bitbucket.org/pypy/pypy/changeset/441eaef46d36/
Log: mostly working on 32-bit, reslts are still in longs, unclear if
that's a bug on my end or I just need to call getfloatstorage in the
tests
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
@@ -1244,9 +1244,12 @@
def genop_convert_float_bytes_to_longlong(self, op, arglocs, resloc):
loc0, = arglocs
- assert isinstance(resloc, RegLoc)
- assert isinstance(loc0, RegLoc)
- self.mc.MOVD(resloc, loc0)
+ if longlong.is_64_bit:
+ assert isinstance(resloc, RegLoc)
+ assert isinstance(loc0, RegLoc)
+ self.mc.MOVD(resloc, loc0)
+ else:
+ self.mov(loc0, resloc)
def genop_guard_int_is_true(self, op, guard_op, guard_token, arglocs, resloc):
guard_opnum = guard_op.getopnum()
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
@@ -767,10 +767,16 @@
consider_cast_singlefloat_to_float = consider_cast_int_to_float
def consider_convert_float_bytes_to_longlong(self, op):
- loc0 = self.xrm.make_sure_var_in_reg(op.getarg(0))
- loc1 = self.rm.force_allocate_reg(op.result)
- self.Perform(op, [loc0], loc1)
- self.xrm.possibly_free_var(op.getarg(0))
+ if longlong.is_64_bit:
+ loc0 = self.xrm.make_sure_var_in_reg(op.getarg(0))
+ loc1 = self.rm.force_allocate_reg(op.result)
+ self.Perform(op, [loc0], loc1)
+ self.xrm.possibly_free_var(op.getarg(0))
+ else:
+ loc0 = self.xrm.loc(op.getarg(0))
+ loc1 = self.xrm.force_allocate_reg(op.result)
+ self.Perform(op, [loc0], loc1)
+ self.xrm.possibly_free_var(op.getarg(0))
def _consider_llong_binop_xx(self, op):
# must force both arguments into xmm registers, because we don't
diff --git a/pypy/jit/metainterp/blackhole.py b/pypy/jit/metainterp/blackhole.py
--- a/pypy/jit/metainterp/blackhole.py
+++ b/pypy/jit/metainterp/blackhole.py
@@ -21,6 +21,9 @@
return function
return decorate
+LONGLONG_TYPECODE = 'i' if longlong.is_64_bit else 'f'
+
+
class LeaveFrame(JitException):
pass
@@ -664,8 +667,9 @@
a = float(a)
return longlong.getfloatstorage(a)
- @arguments("f", returns="i")
+ @arguments("f", returns=LONGLONG_TYPECODE)
def bhimpl_convert_float_bytes_to_longlong(a):
+ a = longlong.getrealfloat(a)
return longlong2float.float2longlong(a)
# ----------
@@ -1314,7 +1318,7 @@
def bhimpl_copyunicodecontent(cpu, src, dst, srcstart, dststart, length):
cpu.bh_copyunicodecontent(src, dst, srcstart, dststart, length)
- @arguments(returns=(longlong.is_64_bit and "i" or "f"))
+ @arguments(returns=LONGLONG_TYPECODE)
def bhimpl_ll_read_timestamp():
return read_timestamp()
More information about the pypy-commit
mailing list