[pypy-commit] pypy ppc-jit-backend: make sign extension more explicit

hager noreply at buildbot.pypy.org
Thu Jan 12 17:36:06 CET 2012


Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r51286:0993530a85a0
Date: 2012-01-12 17:35 +0100
http://bitbucket.org/pypy/pypy/changeset/0993530a85a0/

Log:	make sign extension more explicit

diff --git a/pypy/jit/backend/ppc/ppcgen/arch.py b/pypy/jit/backend/ppc/ppcgen/arch.py
--- a/pypy/jit/backend/ppc/ppcgen/arch.py
+++ b/pypy/jit/backend/ppc/ppcgen/arch.py
@@ -7,16 +7,17 @@
 import sys
 if sys.maxint == (2**31 - 1):
     WORD = 4
+    DWORD = 2 * WORD
     IS_PPC_32 = True
     BACKCHAIN_SIZE = 2
     FPR_SAVE_AREA = len(NONVOLATILES_FLOAT) * DWORD
 else:
     WORD = 8
+    DWORD = 2 * WORD
     IS_PPC_32 = False
     BACKCHAIN_SIZE = 6
     FPR_SAVE_AREA = len(NONVOLATILES_FLOAT) * WORD
 
-DWORD                   = 2 * WORD
 IS_PPC_64               = not IS_PPC_32
 MY_COPY_OF_REGS         = 0
 
diff --git a/pypy/jit/backend/ppc/ppcgen/helper/assembler.py b/pypy/jit/backend/ppc/ppcgen/helper/assembler.py
--- a/pypy/jit/backend/ppc/ppcgen/helper/assembler.py
+++ b/pypy/jit/backend/ppc/ppcgen/helper/assembler.py
@@ -5,7 +5,7 @@
 from pypy.jit.metainterp.history import FLOAT
 from pypy.rlib.unroll import unrolling_iterable
 import pypy.jit.backend.ppc.ppcgen.register as r
-from pypy.rpython.lltypesystem import rffi
+from pypy.rpython.lltypesystem import rffi, lltype
 
 def gen_emit_cmp_op(condition, signed=True):
     def f(self, op, arglocs, regalloc):
@@ -68,7 +68,8 @@
             | ord(mem[index]) << 24)
 
     rffi_value = rffi.cast(rffi.INT, value)
-    return int(rffi_value)
+    # do sign extension
+    return rffi.cast(lltype.Signed, rffi_value)
 
 def encode64(mem, i, n):
     mem[i+7] = chr(n & 0xFF)


More information about the pypy-commit mailing list