From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 31E5B385840C; Wed, 1 Dec 2021 17:10:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31E5B385840C 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: 4e0d0a8f2ed0423967c9b837aaf1145ebbbd41ed X-Git-Newrev: e6bca7374f00b3631d4ef7cee3d9b71e4b38b8c0 Message-Id: <20211201171001.31E5B385840C@sourceware.org> Date: Wed, 1 Dec 2021 17:10:01 +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: Wed, 01 Dec 2021 17:10:01 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e6bca7374f00b3631d4ef7cee3d9b71e4b38b8c0 commit e6bca7374f00b3631d4ef7cee3d9b71e4b38b8c0 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 5f438e4348..244d9caccc 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_FMAX_BUILTIN ? fmin (x, y) : (x < y ? x : y); /* If ax is huge, scale both inputs down. */ if (__glibc_unlikely (ax > LARGE_VAL))