changeset 646:f10335e5e42f dropbear-tfm

- More asm constraint fixes. Now seems to build OK on 32-bit OS X.
author Matt Johnston <matt@ucc.asn.au>
date Wed, 30 Nov 2011 23:03:47 +0800
parents 8622ee48fab5
children 939cd3e22c87
files tomsfastmath/src/sqr/fp_sqr_comba.c
diffstat 1 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/tomsfastmath/src/sqr/fp_sqr_comba.c	Wed Nov 30 22:27:26 2011 +0800
+++ b/tomsfastmath/src/sqr/fp_sqr_comba.c	Wed Nov 30 23:03:47 2011 +0800
@@ -35,15 +35,18 @@
 #define COMBA_FINI
 
 #define SQRADD(i, j)                                      \
+	do { fp_digit ti = (i);                                  \
 asm(                                            \
      "movl  %6,%%eax     \n\t"                            \
      "mull  %%eax        \n\t"                            \
      "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");
+     :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(ti) :"%eax","%edx","%cc"); } while (0);
 
 #define SQRADD2(i, j)                                     \
+	do { fp_digit ti = (i);                                  \
+		fp_digit tj = (j); \
 asm(                                            \
      "movl  %6,%%eax     \n\t"                            \
      "mull  %7           \n\t"                            \
@@ -53,27 +56,34 @@
      "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");
+     :"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "m"(ti), "m"(tj)  :"%eax","%edx","%cc"); } while (0);
 
 #define SQRADDSC(i, j)                                    \
+	do { \
 asm(                                                     \
-     "movl  %6,%%eax     \n\t"                            \
-     "mull  %7           \n\t"                            \
+     "movl  %2,%%eax     \n\t"                            \
+     "mull  %3           \n\t"                            \
      "movl  %%eax,%0     \n\t"                            \
      "movl  %%edx,%1     \n\t"                            \
-     "xorl  %2,%2        \n\t"                            \
-     :"=r"(sc0), "=r"(sc1), "=r"(sc2): "0"(sc0), "1"(sc1), "2"(sc2), "g"(i), "g"(j) :"%eax","%edx","%cc");
+     :"=r"(sc0), "=r"(sc1): "g"(i), "g"(j) :"%eax","%edx","%cc"); \
+		sc2 = 0; } while (0);
 
 #define SQRADDAC(i, j)                                    \
+	do { fp_digit ti = (i);                                  \
+		fp_digit tj = (j); \
 asm(                                                     \
      "movl  %6,%%eax     \n\t"                            \
      "mull  %7           \n\t"                            \
      "addl  %%eax,%0     \n\t"                            \
      "adcl  %%edx,%1     \n\t"                            \
      "adcl  $0,%2        \n\t"                            \
-     :"=r"(sc0), "=r"(sc1), "=r"(sc2): "0"(sc0), "1"(sc1), "2"(sc2), "g"(i), "g"(j) :"%eax","%edx","%cc");
+     :"=r"(sc0), "=r"(sc1), "=r"(sc2): "0"(sc0), "1"(sc1), "2"(sc2), "m"(ti), "m"(tj) :"%eax","%edx","%cc");  \
+	} while (0);
 
 #define SQRADDDB                                          \
+	do { fp_digit tsc0 = (sc0);                                  \
+		fp_digit tsc1 = (sc1); \
+		fp_digit tsc2 = (sc2); \
 asm(                                                     \
      "addl %6,%0         \n\t"                            \
      "adcl %7,%1         \n\t"                            \
@@ -81,7 +91,7 @@
      "addl %6,%0         \n\t"                            \
      "adcl %7,%1         \n\t"                            \
      "adcl %8,%2         \n\t"                            \
-     :"=r"(c0), "=r"(c1), "=r"(c2) : "0"(c0), "1"(c1), "2"(c2), "r"(sc0), "r"(sc1), "r"(sc2) : "%cc");
+     :"=r"(c0), "=r"(c1), "=r"(c2) : "0"(c0), "1"(c1), "2"(c2), "m"(tsc0), "m"(tsc1), "m"(tsc2) : "%cc"); } while (0);
 
 #elif defined(TFM_X86_64)
 /* x86-64 optimized */