public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Shen-Ta Hsieh <ibmibmibm.tw@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH v4 2/2] x86_64: roundeven with sse4.1 support
Date: Thu, 28 May 2020 05:05:32 -0700	[thread overview]
Message-ID: <CAMe9rOpNPxD4W5Mb1iHhJ=j-ocDifwq-7yBz0YwAgkOz5SfBgw@mail.gmail.com> (raw)
In-Reply-To: <20200502150243.1347705-2-ibmibmibm.tw@gmail.com>

On Sat, May 2, 2020 at 8:06 AM Shen-Ta Hsieh via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> This patch adds support for the sse4.1 hardware floating point
> roundeven.

Do you have FSF paper on file?

> Here is a benchmark result on my AMD Ryzen 9 3900X system:

Since we don't know or may not care SSE4 machines without AVX,
should we make it to AVX only?

> * benchmark result before this commit
> |            |     roundeven |   roundevenf |
> |------------|---------------|--------------|
> | duration   |   3.77783e+09 |  3.77792e+09 |
> | iterations |   3.75706e+08 |  3.80448e+08 |
> | max        | 158.498       | 88.539       |
> | min        |   6.802       |  7.676       |
> | mean       |  10.0553      |  9.93018     |
>
> * benchmark result after this commit
> |            |     roundeven |    roundevenf |
> |------------|---------------|---------------|
> | duration   |   3.77242e+09 |   3.77238e+09 |
> | iterations |   5.18681e+08 |   5.2425e+08  |
> | max        | 127.338       | 172.102       |
> | min        |   7.03        |   7.03        |
> | mean       |   7.27311     |   7.19577     |
> ---
>  sysdeps/x86_64/fpu/multiarch/Makefile         |  5 +--
>  sysdeps/x86_64/fpu/multiarch/s_roundeven-c.c  |  2 ++
>  .../x86_64/fpu/multiarch/s_roundeven-sse4_1.S | 26 ++++++++++++++++
>  sysdeps/x86_64/fpu/multiarch/s_roundeven.c    | 31 +++++++++++++++++++
>  sysdeps/x86_64/fpu/multiarch/s_roundevenf-c.c |  3 ++
>  .../fpu/multiarch/s_roundevenf-sse4_1.S       | 26 ++++++++++++++++
>  sysdeps/x86_64/fpu/multiarch/s_roundevenf.c   | 31 +++++++++++++++++++
>  7 files changed, 122 insertions(+), 2 deletions(-)
>  create mode 100644 sysdeps/x86_64/fpu/multiarch/s_roundeven-c.c
>  create mode 100644 sysdeps/x86_64/fpu/multiarch/s_roundeven-sse4_1.S
>  create mode 100644 sysdeps/x86_64/fpu/multiarch/s_roundeven.c
>  create mode 100644 sysdeps/x86_64/fpu/multiarch/s_roundevenf-c.c
>  create mode 100644 sysdeps/x86_64/fpu/multiarch/s_roundevenf-sse4_1.S
>  create mode 100644 sysdeps/x86_64/fpu/multiarch/s_roundevenf.c
>
> diff --git a/sysdeps/x86_64/fpu/multiarch/Makefile b/sysdeps/x86_64/fpu/multiarch/Makefile
> index 3836574f48..7e3a3f78cb 100644
> --- a/sysdeps/x86_64/fpu/multiarch/Makefile
> +++ b/sysdeps/x86_64/fpu/multiarch/Makefile
> @@ -1,11 +1,12 @@
>  ifeq ($(subdir),math)
>  libm-sysdep_routines += s_floor-c s_ceil-c s_floorf-c s_ceilf-c \
>                         s_rint-c s_rintf-c s_nearbyint-c s_nearbyintf-c \
> -                       s_trunc-c s_truncf-c
> +                       s_roundeven-c s_roundevenf-c s_trunc-c s_truncf-c
>
>  libm-sysdep_routines += s_ceil-sse4_1 s_ceilf-sse4_1 s_floor-sse4_1 \
>                         s_floorf-sse4_1 s_nearbyint-sse4_1 \
> -                       s_nearbyintf-sse4_1 s_rint-sse4_1 s_rintf-sse4_1 \
> +                       s_nearbyintf-sse4_1 s_roundeven-sse4_1 \
> +                       s_roundevenf-sse4_1 s_rint-sse4_1 s_rintf-sse4_1 \
>                         s_trunc-sse4_1 s_truncf-sse4_1
>
>  libm-sysdep_routines += e_exp-fma e_log-fma e_pow-fma s_atan-fma \
> diff --git a/sysdeps/x86_64/fpu/multiarch/s_roundeven-c.c b/sysdeps/x86_64/fpu/multiarch/s_roundeven-c.c
> new file mode 100644
> index 0000000000..c7be43cb22
> --- /dev/null
> +++ b/sysdeps/x86_64/fpu/multiarch/s_roundeven-c.c
> @@ -0,0 +1,2 @@
> +#define __roundeven __roundeven_c
> +#include <sysdeps/ieee754/dbl-64/s_roundeven.c>
> diff --git a/sysdeps/x86_64/fpu/multiarch/s_roundeven-sse4_1.S b/sysdeps/x86_64/fpu/multiarch/s_roundeven-sse4_1.S
> new file mode 100644
> index 0000000000..6db88a1649
> --- /dev/null
> +++ b/sysdeps/x86_64/fpu/multiarch/s_roundeven-sse4_1.S
> @@ -0,0 +1,26 @@
> +/* Round to nearest integer value, rounding halfway cases to even.
> +   double version.
> +   Copyright (C) 2019 Free Software Foundation, Inc.

Please replace all 2019 with 2020.


-- 
H.J.

  reply	other threads:[~2020-05-28 12:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 17:31 [PATCH] Add benchtests for roundeven and roundevenf Shen-Ta Hsieh
2020-03-27 23:25 ` Joseph Myers
2020-05-02 15:02   ` [PATCH v4 1/2] math: redirect roundeven function Shen-Ta Hsieh
2020-05-02 15:02   ` [PATCH v4 2/2] x86_64: roundeven with sse4.1 support Shen-Ta Hsieh
2020-05-28 12:05     ` H.J. Lu [this message]
2020-05-28 12:22       ` Florian Weimer
2020-05-28 12:31         ` H.J. Lu
2020-05-29  8:48           ` Cui, Lili
2020-05-29 11:29             ` H.J. Lu
2020-06-01  1:28               ` Cui, Lili
2020-06-01  2:04                 ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMe9rOpNPxD4W5Mb1iHhJ=j-ocDifwq-7yBz0YwAgkOz5SfBgw@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=ibmibmibm.tw@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).