aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2017-06-09 13:29:05 -0700
committerAndrew Waterman <andrew@sifive.com>2017-06-09 13:29:05 -0700
commitdf362718619312da8444671e3a316c4fa5533a8f (patch)
treea130b6cb806c328949bf22afbb9f29496fb0e3bf
parentf755993d040a8ea9c1acf758efce76da60870627 (diff)
downloadberkeley-testfloat-3-df362718619312da8444671e3a316c4fa5533a8f.zip
berkeley-testfloat-3-df362718619312da8444671e3a316c4fa5533a8f.tar.gz
berkeley-testfloat-3-df362718619312da8444671e3a316c4fa5533a8f.tar.bz2
Support testing f32_sqrt
-rw-r--r--source/subj-C/subjfloat.c10
-rw-r--r--source/subj-C/subjfloat_config.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/source/subj-C/subjfloat.c b/source/subj-C/subjfloat.c
index f5381a4..305d20f 100644
--- a/source/subj-C/subjfloat.c
+++ b/source/subj-C/subjfloat.c
@@ -212,6 +212,16 @@ float32_t subj_f32_div( float32_t a, float32_t b )
}
+float32_t subj_f32_sqrt( float32_t a )
+{
+ union f32_f uA, uZ;
+
+ uA.f32 = a;
+ uZ.f = sqrtf( uA.f );
+ return uZ.f32;
+
+}
+
bool subj_f32_eq( float32_t a, float32_t b )
{
union f32_f uA, uB;
diff --git a/source/subj-C/subjfloat_config.h b/source/subj-C/subjfloat_config.h
index b356382..2b9d103 100644
--- a/source/subj-C/subjfloat_config.h
+++ b/source/subj-C/subjfloat_config.h
@@ -17,6 +17,7 @@
#define SUBJ_F32_SUB
#define SUBJ_F32_MUL
#define SUBJ_F32_DIV
+#define SUBJ_F32_SQRT
#define SUBJ_F32_EQ
#define SUBJ_F32_LE
#define SUBJ_F32_LT