Re: _mp_alloc vs ALLOC

2012-02-24 Thread bodrato
Il Mer, 22 Febbraio 2012 8:32 pm, Torbjorn Granlund ha scritto: bodr...@mail.dm.unipi.it writes: Unrelated :-) We might define more macros like TMP_ALLOC_LIMBS_2 . I Please look at the generated code from TMP_ALLOC from any reasonable compiler. It is a sub from sp, the a copy from sp to

Re: _mp_alloc vs ALLOC

2012-02-24 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: Torbjorn Granlund t...@gmplib.org writes: Surely a plain TMP_ALLOC adds red zones? If not, that is something we ought to fix. But tp = TMP_ALLOC_LIMBS (2*n); xp = tp + n; does not add any between T and X (intended to

Re: _mp_alloc vs ALLOC

2012-02-24 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: What about the test in #define TMP_ALLOC(n) \ (LIKELY ((n) 65536) ? TMP_SALLOC(n) : TMP_BALLOC(n)) That test will cost a cycle or two for each TMP_ALLOC call (with non-constant n), regardless of size, won't it? I think my previous

Division call in mpn_gcd

2012-02-24 Thread Torbjorn Granlund
Inspired by Marc{,o}'s cleanup commits, I decided to look for TMP_ALLOC* calls that should be made into TMP_SALLOC* or TMP_BALLOC*. Then I spotted this unrelated thing: tp = TMP_ALLOC_LIMBS(talloc); if (usize n) { mpn_tdiv_qr (tp, up, 0, up, usize, vp, n); if (mpn_zero_p

Re: _mp_alloc vs ALLOC

2012-02-24 Thread bodrato
Ciao, Il Ven, 24 Febbraio 2012 10:40 am, Torbjorn Granlund ha scritto: I cannot see how TMP_ALLOC_LIMBS_2 could save *anything* for small I'm not sure I agree with Torbjorn. Nevertheless developers time is a far more precious resource than a few cpu cycles or bytes of code size... That's why I

Re: Division call in mpn_gcd

2012-02-24 Thread Niels Möller
Torbjorn Granlund t...@gmplib.org writes: Except that redc does not accept independent sizes. Therefore we need to use bdiv_qr. I think it should be easy to generalize at least redc_1 and redc_2 to accept independent sizes. Might require some more work for redc_n, which would need some kind

Re: Division call in mpn_gcd

2012-02-24 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: Torbjorn Granlund t...@gmplib.org writes: Except that redc does not accept independent sizes. Therefore we need to use bdiv_qr. I think it should be easy to generalize at least redc_1 and redc_2 to accept independent sizes. Might