summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-12-27 21:08:46 +0000
committerngie <ngie@FreeBSD.org>2015-12-27 21:08:46 +0000
commit6f1df16e2fb78fc7e03a84f9e8f42788e5b8028f (patch)
tree1c0ecfa51b52ed06c6e2ae22a7b8ea95f9a66e72 /tools
parent3376899410df56b9c29e62a48c34c2969fc7df0a (diff)
downloadFreeBSD-src-6f1df16e2fb78fc7e03a84f9e8f42788e5b8028f.zip
FreeBSD-src-6f1df16e2fb78fc7e03a84f9e8f42788e5b8028f.tar.gz
MFC r292492,r292495,r292647:
r292492: - Use nitems instead of handrolling the macro - Use a separate variable for tracking the testcase count instead of hardcoding the offset for the testcases Sponsored by: EMC / Isilon Storage Division r292495: Initialize j so it doesn't print out a garbage index Use it consistently instead of i in the first loop Sponsored by: EMC / Isilon Storage Division r292647: Use j instead of a hardcoded index (9) and increment it after running the NaNs testcases Pointyhat to: ngie Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/lib/msun/test-fma.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/tools/regression/lib/msun/test-fma.c b/tools/regression/lib/msun/test-fma.c
index f040b4e..7adbd81 100644
--- a/tools/regression/lib/msun/test-fma.c
+++ b/tools/regression/lib/msun/test-fma.c
@@ -31,6 +31,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <sys/param.h>
#include <assert.h>
#include <fenv.h>
#include <float.h>
@@ -474,49 +475,58 @@ int
main(int argc, char *argv[])
{
int rmodes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO };
- int i;
+ int i, j;
#if defined(__i386__)
printf("1..0 # SKIP all testcases fail on i386\n");
exit(0);
#endif
+ j = 1;
+
printf("1..19\n");
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < nitems(rmodes); i++, j++) {
+ printf("rmode = %d\n", rmodes[i]);
fesetround(rmodes[i]);
test_zeroes();
- printf("ok %d - fma zeroes\n", i + 1);
+ printf("ok %d - fma zeroes\n", j);
}
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < nitems(rmodes); i++, j++) {
+ printf("rmode = %d\n", rmodes[i]);
fesetround(rmodes[i]);
test_infinities();
- printf("ok %d - fma infinities\n", i + 5);
+ printf("ok %d - fma infinities\n", j);
}
fesetround(FE_TONEAREST);
test_nans();
- printf("ok 9 - fma NaNs\n");
+ printf("ok %d - fma NaNs\n", j);
+ j++;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < nitems(rmodes); i++, j++) {
+ printf("rmode = %d\n", rmodes[i]);
fesetround(rmodes[i]);
test_small_z();
- printf("ok %d - fma small z\n", i + 10);
+ printf("ok %d - fma small z\n", j);
}
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < nitems(rmodes); i++, j++) {
+ printf("rmode = %d\n", rmodes[i]);
fesetround(rmodes[i]);
test_big_z();
- printf("ok %d - fma big z\n", i + 14);
+ printf("ok %d - fma big z\n", j);
}
fesetround(FE_TONEAREST);
test_accuracy();
- printf("ok 18 - fma accuracy\n");
+ printf("ok %d - fma accuracy\n", j);
+ j++;
test_double_rounding();
- printf("ok 19 - fma double rounding\n");
+ printf("ok %d - fma double rounding\n", j);
+ j++;
/*
* TODO:
OpenPOWER on IntegriCloud