[pypy-commit] pypy ppc-jit-backend: Ok, there actually IS an SLWI instr. on PPC.

hager noreply at buildbot.pypy.org
Thu Oct 27 18:56:56 CEST 2011


Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r48515:064b64295d89
Date: 2011-10-26 10:38 +0200
http://bitbucket.org/pypy/pypy/changeset/064b64295d89/

Log:	Ok, there actually IS an SLWI instr. on PPC. Improved generated code
	in emit_unicodegetitem and emit_unicodesetitem.

diff --git a/pypy/jit/backend/ppc/ppcgen/opassembler.py b/pypy/jit/backend/ppc/ppcgen/opassembler.py
--- a/pypy/jit/backend/ppc/ppcgen/opassembler.py
+++ b/pypy/jit/backend/ppc/ppcgen/opassembler.py
@@ -401,9 +401,7 @@
     def emit_unicodegetitem(self, op, arglocs, regalloc):
         res, base_loc, ofs_loc, scale, basesize, itemsize = arglocs
 
-        # XXX arrrrgh, why does PPC not have an SLWI instruction ?
-        self.mc.li(r.r0.value, scale.value)
-        self.mc.slw(ofs_loc.value, ofs_loc.value, r.r0.value)
+        self.mc.slwi(ofs_loc.value, ofs_loc.value, scale.value)
         self.mc.add(res.value, base_loc.value, ofs_loc.value)
 
         if scale.value == 2:
@@ -417,8 +415,7 @@
     def emit_unicodesetitem(self, op, arglocs, regalloc):
         value_loc, base_loc, ofs_loc, scale, basesize, itemsize = arglocs
 
-        self.mc.li(r.r0.value, scale.value)
-        self.mc.slw(ofs_loc.value, ofs_loc.value, r.r0.value)
+        self.mc.slwi(ofs_loc.value, ofs_loc.value, scale.value)
         self.mc.add(base_loc.value, base_loc.value, ofs_loc.value)
 
         if scale.value == 2:


More information about the pypy-commit mailing list