aboutsummaryrefslogtreecommitdiff
path: root/softfloat/s_mul64To128.c
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2011-06-19 20:47:29 -0700
committerAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2011-06-19 20:47:29 -0700
commit77452a26e7d95d29dbaa797595ae683f03a3345b (patch)
treee7aaae682f73a20ceb4d3366528b0cd38378f49d /softfloat/s_mul64To128.c
parent740f981cfd55604d46598144dccac26dd53f643c (diff)
downloadriscv-isa-sim-77452a26e7d95d29dbaa797595ae683f03a3345b.zip
riscv-isa-sim-77452a26e7d95d29dbaa797595ae683f03a3345b.tar.gz
riscv-isa-sim-77452a26e7d95d29dbaa797595ae683f03a3345b.tar.bz2
temporary undoing of renaming
Diffstat (limited to 'softfloat/s_mul64To128.c')
-rwxr-xr-xsoftfloat/s_mul64To128.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/softfloat/s_mul64To128.c b/softfloat/s_mul64To128.c
new file mode 100755
index 0000000..c17780b
--- /dev/null
+++ b/softfloat/s_mul64To128.c
@@ -0,0 +1,28 @@
+
+#include <stdint.h>
+#include "platform.h"
+#include "primitives.h"
+
+struct uint128 softfloat_mul64To128( uint64_t a, uint64_t b )
+{
+ uint32_t a32, a0, b32, b0;
+ struct uint128 z;
+ uint64_t mid1, mid2, mid;
+
+ a32 = a>>32;
+ a0 = a;
+ b32 = b>>32;
+ b0 = b;
+ z.v0 = (uint64_t) a0 * b0;
+ mid1 = (uint64_t) a32 * b0;
+ mid2 = (uint64_t) a0 * b32;
+ z.v64 = (uint64_t) a32 * b32;
+ mid = mid1 + mid2;
+ z.v64 += ( (uint64_t) ( mid < mid1 ) )<<32 | mid>>32;
+ mid <<= 32;
+ z.v0 += mid;
+ z.v64 += ( z.v0 < mid );
+ return z;
+
+}
+