diff options
author | Andrew Waterman <andrew@sifive.com> | 2017-07-25 01:53:04 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2017-07-25 01:53:04 -0700 |
commit | 5203c8474f9258f8388eca1f2eb656ccb5be059e (patch) | |
tree | 46408642952c788985d1921ca9ffe44ecd4efeea | |
parent | df362718619312da8444671e3a316c4fa5533a8f (diff) | |
download | berkeley-testfloat-3-f32-sqrt.zip berkeley-testfloat-3-f32-sqrt.tar.gz berkeley-testfloat-3-f32-sqrt.tar.bz2 |
Support testing f32_mulAdd and f64_mulAddf32-sqrt
-rw-r--r-- | source/subj-C/subjfloat.c | 24 | ||||
-rw-r--r-- | source/subj-C/subjfloat_config.h | 4 |
2 files changed, 28 insertions, 0 deletions
diff --git a/source/subj-C/subjfloat.c b/source/subj-C/subjfloat.c index 305d20f..eb5e543 100644 --- a/source/subj-C/subjfloat.c +++ b/source/subj-C/subjfloat.c @@ -252,6 +252,18 @@ bool subj_f32_lt( float32_t a, float32_t b ) } +float32_t subj_f32_mulAdd( float32_t a, float32_t b, float32_t c ) +{ + union f32_f uA, uB, uC, uZ; + + uA.f32 = a; + uB.f32 = b; + uC.f32 = b=c; + uZ.f = fmaf( uA.f, uB.f, uC.f ); + return uZ.f32; + +} + /*---------------------------------------------------------------------------- *----------------------------------------------------------------------------*/ @@ -437,6 +449,18 @@ bool subj_f64_lt( float64_t a, float64_t b ) } +float64_t subj_f64_mulAdd( float64_t a, float64_t b, float64_t c ) +{ + union f64_d uA, uB, uC, uZ; + + uA.f64 = a; + uB.f64 = b; + uC.f64 = c; + uZ.d = fma( uA.d, uB.d, uC.d ); + return uZ.f64; + +} + #endif /*---------------------------------------------------------------------------- diff --git a/source/subj-C/subjfloat_config.h b/source/subj-C/subjfloat_config.h index 2b9d103..0f8ece1 100644 --- a/source/subj-C/subjfloat_config.h +++ b/source/subj-C/subjfloat_config.h @@ -22,6 +22,8 @@ #define SUBJ_F32_LE #define SUBJ_F32_LT +#define SUBJ_F32_MULADD + #ifdef FLOAT64 #define SUBJ_UI32_TO_F64 @@ -45,6 +47,8 @@ #define SUBJ_F64_LE #define SUBJ_F64_LT +#define SUBJ_F64_MULADD + #endif #if defined EXTFLOAT80 && defined LONG_DOUBLE_IS_EXTFLOAT80 |