[pypy-svn] r63648 - in pypy/branch/pyjitpl5-simplify/pypy/jit: backend/llgraph backend/test backend/x86 metainterp
fijal at codespeak.net
fijal at codespeak.net
Sun Apr 5 02:18:12 CEST 2009
Author: fijal
Date: Sun Apr 5 02:18:11 2009
New Revision: 63648
Modified:
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/runner.py
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/executor.py
pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py
Log:
implement uint_xor. Amazing what operations are used in pypy
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/llimpl.py Sun Apr 5 02:18:11 2009
@@ -83,6 +83,7 @@
'uint_ne' : (('int', 'int'), 'bool'),
'uint_gt' : (('int', 'int'), 'bool'),
'uint_ge' : (('int', 'int'), 'bool'),
+ 'uint_xor' : (('int', 'int'), 'int'),
'new_with_vtable' : (('ptr',), 'ptr'),
'new' : ((), 'ptr'),
'new_array' : (('int',), 'ptr'),
@@ -613,6 +614,9 @@
def op_cast_int_to_ptr(self, descr, val):
return cast_from_int(llmemory.GCREF, val, self.memocast)
+ def op_uint_xor(self, descr, arg1, arg2):
+ return arg1 ^ arg2
+
# ____________________________________________________________
def cast_to_int(x, memocast):
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/runner.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/test/runner.py Sun Apr 5 02:18:11 2009
@@ -3,6 +3,7 @@
from pypy.jit.metainterp.resoperation import ResOperation, rop
from pypy.rpython.lltypesystem import lltype, llmemory, rstr
from pypy.jit.metainterp.executor import execute
+from pypy.rlib.rarithmetic import r_uint, intmask
class BaseBackendTest(object):
@@ -74,3 +75,12 @@
res2 = self.execute_operation(rop.CAST_INT_TO_PTR,
[BoxInt(res)], 'ptr').value
assert res2 == x
+
+ def test_uint_xor(self):
+ x = execute(self.cpu, rop.UINT_XOR, [BoxInt(100), ConstInt(4)])
+ assert x.value == 100 ^ 4
+ for a, b in [(ConstInt(1), BoxInt(-15)),
+ (BoxInt(22), BoxInt(13)),
+ (BoxInt(-112), ConstInt(11))]:
+ res = self.execute_operation(rop.UINT_XOR, [a, b], 'int')
+ assert res.value == intmask(r_uint(a.value) ^ r_uint(b.value))
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/assembler.py Sun Apr 5 02:18:11 2009
@@ -346,6 +346,7 @@
genop_uint_add = genop_int_add
genop_uint_sub = genop_int_sub
genop_uint_mul = genop_int_mul
+ genop_uint_xor = genop_int_xor
xxx_genop_uint_and = genop_int_and
genop_guard_int_mul_ovf = _binaryop_ovf("IMUL", True)
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/x86/regalloc.py Sun Apr 5 02:18:11 2009
@@ -684,6 +684,7 @@
consider_int_and = _consider_binop
consider_int_or = _consider_binop
consider_int_xor = _consider_binop
+ consider_uint_xor = _consider_binop
consider_uint_add = _consider_binop
consider_uint_mul = _consider_binop
consider_uint_sub = _consider_binop
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/executor.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/executor.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/executor.py Sun Apr 5 02:18:11 2009
@@ -47,6 +47,7 @@
do_uint_sub = do_int_sub
do_uint_mul = do_int_mul
do_uint_lshift = do_int_lshift
+do_uint_xor = do_int_xor
def do_uint_rshift(cpu, args, descr=None):
v = r_uint(args[0].getint()) >> r_uint(args[1].getint())
Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py (original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/resoperation.py Sun Apr 5 02:18:11 2009
@@ -105,6 +105,7 @@
#
CAST_INT_TO_PTR = 21
CAST_PTR_TO_INT = 22
+ UINT_XOR = 23
INT_ADD = 30
INT_SUB = 31
INT_MUL = 32
More information about the Pypy-commit
mailing list