[pypy-commit] pypy s390x-backend: address of branch relative and save long is no correctly encoded (half word addressed)

plan_rich noreply at buildbot.pypy.org
Fri Oct 16 10:50:07 EDT 2015


Author: Richard Plangger <planrichi at gmail.com>
Branch: s390x-backend
Changeset: r80276:4b25446959ac
Date: 2015-10-16 16:50 +0200
http://bitbucket.org/pypy/pypy/changeset/4b25446959ac/

Log:	address of branch relative and save long is no correctly encoded
	(half word addressed)

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
@@ -127,7 +127,8 @@
         self.writechar(opcode)
         byte = (reg_or_mask & 0xf) << 4 | (ord(halfopcode) & 0xf)
         self.writechar(chr(byte))
-        self.write_s32(imm32)
+        # half word boundary, addressing bytes
+        self.write_s32(imm32 >> 1 & BIT_MASK_32)
     return encode_ri
 
 
@@ -170,13 +171,13 @@
     return encode_ssb
 
 def build_ssc(mnemonic, (opcode1,)):
-    @builder.arguments('u4,l4bd,l4bd')
-    def encode_ssc(self, uimm4, len_base_disp1, len_base_disp2):
+    @builder.arguments('l4bd,bd,u4')
+    def encode_ssc(self, len_base_disp, base_disp, uimm4):
         self.writechar(opcode1)
-        byte = (len_base_disp1.length & 0xf) << 4 | uimm4 & 0xf
+        byte = (len_base_disp.length & 0xf) << 4 | uimm4 & 0xf
         self.writechar(chr(byte))
-        encode_base_displace(self, len_base_disp1)
-        encode_base_displace(self, len_base_disp2)
+        encode_base_displace(self, len_base_disp)
+        encode_base_displace(self, base_disp)
     return encode_ssc
 
 def build_ssd(mnemonic, (opcode,)):
diff --git a/rpython/jit/backend/zarch/test/test_auto_encoding.py b/rpython/jit/backend/zarch/test/test_auto_encoding.py
--- a/rpython/jit/backend/zarch/test/test_auto_encoding.py
+++ b/rpython/jit/backend/zarch/test/test_auto_encoding.py
@@ -108,9 +108,6 @@
     if signed:
         bits -= 1
         maximum = 2**bits
-        if alignment == 16:
-            # TODO
-            return [-32,-16,0,16,32]
         return [-maximum,-1,0,1,maximum-1] + [random.randrange(-maximum,maximum) for i in range(count)]
     maximum = 2**bits
     return [0,1,maximum-1] + [random.randrange(0,maximum) for i in range(count)]
@@ -150,7 +147,7 @@
 }
 
 class TestZARCH(object):
-    WORD = 8
+    WORD = 4
     TESTDIR = 'zarch'
     accept_unnecessary_prefix = None
     methname = '?'
@@ -195,7 +192,7 @@
                 g.write('%s\n' % op)
                 oplist.append(op)
             g.write('\t.string "%s"\n' % END_TAG)
-        proc = subprocess.Popen(['as', '-m' + str(self.WORD*8), '-mzarch',
+        proc = subprocess.Popen(['as', '-m64', '-mzarch',
                                  inputname, '-o', filename],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
@@ -231,7 +228,7 @@
         combinations = []
         for i,m in enumerate(arg_types):
             elems = TEST_CASE_GENERATE[m]
-            random.shuffle(elems)
+            #random.shuffle(elems)
             combinations.append(elems)
         results = []
         for args in itertools.product(*combinations):


More information about the pypy-commit mailing list