diff options
author | Andrew Waterman <waterman@s141.Millennium.Berkeley.EDU> | 2010-08-17 17:10:28 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@s141.Millennium.Berkeley.EDU> | 2010-08-17 17:10:28 -0700 |
commit | 932ec48ad574b31e964a7a5bf2e74138b334d731 (patch) | |
tree | 2a8b39b03243ff8e80a261efd4c6cd517692322f /softfloat/SoftFloat-3/source/f64_add.c | |
parent | 2d75bf71bb3990f5a718ddca3c99f9139c03c10b (diff) | |
download | riscv-isa-sim-932ec48ad574b31e964a7a5bf2e74138b334d731.zip riscv-isa-sim-932ec48ad574b31e964a7a5bf2e74138b334d731.tar.gz riscv-isa-sim-932ec48ad574b31e964a7a5bf2e74138b334d731.tar.bz2 |
[sim] added SoftFloat-3 source
Diffstat (limited to 'softfloat/SoftFloat-3/source/f64_add.c')
-rwxr-xr-x | softfloat/SoftFloat-3/source/f64_add.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/softfloat/SoftFloat-3/source/f64_add.c b/softfloat/SoftFloat-3/source/f64_add.c new file mode 100755 index 0000000..9ec4b5f --- /dev/null +++ b/softfloat/SoftFloat-3/source/f64_add.c @@ -0,0 +1,29 @@ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "internals.h" +#include "softfloat.h" + +float64_t f64_add( float64_t a, float64_t b ) +{ + union ui64_f64 uA; + uint_fast64_t uiA; + bool signA; + union ui64_f64 uB; + uint_fast64_t uiB; + bool signB; + float64_t ( *magsRoutine )( uint_fast64_t, uint_fast64_t, bool ); + + uA.f = a; + uiA = uA.ui; + signA = signF64UI( uiA ); + uB.f = b; + uiB = uB.ui; + signB = signF64UI( uiB ); + magsRoutine = + ( signA == signB ) ? softfloat_addMagsF64 : softfloat_subMagsF64; + return magsRoutine( uiA, uiB, signA ); + +} + |