diff options
author | lloyd <[email protected]> | 2008-10-11 16:45:43 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-11 16:45:43 +0000 |
commit | 850f7f0903f34dcd3a8a03a4a75d6c2ce93a0c07 (patch) | |
tree | 69fd6ff44f4ba423c14cb8e4aef56624c4110644 /src/math | |
parent | 0f078fbf51f70c59b8e3197ef2828e46cd0f10c0 (diff) |
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.
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/bigint/mp_amd64/mp_asmi.h | 8 |
1 files changed, 8 insertions, 0 deletions
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 } /************************************************* |