aboutsummaryrefslogtreecommitdiffstats
path: root/src/bigint/mulop_ia32
diff options
context:
space:
mode:
Diffstat (limited to 'src/bigint/mulop_ia32')
-rw-r--r--src/bigint/mulop_ia32/mp_mulop.S62
-rw-r--r--src/bigint/mulop_ia32/xxxinfo.txt43
2 files changed, 105 insertions, 0 deletions
diff --git a/src/bigint/mulop_ia32/mp_mulop.S b/src/bigint/mulop_ia32/mp_mulop.S
new file mode 100644
index 000000000..a5f0d3b27
--- /dev/null
+++ b/src/bigint/mulop_ia32/mp_mulop.S
@@ -0,0 +1,62 @@
+/*************************************************
+* Multiply/Add Algorithm Source File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#include <botan/asm_macr.h>
+
+START_LISTING(mp_muladd.S)
+
+START_FUNCTION(bigint_mul_add_words)
+ SPILL_REGS()
+#define PUSHED 4
+
+#define LOOP_CTR ESI
+ ASSIGN(LOOP_CTR, ARG(3)) /* x_size */
+ ZEROIZE(EDI)
+
+ ASSIGN(ECX, ARG(1)) /* z[] */
+ ASSIGN(EBX, ARG(2)) /* x[] */
+ ASSIGN(EBP, ARG(4)) /* y */
+
+#define MULADD_OP(N) \
+ ASSIGN(EAX, ARRAY4(EBX, N)) ; \
+ MUL(EBP) ; \
+ ADD_W_CARRY(EAX, EDX, EDI) ; \
+ ASSIGN(EDI, EDX) ; \
+ ADD_W_CARRY(ARRAY4(ECX, N), EDI, EAX) ;
+
+ JUMP_IF_ZERO(LOOP_CTR, .MUL_ADD_DONE)
+ JUMP_IF_LT(LOOP_CTR, 8, .MULADD1_LOOP)
+
+START_LOOP(.MULADD8)
+ MULADD_OP(0)
+ MULADD_OP(1)
+ MULADD_OP(2)
+ MULADD_OP(3)
+ MULADD_OP(4)
+ MULADD_OP(5)
+ MULADD_OP(6)
+ MULADD_OP(7)
+
+ SUB_IMM(LOOP_CTR, 8)
+ ADD_IMM(EBX, 32)
+ ADD_IMM(ECX, 32)
+LOOP_UNTIL_LT(LOOP_CTR, 8, .MULADD8)
+
+ JUMP_IF_ZERO(LOOP_CTR, .MUL_ADD_DONE)
+
+START_LOOP(.MULADD1)
+ MULADD_OP(0)
+
+ SUB_IMM(LOOP_CTR, 1)
+ ADD_IMM(EBX, 4)
+ ADD_IMM(ECX, 4)
+LOOP_UNTIL_EQ(LOOP_CTR, 0, .MULADD1)
+
+.MUL_ADD_DONE:
+
+ ASSIGN(EAX, EDI)
+#undef PUSHED
+ RESTORE_REGS()
+END_FUNCTION(bigint_mul_add_words)
diff --git a/src/bigint/mulop_ia32/xxxinfo.txt b/src/bigint/mulop_ia32/xxxinfo.txt
new file mode 100644
index 000000000..12c8cd96d
--- /dev/null
+++ b/src/bigint/mulop_ia32/xxxinfo.txt
@@ -0,0 +1,43 @@
+realname "x86 Assembler"
+
+#mp_bits 32
+
+load_on asm_ok
+
+<replace>
+md4.cpp
+md5.cpp
+sha160.cpp
+serpent.cpp
+</replace>
+
+<ignore>
+#mp_mulop.cpp
+</ignore>
+
+<add>
+asm_macr.h
+md4core.S
+md5core.S
+sha1_asm.S
+serp_asm.S
+#mp_mulop.S
+</add>
+
+<arch>
+ia32
+</arch>
+
+<cc>
+gcc
+icc
+</cc>
+
+# ELF systems
+<os>
+linux
+freebsd
+netbsd
+openbsd
+solaris
+</os>