The branch master has been updated
       via  33ea23dc5c8d20b29b45bb09784ff907386ff4c1 (commit)
      from  7936a86b9f937586d9d80492d9480e11e0f9da39 (commit)


- Log -----------------------------------------------------------------
commit 33ea23dc5c8d20b29b45bb09784ff907386ff4c1
Author: Andy Polyakov <[email protected]>
Date:   Mon Apr 25 23:17:57 2016 +0200

    SPARCv9 assembly pack: fine-tune run-time switch.
    
    Reviewed-by: Tim Hudson <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 crypto/poly1305/asm/poly1305-sparcv9.pl |  4 ++--
 crypto/sparcv9cap.c                     | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/crypto/poly1305/asm/poly1305-sparcv9.pl 
b/crypto/poly1305/asm/poly1305-sparcv9.pl
index 497e270..3be2b5c 100755
--- a/crypto/poly1305/asm/poly1305-sparcv9.pl
+++ b/crypto/poly1305/asm/poly1305-sparcv9.pl
@@ -74,8 +74,8 @@ poly1305_init:
        SPARC_LOAD_ADDRESS(OPENSSL_sparcv9cap_P,%g1)
        ld      [%g1],%g1
 
-       and     %g1,SPARCV9_FMADD|SPARCV9_PREFER_FPU|SPARCV9_VIS3,%g1
-       cmp     %g1,SPARCV9_FMADD|SPARCV9_PREFER_FPU
+       and     %g1,SPARCV9_FMADD|SPARCV9_VIS3,%g1
+       cmp     %g1,SPARCV9_FMADD
        be      .Lpoly1305_init_fma
        nop
 
diff --git a/crypto/sparcv9cap.c b/crypto/sparcv9cap.c
index 30c384b..bcb3592 100644
--- a/crypto/sparcv9cap.c
+++ b/crypto/sparcv9cap.c
@@ -60,9 +60,18 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const 
BN_ULONG *bp,
         if ((OPENSSL_sparcv9cap_P[0] & SPARCV9_VIS3))
             return bn_mul_mont_vis3(rp, ap, bp, np, n0, num);
         else if (num >= 8 &&
-                 (OPENSSL_sparcv9cap_P[0] &
-                  (SPARCV9_PREFER_FPU | SPARCV9_VIS1)) ==
-                 (SPARCV9_PREFER_FPU | SPARCV9_VIS1))
+                 /*
+                  * bn_mul_mont_fpu doesn't use FMADD, we just use the
+                  * flag to detect when FPU path is preferable in cases
+                  * when current heuristics is unreliable. [it works
+                  * out because FMADD-capable processors where FPU
+                  * code path is undesirable are also VIS3-capable and
+                  * VIS3 code path takes precedence.]
+                  */
+                 ( (OPENSSL_sparcv9cap_P[0] & SPARCV9_FMADD) ||
+                   (OPENSSL_sparcv9cap_P[0] &
+                    (SPARCV9_PREFER_FPU | SPARCV9_VIS1)) ==
+                   (SPARCV9_PREFER_FPU | SPARCV9_VIS1) ))
             return bn_mul_mont_fpu(rp, ap, bp, np, n0, num);
     }
     return bn_mul_mont_int(rp, ap, bp, np, n0, num);
_____
openssl-commits mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-commits

Reply via email to