TODO for 5.2 v3
bodrato at mail.dm.unipi.it
bodrato at mail.dm.unipi.it
Mon Jan 13 10:36:47 UTC 2014
Ciao,
Il Mar, 7 Gennaio 2014 4:58 pm, Niels Möller ha scritto:
> Here's a first patch adding a couple of other functions. Benchmarking
> and testing is missing (except that the sec_minvert tests still pass).
Interesting...
> diff -r 84343784aa3d mpn/x86_64/cnd_neg.asm
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/mpn/x86_64/cnd_neg.asm Tue Jan 07 15:13:37 2014 +0100
What about _itch functions when the .asm source is used?
> +C scratch parameter is ignored
_itch should return 0...
And some obvious patch like the following would take advantage of this.
diff -r 639a0512bdd9 mpn/generic/sec_minvert.c
--- a/mpn/generic/sec_minvert.c Sun Jan 12 20:27:20 2014 +0100
+++ b/mpn/generic/sec_minvert.c Mon Jan 13 11:21:20 2014 +0100
@@ -85,7 +85,7 @@
mp_size_t
mpn_sec_minvert_itch (mp_size_t n)
{
- return 4*n;
+ return 3*n + MIN (mpn_cnd_neg_itch (n), mpn_sec_add_1_itch (n));
}
/* Compute V <-- A^{-1} (mod M), in data-independent time. M must be
@@ -106,7 +106,8 @@
ASSERT (! MPN_OVERLAP_P (ap, n, vp, n));
#define bp (scratch + n)
#define up (scratch + 2*n)
-#define m1hp (scratch + 3*n)
+#define m1hp (scratch)
+#define top_scratch (scratch + 3*n)
/* Maintain
@@ -126,7 +127,7 @@
mpn_zero (vp, n);
ASSERT_CARRY (mpn_rshift (m1hp, mp, n, 1));
- ASSERT_NOCARRY (mpn_sec_add_1 (m1hp, m1hp, n, 1, scratch));
+ ASSERT_NOCARRY (mpn_sec_add_1 (m1hp, m1hp, n, 1, top_scratch));
while (bit_size-- > 0)
{
@@ -171,7 +172,7 @@
swap = mpn_cnd_sub_n (odd, ap, ap, bp, n);
mpn_cnd_add_n (swap, bp, bp, ap, n);
- mpn_cnd_neg (swap, ap, ap, n, scratch);
+ mpn_cnd_neg (swap, ap, ap, n, top_scratch);
mpn_cnd_swap (swap, up, vp, n);
cy = mpn_cnd_sub_n (odd, up, up, vp, n);
Best regards,
m
--
http://bodrato.it/
More information about the gmp-devel
mailing list