[pypy-commit] pypy ppc-backend-2: Use offset directly as load float / store float displacement.

edelsohn noreply at buildbot.pypy.org
Fri Jun 1 23:35:53 CEST 2012


Author: edelsohn
Branch: ppc-backend-2
Changeset: r55267:642d5eb12115
Date: 2012-06-01 17:35 -0400
http://bitbucket.org/pypy/pypy/changeset/642d5eb12115/

Log:	Use offset directly as load float / store float displacement.

diff --git a/pypy/jit/backend/ppc/ppc_assembler.py b/pypy/jit/backend/ppc/ppc_assembler.py
--- a/pypy/jit/backend/ppc/ppc_assembler.py
+++ b/pypy/jit/backend/ppc/ppc_assembler.py
@@ -1179,16 +1179,11 @@
                     self.mc.load(r.SCRATCH.value, r.SPP.value, offset)
                     self.mc.store(r.SCRATCH.value, r.SPP.value, target_offset)
                 return
+            # move from memory to fp register
             elif loc.is_fp_reg():
                 assert prev_loc.type == FLOAT, 'source not float location'
-                with scratch_reg(self.mc):
-                    offset = prev_loc.value
-                    if not _check_imm_arg(offset):
-                        self.mc.load_imm(r.SCRATCH, offset)
-                        self.mc.sub(r.SCRATCH.value, r.SPP.value, r.SCRATCH.value)
-                    else:
-                        self.mc.sub(r.SCRATCH.value, r.SPP.value, r.SCRATCH.value)
-                    self.mc.lfdx(loc.value, 0, r.SCRATCH.value)
+                reg = loc.as_key()
+                self.mc.lfd(reg, r.SPP.value, offset)
                 return
             assert 0, "not supported location"
         elif prev_loc.is_reg():
@@ -1206,6 +1201,7 @@
             assert 0, "not supported location"
         elif prev_loc.is_imm_float():
             value = prev_loc.getint()
+            # move immediate value to fp register
             if loc.is_fp_reg():
                 with scratch_reg(self.mc):
                     self.mc.load_imm(r.SCRATCH, value)
@@ -1213,6 +1209,7 @@
                     self.mc.lfd(loc.value, r.SPP.value, FORCE_INDEX_OFS + WORD)
                     #self.mc.trap()
                 return
+            # move immediate value to memory
             elif loc.is_stack():
                 with scratch_reg(self.mc):
                     offset = loc.value
@@ -1221,19 +1218,17 @@
                 return
             assert 0, "not supported location"
         elif prev_loc.is_fp_reg():
+            reg = prev_loc.as_key()
+            # move to another fp register
             if loc.is_fp_reg():
-                self.mc.fmr(loc.value, prev_loc.value)
+                other_reg = loc.as_key()
+                self.mc.fmr(other_reg, reg)
                 return
+            # move from fp register to memory
             elif loc.is_stack():
                 assert loc.type == FLOAT, "target not float location"
-                with scratch_reg(self.mc):
-                    offset = loc.value
-                    if not _check_imm_arg(offset):
-                        self.mc.load_imm(r.SCRATCH, offset)
-                        self.mc.sub(r.SCRATCH.value, r.SPP.value, r.SCRATCH.value)
-                    else:
-                        self.mc.subi(r.SCRATCH.value, r.SPP.value, offset)
-                    self.mc.stfdx(prev_loc.value, 0, r.SCRATCH.value)
+                offset = loc.value
+                self.mc.stfd(reg, r.SPP.value, offset)
                 return
             assert 0, "not supported location"
         assert 0, "not supported location"


More information about the pypy-commit mailing list