[pypy-svn] r36656 - in pypy/branch/i386-regalloc/pypy/jit/codegen/i386: . test

arigo at codespeak.net arigo at codespeak.net
Sat Jan 13 14:59:37 CET 2007


Author: arigo
Date: Sat Jan 13 14:59:35 2007
New Revision: 36656

Modified:
   pypy/branch/i386-regalloc/pypy/jit/codegen/i386/ri386setup.py
   pypy/branch/i386-regalloc/pypy/jit/codegen/i386/test/test_auto_encoding.py
   pypy/branch/i386-regalloc/pypy/jit/codegen/i386/test/test_ri386.py
Log:
(Disabled) attempt at introducing a generic operation called 'Jcond()'.
Same for SETcond() and CMOVcond().


Modified: pypy/branch/i386-regalloc/pypy/jit/codegen/i386/ri386setup.py
==============================================================================
--- pypy/branch/i386-regalloc/pypy/jit/codegen/i386/ri386setup.py	(original)
+++ pypy/branch/i386-regalloc/pypy/jit/codegen/i386/ri386setup.py	Sat Jan 13 14:59:35 2007
@@ -111,6 +111,14 @@
         lines.append('builder.write(packimm32(offset))')
         return False
 
+##class conditioncode(operand):
+##    def __init__(self):
+##        pass
+##    def eval(self, lines, has_orbyte):
+##        assert not has_orbyte, "malformed bytecode"
+##        lines.append('orbyte = arg1.value')
+##        return True
+
 
 def consolidate(code1):
     for i in range(len(code1)-1, 0, -1):
@@ -463,6 +471,17 @@
 define_cond('CMOV',0,(REG,MODRM),['\x0F', None,'\x40', register(1,8), modrm(2)])
 # note: CMOVxx are Pentium-class instructions, unknown to the 386 and 486
 
+##Jcond = Instruction()
+##Jcond.mode2(  IMM8, REL32,     ['\x0F', conditioncode(),'\x80', relative(2)])
+
+##SETcond = Instruction()
+##SETcond.mode2(IMM8, MODRM8,    ['\x0F', conditioncode(),'\x90', orbyte(0<<3),
+##                                                                modrm(2,'b')])
+
+##CMOVcond = Instruction()
+##CMOVcond.mode3(IMM8,REG,MODRM, ['\x0F', conditioncode(),'\x40', register(2,8),
+##                                                                modrm(3)])
+
 
 all_instructions = {}
 for key, value in globals().items():

Modified: pypy/branch/i386-regalloc/pypy/jit/codegen/i386/test/test_auto_encoding.py
==============================================================================
--- pypy/branch/i386-regalloc/pypy/jit/codegen/i386/test/test_auto_encoding.py	(original)
+++ pypy/branch/i386-regalloc/pypy/jit/codegen/i386/test/test_auto_encoding.py	Sat Jan 13 14:59:35 2007
@@ -211,7 +211,7 @@
         if instrname in ('MOVZX', 'MOVSX'):
             if args[1][1].width == 4:
                 return []
-        if instrname == 'o16':
+        if instrname == 'o16' or instrname.endswith('cond'):
             return []
         return [args]
 

Modified: pypy/branch/i386-regalloc/pypy/jit/codegen/i386/test/test_ri386.py
==============================================================================
--- pypy/branch/i386-regalloc/pypy/jit/codegen/i386/test/test_ri386.py	(original)
+++ pypy/branch/i386-regalloc/pypy/jit/codegen/i386/test/test_ri386.py	Sat Jan 13 14:59:35 2007
@@ -75,6 +75,19 @@
     yield check, '\xE8\x11\x00\x00\x00',     'CALL', rel32(22)
 
 
+##def test_conditional():
+##    """Compare the encoding for the instructions JE, JAE, JC etc.,
+##    with the encoding for the 'Jcond' pseudo-instruction.
+##    """
+##    def check(insn, *args):
+##        from pypy.jit.codegen.i386.ri386setup import Conditions
+##        for cond, value in Conditions.items():
+##            s1 = CodeBuilder()
+##            getattr(s1, insn+cond)(*args)
+##            s2 = CodeBuilder()
+##            getattr(s2, insn+'cond')(imm8(value), *args)
+
+
 def test_translate():
     from pypy.rpython.test.test_llinterp import interpret
 



More information about the Pypy-commit mailing list