tls: fix pstm asm constraint problem
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 15 Jul 2017 15:13:08 +0000 (17:13 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 4 Aug 2017 00:18:00 +0000 (02:18 +0200)
function                                             old     new   delta
pstm_sqr_comba                                       551     475     -76

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/tls.h
networking/tls_pstm_mul_comba.c
networking/tls_pstm_sqr_comba.c

index b80cc6448b2bda3196a81f63f5db38abb5468054..d487f3810ef2874256736289041dfe496438d259 100644 (file)
 #undef  USE_SEED
 /* pstm: multiprecision numbers */
 #undef  DISABLE_PSTM
-#if defined(__GNUC__) && defined(__i386__) && ENABLE_STATIC
+#if defined(__GNUC__) && defined(__i386__)
   /* PSTM_X86 works correctly. +25 bytes. */
-  /* Only enabled on static build since tls_pstm_mul_comba.c::MULADD
-   * and tls_pstm_sqr_comba.c::SQRADD2 need too many registers, choke when ebx is not available */
 # define PSTM_32BIT
 # define PSTM_X86
 #endif
index 47cbb96186bb3c9366ab9a66b7979c0371ce2f12..845ab95e2afaeefc7201b1eee5e77a87b712f786 100644 (file)
@@ -85,7 +85,8 @@ asm(                                                      \
         "addl  %%eax,%0     \n\t"                            \
         "adcl  %%edx,%1     \n\t"                            \
         "adcl  $0,%2        \n\t"                            \
-        :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j)  :"%eax","%edx","%cc");
+        :"=rm"(c0), "=rm"(c1), "=rm"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j)  :"%eax","%edx","%cc");
+       //bbox: ^^^ replaced "=r" with "=rm": %ebx is not available on shared build
 
 /******************************************************************************/
 #elif defined(PSTM_X86_64)
index 36cb9ea9728058a06d036c29ff45d5cab125fba0..4fcfcf91a10b8535146928bc2f9fc6eade5ba594 100644 (file)
@@ -78,7 +78,8 @@ asm(                                            \
         "addl  %%eax,%0     \n\t"                            \
         "adcl  %%edx,%1     \n\t"                            \
         "adcl  $0,%2        \n\t"                            \
-        :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i) :"%eax","%edx","%cc");
+        :"=rm"(c0), "=rm"(c1), "=rm"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i) :"%eax","%edx","%cc");
+       //bbox: ^^^ replaced "=r" with "=rm": %ebx is not available on shared build
 
 #define SQRADD2(i, j)                                     \
 asm(                                            \
@@ -90,7 +91,8 @@ asm(                                            \
         "addl  %%eax,%0     \n\t"                            \
         "adcl  %%edx,%1     \n\t"                            \
         "adcl  $0,%2        \n\t"                            \
-        :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j)  :"%eax","%edx","%cc");
+        :"=rm"(c0), "=rm"(c1), "=rm"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(i), "m"(j)  :"%eax","%edx","%cc");
+       //bbox: ^^^ replaced "=r" with "=rm": %ebx is not available on shared build
 
 #define SQRADDSC(i, j)                                    \
 asm(                                                     \