[pypy-commit] pypy ppc-jit-backend: Added David's changes to ppc_field.py and ppc_assembler.py.

hager noreply at buildbot.pypy.org
Tue Aug 16 13:47:54 CEST 2011


Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r46535:8a6f0450f580
Date: 2011-08-16 13:50 +0200
http://bitbucket.org/pypy/pypy/changeset/8a6f0450f580/

Log:	Added David's changes to ppc_field.py and ppc_assembler.py. He added
	the operation sldi and some convenience methods for 64 bit dword
	handling. Also fixed some typos.

diff --git a/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py b/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py
--- a/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py
+++ b/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py
@@ -613,6 +613,8 @@
     def srwi(self, rA, rS, n):
         self.rlwinm(rA, rS, 32-n, n, 31)
 
+    def sldi(self, rA, rS, n):
+        self.rldicr(rA, rS, n, 63-n)
 
     # F.5 Simplified Mnemonics for Branch Instructions
 
@@ -881,6 +883,15 @@
         return -((v ^ 0xFFFF) + 1) # "sign extend" to 32 bits
     return v
 
+def highest(w):
+    return w >> 48
+
+def higher(w):
+    return (w >> 32) & 0x0000FFFF
+
+def high(w):
+    return (w >> 16) & 0x0000FFFF
+
 class PPCBuilder(PPCAssembler):
     def __init__(self):
         PPCAssembler.__init__(self)
@@ -897,6 +908,13 @@
         self.load_word(10, addr)
         self.stw(source_reg, 10, 0)
 
+    def load_dword(self, rD, dword):
+        self.addis(rD, 0, highest(dword))
+        self.ori(rD, rD, higher(dword))
+        self.sldi(rD, rD, 32)
+        self.oris(rD, rD, high(dword))
+        self.ori(rD, rD, lo(dword))
+
     # translate a trace operation to corresponding machine code
     def build_op(self, trace_op, cpu):
         opnum = trace_op.getopnum()
diff --git a/pypy/jit/backend/ppc/ppcgen/ppc_field.py b/pypy/jit/backend/ppc/ppcgen/ppc_field.py
--- a/pypy/jit/backend/ppc/ppcgen/ppc_field.py
+++ b/pypy/jit/backend/ppc/ppcgen/ppc_field.py
@@ -86,7 +86,7 @@
 class mbe(Field):
     def encode(self, value):
         value = (value & 31) << 1 | (value & 32) >> 5
-        return super(spr, self).encode(value)
+        return super(mbe, self).encode(value)
     def decode(self, inst):
         value = super(mbe, self).decode(inst)
         return (value & 1) << 5 | (value >> 1 & 31)
@@ -94,9 +94,9 @@
 class sh(Field):
     def encode(self, value):
         value = (value & 31) << 10 | (value & 32) >> 5
-        return super(spr, self).encode(value)
+        return super(sh, self).encode(value)
     def decode(self, inst):
-        value = super(mbe, self).decode(inst)
+        value = super(sh, self).decode(inst)
         return (value & 32) << 5 | (value >> 10 & 31)
 # other special fields?
 


More information about the pypy-commit mailing list