[pypy-commit] pypy ppc-jit-backend: (bivab, hager): do sign extension in decode32
hager
noreply at buildbot.pypy.org
Thu Jan 12 17:16:32 CET 2012
Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r51283:31d52c590cbd
Date: 2012-01-12 08:15 -0800
http://bitbucket.org/pypy/pypy/changeset/31d52c590cbd/
Log: (bivab, hager): do sign extension in decode32
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,6 +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
def gen_emit_cmp_op(condition, signed=True):
def f(self, op, arglocs, regalloc):
@@ -58,12 +59,17 @@
mem[i+1] = chr((n >> 16) & 0xFF)
mem[i] = chr((n >> 24) & 0xFF)
+# XXX this sign extension looks a bit strange ...
+# It is important for PPC64.
def decode32(mem, index):
- return intmask(ord(mem[index+3])
+ value = ( ord(mem[index+3])
| ord(mem[index+2]) << 8
| ord(mem[index+1]) << 16
| ord(mem[index]) << 24)
+ rffi_value = rffi.cast(rffi.INT, value)
+ return int(rffi_value)
+
def encode64(mem, i, n):
mem[i+7] = chr(n & 0xFF)
mem[i+6] = chr((n >> 8) & 0xFF)
More information about the pypy-commit
mailing list