aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/test
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-02-14 11:08:57 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2015-02-14 11:08:57 +0100
commitfe57280950fc20b2d1650a022033484b152ae51d (patch)
tree8ac95e2b680344fdff5ff475646999270d5361e4 /runtime/test
parentf2b1c25aa56a27836652aef3feeee0856c04235c (diff)
downloadcompcert-kvx-fe57280950fc20b2d1650a022033484b152ae51d.tar.gz
compcert-kvx-fe57280950fc20b2d1650a022033484b152ae51d.zip
C reference implementation of the int64 helper functions.
In test_int64.c: don't test FP->int64 conversions when the FP argument is out of range.
Diffstat (limited to 'runtime/test')
-rw-r--r--runtime/test/test_int64.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/runtime/test/test_int64.c b/runtime/test/test_int64.c
index ab7a231d..58a129b6 100644
--- a/runtime/test/test_int64.c
+++ b/runtime/test/test_int64.c
@@ -158,17 +158,21 @@ static void test1(u64 x, u64 y)
u = __i64_stof(x);
v = (float) (s64) x;
if (u != v)
- error++, printf("(double) %lld (s) = %a, expected %a\n", x, u, v);
+ error++, printf("(float) %lld (s) = %a, expected %a\n", x, u, v);
f = (double) x;
- z = __i64_dtou(f);
- if (z != (u64) f)
- error++, printf("(u64) %a = %llu, expected %llu\n", f, z, (u64) f);
+ if (f >= 0 && f < 0x1p+64) {
+ z = __i64_dtou(f);
+ if (z != (u64) f)
+ error++, printf("(u64) %a = %llu, expected %llu\n", f, z, (u64) f);
+ }
f = (double) (s64) x;
- t = __i64_dtos(f);
- if (t != (s64) f)
- error++, printf("(s64) %a = %lld, expected %lld\n", f, z, (s64) f);
+ if (f >= -0x1p+63 && f < 0x1p+63) {
+ t = __i64_dtos(f);
+ if (t != (s64) f)
+ error++, printf("(s64) %a = %lld, expected %lld\n", f, z, (s64) f);
+ }
f = ((double) x) * 0.0001;
z = __i64_dtou(f);