[pypy-commit] pypy s390x-backend: correct positioning of the ptr to write
plan_rich
pypy.commits at gmail.com
Mon Mar 7 14:48:11 EST 2016
Author: Richard Plangger <planrichi at gmail.com>
Branch: s390x-backend
Changeset: r82871:89a10fc86c4b
Date: 2016-03-07 20:47 +0100
http://bitbucket.org/pypy/pypy/changeset/89a10fc86c4b/
Log: correct positioning of the ptr to write
diff --git a/rpython/jit/backend/ppc/opassembler.py b/rpython/jit/backend/ppc/opassembler.py
--- a/rpython/jit/backend/ppc/opassembler.py
+++ b/rpython/jit/backend/ppc/opassembler.py
@@ -884,9 +884,8 @@
return # nothing to do
if startindex_loc.is_imm():
- self.mc.load_imm(r.SCRATCH, startindex_loc.value)
- startindex_loc = r.SCRATCH
-
+ self.mc.load_imm(r.SCRATCH2, startindex_loc.value)
+ startindex_loc = r.SCRATCH2
if ofs_loc.is_imm():
self.mc.addi(r.SCRATCH2.value, startindex_loc.value, ofs_loc.value)
else:
@@ -897,6 +896,7 @@
# ofs_loc is now the real address pointing to the first
# byte to be zeroed
+ prev_length_loc = length_loc
if length_loc.is_imm():
self.mc.load_imm(r.SCRATCH, length_loc.value)
length_loc = r.SCRATCH
@@ -905,7 +905,7 @@
jlt_location = self.mc.currpos()
self.mc.trap()
- self.mc.sradi(r.SCRATCH.value, length_loc.value, shift_by, 0)
+ self.mc.sradi(r.SCRATCH.value, length_loc.value, shift_by, 31)
self.mc.mtctr(r.SCRATCH.value) # store the length in count register
self.mc.li(r.SCRATCH.value, 0)
@@ -914,6 +914,8 @@
# and length. Thus we zero 4/8 bytes in a loop in 1) and every remaining
# byte is zeroed in another loop in 2)
+ self.mc.subi(ofs_loc.value, ofs_loc.value, stepsize)
+
# first store of case 1)
# 1) The next loop copies WORDS into the memory chunk starting at startindex
# ending at startindex + length. These are bytes
@@ -921,6 +923,8 @@
self.eza_stXu(r.SCRATCH.value, ofs_loc.value, stepsize, stepsize)
self.mc.bdnz(loop_location - self.mc.currpos())
+ self.mc.addi(ofs_loc.value, ofs_loc.value, stepsize)
+
pmc = OverwritingBuilder(self.mc, jlt_location, 1)
pmc.blt(self.mc.currpos() - jlt_location) # jump if length < WORD
pmc.overwrite()
@@ -930,6 +934,7 @@
# need to write the last bytes.
# move the last bytes to the count register
+ length_loc = prev_length_loc
if length_loc.is_imm():
self.mc.load_imm(r.SCRATCH, length_loc.value & (stepsize-1))
else:
@@ -942,6 +947,8 @@
self.mc.mtctr(r.SCRATCH.value)
self.mc.li(r.SCRATCH.value, 0)
+ self.mc.subi(ofs_loc.value, ofs_loc.value, 1)
+
loop_position = self.mc.currpos()
self.eza_stXu(r.SCRATCH.value, ofs_loc.value, 1, 1)
self.mc.bdnz(self.mc.currpos() - loop_location)
More information about the pypy-commit
mailing list