benchtests: Add fmax/fmin benchmarks

This patch adds fmax and fmin benchtests.  It is based math/s_fmax_template.c
implementation which checks for basically four different classes:

  1. if x is greater or equal than y.
  2. if x is less than y.
  3. if x or y is signaling.
  4. if y is nan.

Cases 1 and 2 are used for default input number (by mixing normal double
numbers and infinity), while case 3 and 4 are used each for on for a
benchmark class.

Checked on x86_64-linux-gnu and powerpc64-linux-gnu.

	* benchtests/Makefile (bench-math): Add fmin and fmax.
	(CFLAGS-bench-fmax.c): New rule.
	(CFLAGS-bench-fmin.c): New rule.
	* benchtests/fmax-inputs: New file.
	* benchtests/fmin-inputs: Likewise.
This commit is contained in:
Adhemerval Zanella 2016-12-16 19:10:58 +00:00
parent b598e13477
commit 5d1f604a87
4 changed files with 55 additions and 1 deletions

View File

@ -1,5 +1,11 @@
2016-12-19 Adhemerval Zanella <adhemerval.zanella@linaro.org> 2016-12-19 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* benchtests/Makefile (bench-math): Add fmin and fmax.
(CFLAGS-bench-fmax.c): New rule.
(CFLAGS-bench-fmin.c): Likewise.
* benchtests/fmax-inputs: New file.
* benchtests/fmin-inputs: Likewise.
* benchtests/bench-string.h (TEST_FUNCTION): Use name without * benchtests/bench-string.h (TEST_FUNCTION): Use name without
parenthesis. parenthesis.
(CMDLINE_PROCESS): Define using function instead of macro. (CMDLINE_PROCESS): Define using function instead of macro.

View File

@ -24,7 +24,7 @@ subdir := benchtests
include ../Makeconfig include ../Makeconfig
bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \ bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \
modf pow rint sin sincos sinh sqrt tan tanh modf pow rint sin sincos sinh sqrt tan tanh fmin fmax
bench-pthread := pthread_once bench-pthread := pthread_once
@ -73,6 +73,8 @@ benchset := $(string-benchset-all) $(stdlib-benchset) $(stdio-common-benchset) \
CFLAGS-bench-ffs.c += -fno-builtin CFLAGS-bench-ffs.c += -fno-builtin
CFLAGS-bench-ffsll.c += -fno-builtin CFLAGS-bench-ffsll.c += -fno-builtin
CFLAGS-bench-sqrt.c += -fno-builtin CFLAGS-bench-sqrt.c += -fno-builtin
CFLAGS-bench-fmin.c += -fno-builtin
CFLAGS-bench-fmax.c += -fno-builtin
bench-malloc := malloc-thread bench-malloc := malloc-thread

23
benchtests/fmax-inputs Normal file
View File

@ -0,0 +1,23 @@
## includes: math.h
## args: double:double
## ret: double
78.5, -78.5
-78.5, 78.5
0, 78.5
78.5, 0
0, -78.5
-78.5, 0
__builtin_inf (), 78.5
__builtin_inf (), -78.5
78.5, __builtin_inf ()
-78.5, __builtin_inf ()
## name: qNaN
__builtin_nan (""), 78.5
__builtin_nan (""), -78.5
78.5, __builtin_nan ("")
-78.5, __builtin_nan ("")
## name: sNaN
__builtin_nans (""), 78.5
__builtin_nans (""), -78.5
78.5, __builtin_nans ("")
-78.5, __builtin_nans ("")

23
benchtests/fmin-inputs Normal file
View File

@ -0,0 +1,23 @@
## includes: math.h
## args: double:double
## ret: double
78.5, -78.5
-78.5, 78.5
0, 78.5
78.5, 0
0, -78.5
-78.5, 0
__builtin_inf (), 78.5
__builtin_inf (), -78.5
78.5, __builtin_inf ()
-78.5, __builtin_inf ()
## name: qNaN
__builtin_nan (""), 78.5
__builtin_nan (""), -78.5
78.5, __builtin_nan ("")
-78.5, __builtin_nan ("")
## name: sNaN
__builtin_nans (""), 78.5
__builtin_nans (""), -78.5
78.5, __builtin_nans ("")
-78.5, __builtin_nans ("")