diff mbox

[2/4] benchtests: Add fmax/fmin benchmarks

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

Commit Message

Adhemerval Zanella Netto Dec. 19, 2016, 2:04 p.m. UTC
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.
	* benchtests/fmax-inputs: New file.
	* benchtests/fmin-inputs: Likewise.
---
 ChangeLog              |  4 ++++
 benchtests/Makefile    |  2 +-
 benchtests/fmax-inputs | 23 +++++++++++++++++++++++
 benchtests/fmin-inputs | 23 +++++++++++++++++++++++
 4 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 benchtests/fmax-inputs
 create mode 100644 benchtests/fmin-inputs

-- 
2.7.4

Comments

Siddhesh Poyarekar Dec. 19, 2016, 3:42 p.m. UTC | #1
On Monday 19 December 2016 07:34 PM, Adhemerval Zanella wrote:
> 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.

> 	* benchtests/fmax-inputs: New file.

> 	* benchtests/fmin-inputs: Likewise.


Looks good to me.

Siddhesh
Joseph Myers Dec. 19, 2016, 4:24 p.m. UTC | #2
I'd advise using -fno-builtin for these benchmarks to make sure they 
really do test the libm functions not compiler built-in functions (really, 
all benchmarks more generally should use -fno-builtin).

-- 
Joseph S. Myers
joseph@codesourcery.com
Adhemerval Zanella Netto Dec. 19, 2016, 5:30 p.m. UTC | #3
On 19/12/2016 14:24, Joseph Myers wrote:
> I'd advise using -fno-builtin for these benchmarks to make sure they 

> really do test the libm functions not compiler built-in functions (really, 

> all benchmarks more generally should use -fno-builtin).

> 


I will add -fno-builtin on f{max,min}{f} benchtests.
diff mbox

Patch

diff --git a/benchtests/Makefile b/benchtests/Makefile
index ba4d068..a3b53e1 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -24,7 +24,7 @@  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
+	      modf pow rint sin sincos sinh sqrt tan tanh fmin fmax
 
 bench-pthread := pthread_once
 
diff --git a/benchtests/fmax-inputs b/benchtests/fmax-inputs
new file mode 100644
index 0000000..18eb8fe
--- /dev/null
+++ b/benchtests/fmax-inputs
@@ -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 ("")
diff --git a/benchtests/fmin-inputs b/benchtests/fmin-inputs
new file mode 100644
index 0000000..18eb8fe
--- /dev/null
+++ b/benchtests/fmin-inputs
@@ -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 ("")