[3/4] benchtests: Add fmaxf/fminf benchmarks

Message ID 1482156263-22267-3-git-send-email-adhemerval.zanella@linaro.org
State New
Headers show

Commit Message

Adhemerval Zanella Dec. 19, 2016, 2:04 p.m.
This patch adds fmaxf and fminf benchtests.  It is based on
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 fminf and fmaxf.
        * benchtests/fmaxf-inputs: New file.
        * benchtests/fminf-inputs: Likewise.
---
 ChangeLog               |  4 ++++
 benchtests/Makefile     |  3 ++-
 benchtests/fmaxf-inputs | 23 +++++++++++++++++++++++
 benchtests/fminf-inputs | 23 +++++++++++++++++++++++
 4 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 benchtests/fmaxf-inputs
 create mode 100644 benchtests/fminf-inputs

-- 
2.7.4

Comments

Siddhesh Poyarekar Dec. 19, 2016, 3:43 p.m. | #1
On Monday 19 December 2016 07:34 PM, Adhemerval Zanella wrote:
> This patch adds fmaxf and fminf benchtests.  It is based on

> 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 fminf and fmaxf.

>         * benchtests/fmaxf-inputs: New file.

>         * benchtests/fminf-inputs: Likewise.


Looks good to me.

Siddhesh

Patch hide | download patch | download mbox

diff --git a/benchtests/Makefile b/benchtests/Makefile
index a3b53e1..9e5f6c6 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -24,7 +24,8 @@  subdir := benchtests
 
 include ../Makeconfig
 bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 \
-	      modf pow rint sin sincos sinh sqrt tan tanh fmin fmax
+	      modf pow rint sin sincos sinh sqrt tan tanh fmin fmax fminf \
+	      fmaxf
 
 bench-pthread := pthread_once
 
diff --git a/benchtests/fmaxf-inputs b/benchtests/fmaxf-inputs
new file mode 100644
index 0000000..7eb7bda
--- /dev/null
+++ b/benchtests/fmaxf-inputs
@@ -0,0 +1,23 @@ 
+## includes: math.h
+## args: float:float
+## ret: float
+78.5f, -78.5f
+-78.5f, 78.5f
+0.0f,   78.5f
+78.5f,  0.0f
+0.0f,   -78.5f
+-78.5, 0.0f
+__builtin_inff (), 78.5f
+__builtin_inff (), -78.5f
+78.5f, __builtin_inff ()
+-78.5f, __builtin_inff ()
+## name: qNaN
+__builtin_nanf (""), 78.5f
+__builtin_nanf (""), -78.5f
+78.5f, __builtin_nanf ("")
+-78.5f, __builtin_nanf ("")
+## name: sNaN
+__builtin_nansf (""), 78.5f
+__builtin_nansf (""), -78.5f
+78.5f, __builtin_nansf ("")
+-78.5f, __builtin_nansf ("")
diff --git a/benchtests/fminf-inputs b/benchtests/fminf-inputs
new file mode 100644
index 0000000..7eb7bda
--- /dev/null
+++ b/benchtests/fminf-inputs
@@ -0,0 +1,23 @@ 
+## includes: math.h
+## args: float:float
+## ret: float
+78.5f, -78.5f
+-78.5f, 78.5f
+0.0f,   78.5f
+78.5f,  0.0f
+0.0f,   -78.5f
+-78.5, 0.0f
+__builtin_inff (), 78.5f
+__builtin_inff (), -78.5f
+78.5f, __builtin_inff ()
+-78.5f, __builtin_inff ()
+## name: qNaN
+__builtin_nanf (""), 78.5f
+__builtin_nanf (""), -78.5f
+78.5f, __builtin_nanf ("")
+-78.5f, __builtin_nanf ("")
+## name: sNaN
+__builtin_nansf (""), 78.5f
+__builtin_nansf (""), -78.5f
+78.5f, __builtin_nansf ("")
+-78.5f, __builtin_nansf ("")