Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Dec 2015 04:28:37 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292492 - head/tools/regression/lib/msun
Message-ID:  <201512200428.tBK4Sb68080666@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun Dec 20 04:28:37 2015
New Revision: 292492
URL: https://svnweb.freebsd.org/changeset/base/292492

Log:
  - Use nitems instead of handrolling the macro
  - Use a separate variable for tracking the testcase count instead
    of hardcoding the offset for the testcases
  
  MFC after: 3 days
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/tools/regression/lib/msun/test-fma.c

Modified: head/tools/regression/lib/msun/test-fma.c
==============================================================================
--- head/tools/regression/lib/msun/test-fma.c	Sun Dec 20 04:17:54 2015	(r292491)
+++ head/tools/regression/lib/msun/test-fma.c	Sun Dec 20 04:28:37 2015	(r292492)
@@ -31,6 +31,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include <sys/param.h>
 #include <assert.h>
 #include <fenv.h>
 #include <float.h>
@@ -473,44 +474,50 @@ int
 main(int argc, char *argv[])
 {
 	int rmodes[] = { FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO };
-	int i;
+	int i, j;
 
 	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);
 	}
 
-	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");
 
-	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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512200428.tBK4Sb68080666>