From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id CE5033858433; Mon, 6 Dec 2021 17:59:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE5033858433 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/hypot-refactor] math: Use fmin/fmax on hypot X-Act-Checkin: glibc X-Git-Author: Wilco Dijkstra X-Git-Refname: refs/heads/azanella/hypot-refactor X-Git-Oldrev: 4102ccd09b9f0fb195b532296754b16135d8931b X-Git-Newrev: 0b4dc7144851848096abc893ee001048bc09853c Message-Id: <20211206175909.CE5033858433@sourceware.org> Date: Mon, 6 Dec 2021 17:59:09 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Dec 2021 17:59:09 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0b4dc7144851848096abc893ee001048bc09853c commit 0b4dc7144851848096abc893ee001048bc09853c Author: Wilco Dijkstra Date: Wed Dec 1 11:08:14 2021 -0300 math: Use fmin/fmax on hypot It optimizes for architectures that provides fast builtins. Checked on aarch64-linux-gnu. Diff: --- sysdeps/ieee754/dbl-64/e_hypot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sysdeps/ieee754/dbl-64/e_hypot.c b/sysdeps/ieee754/dbl-64/e_hypot.c index 6fedf0d61f..0bdab989e4 100644 --- a/sysdeps/ieee754/dbl-64/e_hypot.c +++ b/sysdeps/ieee754/dbl-64/e_hypot.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "math_config.h" @@ -95,8 +96,8 @@ __ieee754_hypot (double x, double y) x = fabs (x); y = fabs (y); - double ax = x < y ? y : x; - double ay = x < y ? x : y; + double ax = USE_FMAX_BUILTIN ? fmax (x, y) : (x < y ? y : x); + double ay = USE_FMIN_BUILTIN ? fmin (x, y) : (x < y ? x : y); /* If ax is huge, scale both inputs down. */ if (__glibc_unlikely (ax > LARGE_VAL))