This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v3] Add math-inline benchmark


Add a benchmark for isinf/isnan/isnormal/isfinite/fpclassify. The test uses 2 arrays with 1024
doubles, one with 99% finite FP numbers (10% zeroes, 10% negative) and 1% inf/NaN, the other with
50% inf, and 50% Nan.

This version removes various tests that caused confusion and only leaves the existing GLIBC
definitions and inlines for comparison with the GCC builtins. I changed the tests to not inline
inside the loop and use a branch on the boolean result. The 64-bit immediates used by the GLIBC
inlines seem very expensive on some microarchitectures, so this shows even more clearly that using
the built-ins results in a significant performance gain (see x64 results below).


ChangeLog:
2015-07-23  Wilco Dijkstra  <wdijkstr@arm.com>

	* benchtests/Makefile: Add bench-math-inlines, link with libm.
	* benchtests/bench-math-inlines.c: New benchmark.
	* benchtests/bench-util.h: New file.
	* benchtests/bench-util.c: New file.
	* benchtests/bench-skeleton.c: Add include of bench-util.c/h.


  "__isnan_t": {
    "normal": {
     "duration": 5.32475e+06,
     "iterations": 500,
     "mean": 10649
    }
   },
   "__isnan_inl_t": {
    "normal": {
     "duration": 2.74296e+06,
     "iterations": 500,
     "mean": 5485
    }
   },
   "__isnan_builtin_t": {
    "normal": {
     "duration": 2.35589e+06,
     "iterations": 500,
     "mean": 4711
    }
   },
   "isnan_t": {
    "normal": {
     "duration": 2.25889e+06,
     "iterations": 500,
     "mean": 4517
    }
   },
   "__isinf_t": {
    "normal": {
     "duration": 5.7671e+06,
     "iterations": 500,
     "mean": 11534
    }
   },
   "__isinf_ns_t": {
    "normal": {
     "duration": 2.70963e+06,
     "iterations": 500,
     "mean": 5419
    }
   },
   "__isinf_ns_builtin_t": {
    "normal": {
     "duration": 2.70841e+06,
     "iterations": 500,
     "mean": 5416
    }
   },
   "__isinf_builtin_t": {
    "normal": {
     "duration": 2.26255e+06,
     "iterations": 500,
     "mean": 4525
    }
   },
   "isinf_t": {
    "normal": {
     "duration": 2.26428e+06,
     "iterations": 500,
     "mean": 4528
    }
   },
   "__finite_t": {
    "normal": {
     "duration": 5.82567e+06,
     "iterations": 500,
     "mean": 11651
    }
   },
   "__finite_inl_t": {
    "normal": {
     "duration": 3.2019e+06,
     "iterations": 500,
     "mean": 6403
    }
   },
   "__isfinite_builtin_t": {
    "normal": {
     "duration": 3.17892e+06,
     "iterations": 500,
     "mean": 6357
    }
   },
   "isfinite_t": {
    "normal": {
     "duration": 2.75324e+06,
     "iterations": 500,
     "mean": 5506
    }
   },
   "__isnormal_inl_t": {
    "normal": {
     "duration": 8.65908e+06,
     "iterations": 500,
     "mean": 17318
   }
   },
   "__isnormal_builtin_t": {
    "normal": {
     "duration": 3.68589e+06,
     "iterations": 500,
     "mean": 7371
    }
   },
   "isnormal_t": {
    "normal": {
     "duration": 3.76085e+06,
     "iterations": 500,
     "mean": 7521
    }
   },
   "__fpclassify_t": {
    "normal": {
     "duration": 6.63574e+06,
     "iterations": 500,
     "mean": 13271
    }
   },
   "__fpclassify_builtin_t": {
    "normal": {
     "duration": 4.48757e+06,
     "iterations": 500,
     "mean": 8975
    }
   },
   "fpclassify_t": {
    "normal": {
     "duration": 4.48033e+06,
     "iterations": 500,
     "mean": 8960
    }
   },
   "remainder_test1_t": {
    "normal": {
     "duration": 2.10051e+07,
     "iterations": 500,
     "mean": 42010
    }
   },
   "remainder_test2_t": {
    "normal": {
     "duration": 1.9933e+07,
     "iterations": 500,
     "mean": 39865
    }
   }
  }

Attachment: 0001-Add-bench-math-inlines.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]