From patchwork Tue Jun 9 21:32:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 39537 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5B27F388B03D; Tue, 9 Jun 2020 21:33:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B27F388B03D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738398; bh=EAKNmiLiGAdY/t68OY8eGNxDZoBpH4pIA/J5XwWqNwQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=MOmq1rikCbKE1X87ptg/ssn/CSCdrkqG9WOYoZLarX5Lm4CBmZNtmTDVsqm1NAAZu sO1JIsTTL4GXNhCn6qKDNjawOHRs67C4n389k98NTQtbUcFecrhO2Mv5+vnBqIGBl6 Fr2EvaAIqqbAVnkiZ9RBuw4ueARUWltLNNclZ7RE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by sourceware.org (Postfix) with ESMTPS id B139A388B03D for ; Tue, 9 Jun 2020 21:33:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B139A388B03D Received: by mail-qt1-x842.google.com with SMTP id z1so182779qtn.2 for ; Tue, 09 Jun 2020 14:33:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EAKNmiLiGAdY/t68OY8eGNxDZoBpH4pIA/J5XwWqNwQ=; b=gEzDPEYyTflXWTnTfI6vgiHwELgOqEXP9ESftcb30bcGbiinNTpVXGRbUMWgYXTRIN 4XNevy/ghNrxy5qR39ROwF0BSu7Z42Jm107DoFYbvv+ZwYOl+1MzOL3y44FRW+3+w8dl E+h1vEkZ6LoCHEW60ntYsw0xK9quX6tIVZA/JWCl0lEFPZaZC20jiEAid1aUu0qg/kbq bz9vgCa7HZIRpQibTk+or2/Z/BTNHhodttKdrugOz0PF9+k7OxBBYqcBhNDsHjflck2Q Y1OjrkkQHVU+I7S/x/rax2ZWpJHxwJW5LHgcnnbWy7GKlp6muAMOAMIrpxoAL5GI1DEx egBQ== X-Gm-Message-State: AOAM5310PVcDVaryJ6OgTUgfwU1PAPU5KJZtJWt0A/MTGOE8kbyGP6fg Q28MtdapWvUkveVAIIlBHwbiB0dbLZo= X-Google-Smtp-Source: ABdhPJywUhtOVAjtEalmqpew+6WZHcNUn6Y4NLoIMbwVrdAjYMWThbAcZOASMYkbjcrhREDUYcxQiA== X-Received: by 2002:ac8:4558:: with SMTP id z24mr30826572qtn.329.1591738393292; Tue, 09 Jun 2020 14:33:13 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:12 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 05/13] x86_64: Use builtin sqrt{f,l} Date: Tue, 9 Jun 2020 18:32:53 -0300 Message-Id: <20200609213301.3591135-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200609213301.3591135-1-adhemerval.zanella@linaro.org> References: <20200609213301.3591135-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-14.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Checked on x86_64-linux-gnu. --- sysdeps/x86_64/fpu/e_sqrt.c | 32 --------------------- sysdeps/x86_64/fpu/e_sqrtf.c | 32 --------------------- sysdeps/x86_64/fpu/e_sqrtl.c | 28 +++++++++++++++++- sysdeps/x86_64/fpu/math-use-builtins-sqrt.h | 4 +++ 4 files changed, 31 insertions(+), 65 deletions(-) delete mode 100644 sysdeps/x86_64/fpu/e_sqrt.c delete mode 100644 sysdeps/x86_64/fpu/e_sqrtf.c create mode 100644 sysdeps/x86_64/fpu/math-use-builtins-sqrt.h diff --git a/sysdeps/x86_64/fpu/e_sqrt.c b/sysdeps/x86_64/fpu/e_sqrt.c deleted file mode 100644 index c1708f9b65..0000000000 --- a/sysdeps/x86_64/fpu/e_sqrt.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Square root of floating point number. - Copyright (C) 2002-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include - -#undef __ieee754_sqrt -double -__ieee754_sqrt (double x) -{ - double res; - - asm ("sqrtsd %1, %0" : "=x" (res) : "xm" (x)); - - return res; -} -libm_alias_finite (__ieee754_sqrt, __sqrt) diff --git a/sysdeps/x86_64/fpu/e_sqrtf.c b/sysdeps/x86_64/fpu/e_sqrtf.c deleted file mode 100644 index 6155c7be24..0000000000 --- a/sysdeps/x86_64/fpu/e_sqrtf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Square root of floating point number. - Copyright (C) 2002-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include - -#undef __ieee754_sqrtf -float -__ieee754_sqrtf (float x) -{ - float res; - - asm ("sqrtss %1, %0" : "=x" (res) : "xm" (x)); - - return res; -} -libm_alias_finite (__ieee754_sqrtf, __sqrtf) diff --git a/sysdeps/x86_64/fpu/e_sqrtl.c b/sysdeps/x86_64/fpu/e_sqrtl.c index 90e4e164e5..7ea6f52058 100644 --- a/sysdeps/x86_64/fpu/e_sqrtl.c +++ b/sysdeps/x86_64/fpu/e_sqrtl.c @@ -1 +1,27 @@ -#include "sysdeps/i386/fpu/e_sqrtl.c" +/* Square root function. x86_64 long double version. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +long double +__ieee754_sqrtl (long double x) +{ + return __builtin_sqrtl (x); +} +libm_alias_finite (__ieee754_sqrtl, __sqrtl) diff --git a/sysdeps/x86_64/fpu/math-use-builtins-sqrt.h b/sysdeps/x86_64/fpu/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..e94c915ba6 --- /dev/null +++ b/sysdeps/x86_64/fpu/math-use-builtins-sqrt.h @@ -0,0 +1,4 @@ +#define USE_SQRT_BUILTIN 1 +#define USE_SQRTF_BUILTIN 1 +#define USE_SQRTL_BUILTIN 0 +#define USE_SQRTF128_BUILTIN 0