diff options
author | lloyd <[email protected]> | 2010-03-16 00:21:30 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-16 00:21:30 +0000 |
commit | 4be0c32f1715ca97f6cc85bc1905899f5cd01cef (patch) | |
tree | 3f7d40f046f6c3fb12f3a23be909916a099344a3 /src/math/bigint/mp_amd64 | |
parent | b96139b84113b583a453c820127c4765c6f0f66f (diff) |
Add a special handler for the case of doing a subtraction as in:
x -= y;
where abs(x) < abs(y).
This change alone increases ECDSA performance by 5 to 15%
Diffstat (limited to 'src/math/bigint/mp_amd64')
-rw-r--r-- | src/math/bigint/mp_amd64/mp_asmi.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/math/bigint/mp_amd64/mp_asmi.h b/src/math/bigint/mp_amd64/mp_asmi.h index d8f681d77..adf7774ef 100644 --- a/src/math/bigint/mp_amd64/mp_asmi.h +++ b/src/math/bigint/mp_amd64/mp_asmi.h @@ -1,6 +1,6 @@ /* * Lowest Level MPI Algorithms -* (C) 1999-2007 Jack Lloyd +* (C) 1999-2010 Jack Lloyd * 2006 Luca Piccarreta * * Distributed under the terms of the Botan license @@ -131,6 +131,19 @@ inline word word8_sub2(word x[8], const word y[8], word carry) } /* +* Eight Word Block Subtraction, Two Argument +*/ +inline word word8_sub2_rev(word x[8], const word y[8], word carry) + { + asm( + ADD_OR_SUBTRACT(DO_8_TIMES(ADDSUB3_OP, "sbbq")) + : [carry]"=r"(carry) + : [x]"r"(y), [y]"r"(x), [z]"r"(x), "0"(carry) + : "cc", "memory"); + return carry; + } + +/* * Eight Word Block Subtraction, Three Argument */ inline word word8_sub3(word z[8], const word x[8], const word y[8], word carry) |