From 4be0c32f1715ca97f6cc85bc1905899f5cd01cef Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 16 Mar 2010 00:21:30 +0000 Subject: 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% --- src/math/bigint/mp_amd64/mp_asmi.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/math/bigint/mp_amd64') 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 @@ -130,6 +130,19 @@ inline word word8_sub2(word x[8], const word y[8], word carry) return 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 */ -- cgit v1.2.3