[pypy-svn] r59300 - in pypy/branch/oo-jit/pypy/jit/codegen/x86_64: . test

witulski at codespeak.net witulski at codespeak.net
Tue Oct 21 14:22:54 CEST 2008


Author: witulski
Date: Tue Oct 21 14:22:53 2008
New Revision: 59300

Modified:
   pypy/branch/oo-jit/pypy/jit/codegen/x86_64/objmodel.py
   pypy/branch/oo-jit/pypy/jit/codegen/x86_64/rgenop.py
   pypy/branch/oo-jit/pypy/jit/codegen/x86_64/test/test_rgenop.py
Log:
Added is_true and same_as + test (+ litle cleanup)


Modified: pypy/branch/oo-jit/pypy/jit/codegen/x86_64/objmodel.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/x86_64/objmodel.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/x86_64/objmodel.py	Tue Oct 21 14:22:53 2008
@@ -40,6 +40,7 @@
 class IntVar(model.GenVar):
     def __init__(self, location):
         self.location = location
+        self.is_const = False
         assert isinstance(location, Location) 
     
     def to_string(self):

Modified: pypy/branch/oo-jit/pypy/jit/codegen/x86_64/rgenop.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/x86_64/rgenop.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/x86_64/rgenop.py	Tue Oct 21 14:22:53 2008
@@ -138,6 +138,20 @@
     op_int_sub  = make_two_argument_method("SUB")  # TODO: use DEC
     op_int_xor  = make_two_argument_method("XOR")
 
+    # must return a genvar
+    def genop_same_as(self, imm):
+        gv_x = self.allocate_register()
+        self.mc.MOV(gv_x, imm)
+        return gv_x
+        
+    def op_int_is_true(self, gv_x):
+        [gv_x, gv_y] = self.move_to_registers([gv_x, Immediate32(1)], None, move_imm_too=True)  
+        self.mc.CMP(gv_x, gv_y)
+        [gv_x, gv_y] = self.throw_away_if_const([gv_x,gv_y])
+        gv_z = self.allocate_register("rax")
+        self.mc.SETE(IntVar(Register8("al")))
+        return gv_z
+
     # TODO: support reg8
     def op_cast_bool_to_int(self, gv_x):
         [gv_x] = self.move_to_registers([gv_x]) 

Modified: pypy/branch/oo-jit/pypy/jit/codegen/x86_64/test/test_rgenop.py
==============================================================================
--- pypy/branch/oo-jit/pypy/jit/codegen/x86_64/test/test_rgenop.py	(original)
+++ pypy/branch/oo-jit/pypy/jit/codegen/x86_64/test/test_rgenop.py	Tue Oct 21 14:22:53 2008
@@ -531,6 +531,16 @@
         fnptr = self.cast(mem_func,1)
         result = fnptr(0)
         assert result == 42
+        
+    def test_is_true(self):    
+        test_function = make_one_op_instr(self.RGenOp(),"int_is_true")
+        fnptr = self.cast(test_function,1)
+        result = fnptr(1)
+        assert result == 1
+        result = fnptr(0)
+        assert result == 0
+        result = fnptr(42)
+        assert result == 0
 
         
 #    def test_invert(self):
@@ -544,23 +554,17 @@
        
     test_switch_many_args_direct = skip
     test_directtesthelper_direct = skip
-    test_dummy_compile = skip
     test_cast_raising = skip
     test_float_adder = skip
     test_float_call = skip
     test_float_loop_direct = skip
-    test_dummy_direct = skip
     test_largedummy_direct = skip
     test_switch_direct = skip
     test_large_switch_direct = skip
     test_fact_direct = skip
     test_calling_pause_direct = skip
-    test_longwinded_and_direct = skip
     test_condition_result_cross_link_direct = skip
-    #test_flipped_cmp_with_immediate = skip
     test_jump_to_block_with_many_vars = skip
-    test_same_as = skip
-    test_pause_and_resume_direct = skip
     test_like_residual_red_call_with_exc_direct = skip
     test_call_functions_with_different_signatures_direct = skip
     test_defaultonly_switch = skip
@@ -589,5 +593,4 @@
     test_fieldaccess = skip
     test_interior_access = skip
     test_interior_access_float = skip
-    test_demo_f1_direct = skip
-    test_red_switch = skip
\ No newline at end of file
+    test_demo_f1_direct = skip
\ No newline at end of file



More information about the Pypy-commit mailing list