[pypy-commit] pypy s390x-backend: LE set OF flag, GE set OF flag, replace guard jump from a 12bit jump to 20bit jump (relative)
plan_rich
pypy.commits at gmail.com
Tue Feb 9 08:24:54 EST 2016
Author: Richard Plangger <planrichi at gmail.com>
Branch: s390x-backend
Changeset: r82123:eda46a48b3de
Date: 2016-02-09 11:52 +0100
http://bitbucket.org/pypy/pypy/changeset/eda46a48b3de/
Log: LE set OF flag, GE set OF flag, replace guard jump from a 12bit jump
to 20bit jump (relative)
diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py
--- a/rpython/jit/backend/zarch/assembler.py
+++ b/rpython/jit/backend/zarch/assembler.py
@@ -144,7 +144,6 @@
self.mc.LG(r.r14, l.pool(offset))
self.mc.load_imm(r.SCRATCH, fail_descr)
- #self.mc.LGFI(r.SCRATCH, l.imm(fail_descr))
self.mc.BCR(l.imm(0xf), r.r14)
return startpos
diff --git a/rpython/jit/backend/zarch/codebuilder.py b/rpython/jit/backend/zarch/codebuilder.py
--- a/rpython/jit/backend/zarch/codebuilder.py
+++ b/rpython/jit/backend/zarch/codebuilder.py
@@ -123,14 +123,14 @@
def b_cond_offset(self, offset, condition):
assert condition != c.cond_none
- self.BRC(condition, l.imm(offset))
+ self.BRCL(condition, l.imm(offset))
def b_offset(self, reladdr):
offset = reladdr - self.get_relative_pos()
self.BRC(c.ANY, l.imm(offset))
def reserve_guard_branch(self):
- self.BRC(l.imm(0x0), l.imm(0))
+ self.BRCL(l.imm(0x0), l.imm(0))
def trap(self):
self.TRAP2()
@@ -168,7 +168,7 @@
def load_imm(self, dest_reg, word):
- if -32768 <= word <= 32767:
+ if -2**15 <= word <= 2**15-1:
self.LGHI(dest_reg, l.imm(word))
elif -2**31 <= word <= 2**31-1:
self.LGFI(dest_reg, l.imm(word))
diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py
--- a/rpython/jit/backend/zarch/conditions.py
+++ b/rpython/jit/backend/zarch/conditions.py
@@ -23,39 +23,41 @@
LT = ConditionLocation(0x4)
GT = ConditionLocation(0x2)
OF = ConditionLocation(0x1) # overflow
-LE = ConditionLocation(EQ.value | LT.value)
-GE = ConditionLocation(EQ.value | GT.value)
+
+LE = ConditionLocation(EQ.value | LT.value | OF.value)
+GE = ConditionLocation(EQ.value | GT.value | OF.value)
NE = ConditionLocation(LT.value | GT.value | OF.value)
NO = ConditionLocation(0xe) # NO overflow
+
ANY = ConditionLocation(0xf)
FP_ROUND_DEFAULT = loc.imm(0x0)
FP_TOWARDS_ZERO = loc.imm(0x5)
-cond_none = loc.imm(0x0)
+cond_none = loc.imm(-1)
def negate(cond):
- isfloat = (cond.value & 0x10) != 0
+ val = cond.value
+ isfloat = (val & 0x10) != 0
+ cc = (~val) & 0xf
if isfloat:
# inverting is handeled differently for floats
- # overflow is never inverted
- value = (~cond.value) & 0xf
- return ConditionLocation(value | FLOAT.value)
- value = (~cond.value) & 0xf
- return ConditionLocation(value)
+ return ConditionLocation(cc | FLOAT.value)
+ return ConditionLocation(cc)
def prepare_float_condition(cond):
newcond = ConditionLocation(cond.value | FLOAT.value)
return newcond
-def _assert_invert(v1, v2):
- assert (v1.value & 0xe) == (v2.value & 0xe)
-_assert_invert(negate(EQ), NE)
-_assert_invert(negate(NE), EQ)
-_assert_invert(negate(LT), GE)
-_assert_invert(negate(LE), GT)
-_assert_invert(negate(GT), LE)
-_assert_invert(negate(GE), LT)
-assert negate(NO).value == OF.value
-assert negate(OF).value == NO.value
-del _assert_invert
+def _assert_value(v1, v2):
+ assert v1.value == v2.value
+
+_assert_value(negate(EQ), NE)
+_assert_value(negate(NE), EQ)
+_assert_value(negate(LT), GE)
+_assert_value(negate(LE), GT)
+_assert_value(negate(GT), LE)
+_assert_value(negate(GE), LT)
+_assert_value(negate(NO), OF)
+_assert_value(negate(OF), NO)
+del _assert_value
diff --git a/rpython/jit/backend/zarch/opassembler.py b/rpython/jit/backend/zarch/opassembler.py
--- a/rpython/jit/backend/zarch/opassembler.py
+++ b/rpython/jit/backend/zarch/opassembler.py
@@ -365,7 +365,7 @@
def emit_cond_call(self, op, arglocs, regalloc):
fcond = self.guard_success_cc
self.guard_success_cc = c.cond_none
- assert fcond != c.cond_none
+ assert fcond.value != c.cond_none.value
fcond = c.negate(fcond)
jmp_adr = self.mc.get_relative_pos()
@@ -631,7 +631,7 @@
else:
fcond = self.guard_success_cc
self.guard_success_cc = c.cond_none
- assert fcond != c.cond_none
+ assert fcond.value != c.cond_none.value
fcond = c.negate(fcond)
token = self.build_guard_token(op, arglocs[0].value, arglocs[1:], fcond)
token.pos_jump_offset = self.mc.currpos()
More information about the pypy-commit
mailing list