s390x assembly pack: improve portability.
authorAndy Polyakov <appro@openssl.org>
Mon, 30 May 2016 20:16:31 +0000 (22:16 +0200)
committerAndy Polyakov <appro@openssl.org>
Mon, 6 Jun 2016 09:08:04 +0000 (11:08 +0200)
Some of the instructions used in latest additions are extension
ones. There is no real reason to limit ourselves to specific
processors, so [re-]adhere to base instruction set.

RT#4548

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/chacha/asm/chacha-s390x.pl
crypto/s390xcpuid.S

index c7a26921fea4c48e67df77b75070405629b421c5..c31526473dba4d59059088733fe16cb5fa7756c4 100755 (executable)
@@ -147,7 +147,8 @@ $code.=<<___;
 .type  ChaCha20_ctr32,\@function
 .align 32
 ChaCha20_ctr32:
 .type  ChaCha20_ctr32,\@function
 .align 32
 ChaCha20_ctr32:
-       cl${g}ije       $len,0,.Lno_data        # $len==0?
+       lt${g}r $len,$len                       # $len==0?
+       bzr     %r14
        a${g}hi $len,-64
        l${g}hi %r1,-$frame
        stm${g} %r6,%r15,`6*$SIZE_T`($sp)
        a${g}hi $len,-64
        l${g}hi %r1,-$frame
        stm${g} %r6,%r15,`6*$SIZE_T`($sp)
@@ -279,7 +280,6 @@ $code.=<<___;
        stmg    %r0,%r3,$stdframe+4*12($sp)
 
        lm${g}  %r6,%r15,`$frame+6*$SIZE_T`($sp)
        stmg    %r0,%r3,$stdframe+4*12($sp)
 
        lm${g}  %r6,%r15,`$frame+6*$SIZE_T`($sp)
-.Lno_data:
        br      %r14
 
 .align 16
        br      %r14
 
 .align 16
index 61ef0eb2accc584699f7e658a0efa5e917e0af0c..8859e9e64a917f5c40efda91e9f0e9fe0d1a3ef3 100644 (file)
@@ -143,9 +143,9 @@ CRYPTO_memcmp:
        je      .Lno_data
 
 .Loop_cmp:
        je      .Lno_data
 
 .Loop_cmp:
-       ll    %r0,0(%r2)
+       llgc    %r0,0(%r2)
        la      %r2,1(%r2)
        la      %r2,1(%r2)
-       ll    %r1,0(%r3)
+       llgc    %r1,0(%r3)
        la      %r3,1(%r3)
        xr      %r1,%r0
        or      %r5,%r1
        la      %r3,1(%r3)
        xr      %r1,%r0
        or      %r5,%r1