aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mp_ia32/mp_asmi.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-08 04:55:36 +0000
committerlloyd <[email protected]>2006-06-08 04:55:36 +0000
commitfada227a69d66ec1bafe026092642b67634bcb4f (patch)
treec74ac1254b3f83852fddadd813ff4d532d7fa612 /modules/mp_ia32/mp_asmi.h
parent1803a342b3d8617695a231c3c189eda871debb17 (diff)
Move word3_muladd* in the x86 and amd64 assembly modules.
Diffstat (limited to 'modules/mp_ia32/mp_asmi.h')
-rw-r--r--modules/mp_ia32/mp_asmi.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/mp_ia32/mp_asmi.h b/modules/mp_ia32/mp_asmi.h
index 979ae6ca7..6d458a315 100644
--- a/modules/mp_ia32/mp_asmi.h
+++ b/modules/mp_ia32/mp_asmi.h
@@ -177,6 +177,44 @@ inline word word8_madd3(word z[8], const word x[8], word y, word carry)
return carry;
}
+/*************************************************
+* Multiply-Add Accumulator *
+*************************************************/
+inline void word3_muladd(word* w2, word* w1, word* w0, word x, word y)
+ {
+ asm(
+ ASM("mull %[y]")
+
+ ASM("addl %[x],%[w0]")
+ ASM("adcl %[y],%[w1]")
+ ASM("adcl $0,%[w2]")
+
+ : [w0]"=r"(*w0), [w1]"=r"(*w1), [w2]"=r"(*w2)
+ : [x]"a"(x), [y]"d"(y), "0"(*w0), "1"(*w1), "2"(*w2)
+ : "cc");
+ }
+
+/*************************************************
+* Multiply-Add Accumulator *
+*************************************************/
+inline void word3_muladd_2(word* w2, word* w1, word* w0, word x, word y)
+ {
+ asm(
+ ASM("mull %[y]")
+
+ ASM("addl %[x],%[w0]")
+ ASM("adcl %[y],%[w1]")
+ ASM("adcl $0,%[w2]")
+
+ ASM("addl %[x],%[w0]")
+ ASM("adcl %[y],%[w1]")
+ ASM("adcl $0,%[w2]")
+
+ : [w0]"=r"(*w0), [w1]"=r"(*w1), [w2]"=r"(*w2)
+ : [x]"a"(x), [y]"d"(y), "0"(*w0), "1"(*w1), "2"(*w2)
+ : "cc");
+ }
+
}
#endif