[pypy-commit] pypy ppc-jit-backend: making jump conditions more clear

hager noreply at buildbot.pypy.org
Tue Dec 20 17:29:20 CET 2011


Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r50764:c6c19fd92a42
Date: 2011-12-20 17:28 +0100
http://bitbucket.org/pypy/pypy/changeset/c6c19fd92a42/

Log:	making jump conditions more clear

diff --git a/pypy/jit/backend/ppc/ppcgen/codebuilder.py b/pypy/jit/backend/ppc/ppcgen/codebuilder.py
--- a/pypy/jit/backend/ppc/ppcgen/codebuilder.py
+++ b/pypy/jit/backend/ppc/ppcgen/codebuilder.py
@@ -1003,16 +1003,21 @@
         self.b(target_ofs)
 
     def b_cond_offset(self, offset, condition):
+        BI = condition[0]
+        BO = condition[1]
+
         pos = self.currpos()
         target_ofs = offset - pos
-        self.bc(condition, 2, target_ofs)
+        self.bc(BO, BI, target_ofs)
 
     def b_cond_abs(self, addr, condition):
-        assert condition in (c.EQ, c.NE)
+        BI = condition[0]
+        BO = condition[1]
+
         self.alloc_scratch_reg(addr)
         self.mtctr(r.SCRATCH.value)
         self.free_scratch_reg()
-        self.bcctr(condition, 2)
+        self.bcctr(BO, BI)
 
     def b_abs(self, address, trap=False):
         self.alloc_scratch_reg(address)
diff --git a/pypy/jit/backend/ppc/ppcgen/condition.py b/pypy/jit/backend/ppc/ppcgen/condition.py
--- a/pypy/jit/backend/ppc/ppcgen/condition.py
+++ b/pypy/jit/backend/ppc/ppcgen/condition.py
@@ -1,9 +1,16 @@
-LE = 0
-NE = 4
-GT = 2
-LT = 3
-EQ = 12
-GE = 33
+# CONDITION = (BI (number of bit tested in CR), BO (12 if bit is 1, else 4))
+
+SET   = 12
+UNSET = 4
+
+LE = (1, UNSET)
+NE = (2, UNSET)
+GT = (1, SET)
+LT = (0, SET)
+EQ = (2, SET)
+GE = (0, UNSET)
+
+# values below are random ...
 
 U_LT = 50
 U_LE = 60
@@ -12,5 +19,3 @@
 
 IS_TRUE = 90
 IS_ZERO = 100
-
-opposites = {LE: GT, NE: EQ, LT: GE, GE: LT, EQ: NE, GT: LE}


More information about the pypy-commit mailing list