From 850f7f0903f34dcd3a8a03a4a75d6c2ce93a0c07 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 11 Oct 2008 16:45:43 +0000 Subject: Disable the x86-64 implementation of word_add. I think there is a bug in the constraints. It turns out that the GF(p) tests all pass in 64-bit mode if this function is disabled. I suspect the problem is that innert_montg_mult_sos calls this function in ways that are unusual in terms of how it is used in the rest of the library (in particular calling it with constant zero arguments). I think a constraint error is causing GCC to generate bad code in certain instances with this function. Will need to investigate this further. --- src/math/bigint/mp_amd64/mp_asmi.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/math/bigint/mp_amd64/mp_asmi.h b/src/math/bigint/mp_amd64/mp_asmi.h index 16632a38d..bf3469526 100644 --- a/src/math/bigint/mp_amd64/mp_asmi.h +++ b/src/math/bigint/mp_amd64/mp_asmi.h @@ -68,12 +68,20 @@ extern "C" { *************************************************/ inline word word_add(word x, word y, word* carry) { +#if 0 asm( ADD_OR_SUBTRACT(ASM("adcq %[y],%[x]")) : [x]"=r"(x), [carry]"=r"(*carry) : "0"(x), [y]"rm"(y), "1"(*carry) : "cc"); return x; +#else + word z = x + y; + word c1 = (z < x); + z += *carry; + *carry = c1 | (z < *carry); + return z; +#endif } /************************************************* -- cgit v1.2.3