aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/test
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-05-06 08:20:06 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-05-06 08:20:06 +0000
commit9b3388bea495d027aa618118096a8223f6866437 (patch)
tree3d1b1bf3b1e0af9d094b2b04a2dfbfd7d18d1f58 /runtime/test
parentb257a6d283f6f5784cb351856b5dbe8c645a1f6f (diff)
downloadcompcert-kvx-9b3388bea495d027aa618118096a8223f6866437.tar.gz
compcert-kvx-9b3388bea495d027aa618118096a8223f6866437.zip
Support for in64 -> float conversions w/ correct rounding.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2235 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'runtime/test')
-rw-r--r--runtime/test/test_int64.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/runtime/test/test_int64.c b/runtime/test/test_int64.c
index 4dbad707..2aa21117 100644
--- a/runtime/test/test_int64.c
+++ b/runtime/test/test_int64.c
@@ -52,6 +52,8 @@ extern s64 __i64_sar(s64 x, unsigned amount);
extern double __i64_utod(u64 x);
extern double __i64_stod(s64 x);
+extern float __i64_utof(u64 x);
+extern float __i64_stof(s64 x);
extern u64 __i64_dtou(double d);
extern s64 __i64_dtos(double d);
@@ -70,6 +72,7 @@ static void test1(u64 x, u64 y)
s64 t, sy;
int i;
double f, g;
+ float u, v;
if (y != 0) {
@@ -147,14 +150,24 @@ static void test1(u64 x, u64 y)
if (f != g)
error++, printf("(double) %lld (s) = %a, expected %a\n", x, f, g);
+ u = __i64_utof(x);
+ v = (float) x;
+ if (u != v)
+ error++, printf("(float) %llu (u) = %a, expected %a\n", x, u, v);
+
+ u = __i64_stof(x);
+ v = (float) (s64) x;
+ if (u != v)
+ error++, printf("(double) %lld (s) = %a, expected %a\n", x, u, v);
+
f = (double) x;
z = __i64_dtou(f);
- if (z != (u64) (double) f)
+ if (z != (u64) f)
error++, printf("(u64) %a = %llu, expected %llu\n", f, z, (u64) f);
- f = (double) ((s64) x);
+ f = (double) (s64) x;
t = __i64_dtos(f);
- if (t != (s64) (double) f)
+ if (t != (s64) f)
error++, printf("(s64) %a = %lld, expected %lld\n", f, z, (s64) f);
f = ((double) x) * 0.0001;