From patchwork Tue Jun 9 21:32:49 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: 1306306 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=vvA2WPjE; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNdr1HsFz9sRR for ; Wed, 10 Jun 2020 07:33:20 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51CED388B02A; Tue, 9 Jun 2020 21:33:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 51CED388B02A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738392; bh=yyW5hEIlrpRkCeuF8OgX+4VBZqun67F6eQ1C1k6Ejnc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=vvA2WPjEDN7JEoGE0lKqUaxpZbd0QzV2xGSrzwgv7XoQdqpQ2ae5A7ZVTbgvoe4fA HzgDeeIYdUOlAAsNlIAD2bYcC3rDWa4VoEeGh5ACl3xvcd663m9n7tOpOBNSGhLV2Y tnghwIueppGqygMArYdDl2dMUORf6zlSGpSvtGCc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by sourceware.org (Postfix) with ESMTPS id 0848A388A82A for ; Tue, 9 Jun 2020 21:33:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0848A388A82A Received: by mail-qk1-x742.google.com with SMTP id q8so70601qkm.12 for ; Tue, 09 Jun 2020 14:33:08 -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:mime-version :content-transfer-encoding; bh=yyW5hEIlrpRkCeuF8OgX+4VBZqun67F6eQ1C1k6Ejnc=; b=VNoxptxz/Pg+KwareMjVeXuhUpNEUq7AZO4z9oeDQFWR8bEA5CyC2Ubg7cRpf+3E/A Ft2G0npEHtMDe3I0m2eqqfgz8AIuVVzMlDNoPiIKbD4NKFeM16S+zK0M3ujqqbfXf5I9 yEat0MIQUIvgK4QJefctB6LWLKC1Yw0dKBMhBo1nSJArkskhlICZytImrNxy9taqq5By GMb4XnGUiw3O6e5d+bXdU0IjpxYb4V8iiRriQOkmfSgxyva4qzGsDC8xdc3a7siuSrFQ WoqlVHY9KaPGW9ND3OyWLFdKVt0CT1x7qa6In2Yv5EPNBSSc+9BpkFa99DrfsXurOmoz t7ew== X-Gm-Message-State: AOAM5306mbgb+3BDEJ5jNfZtarkqVXwhtjll50Tk7X/ashFMNAa8gffS rEngBl5WRiUWWGYyb0s3gLfuPsjbigE= X-Google-Smtp-Source: ABdhPJywdZwHb6fhWaWEtFOWHSXVqI9lA3OaA8sT8VEj1GBtdkFjuZHZCK/8p08P4p8CUZSfROB4oQ== X-Received: by 2002:a05:620a:2183:: with SMTP id g3mr30226593qka.254.1591738386765; Tue, 09 Jun 2020 14:33:06 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:06 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 01/13] math: Decompose math-use-builtins.h Date: Tue, 9 Jun 2020 18:32:49 -0300 Message-Id: <20200609213301.3591135-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 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" Each symbol definitions are moved on a separated file and it cover all symbol type definitions (float, double, long double, and float128). It allows to set support for architectures without the boiler place of copying default values. Checked with a build on the affected ABIs. --- sysdeps/aarch64/fpu/math-use-builtins-ceil.h | 4 + sysdeps/aarch64/fpu/math-use-builtins-floor.h | 4 + sysdeps/aarch64/fpu/math-use-builtins-fma.h | 4 + .../aarch64/fpu/math-use-builtins-nearbyint.h | 4 + sysdeps/aarch64/fpu/math-use-builtins-rint.h | 4 + sysdeps/aarch64/fpu/math-use-builtins-round.h | 4 + sysdeps/aarch64/fpu/math-use-builtins-sqrt.h | 4 + sysdeps/aarch64/fpu/math-use-builtins-trunc.h | 4 + sysdeps/aarch64/fpu/math-use-builtins.h | 71 ----------- sysdeps/generic/math-use-builtins-ceil.h | 4 + sysdeps/generic/math-use-builtins-copysign.h | 7 ++ sysdeps/generic/math-use-builtins-floor.h | 4 + sysdeps/generic/math-use-builtins-fma.h | 4 + sysdeps/generic/math-use-builtins-nearbyint.h | 4 + sysdeps/generic/math-use-builtins-rint.h | 4 + sysdeps/generic/math-use-builtins-round.h | 4 + sysdeps/generic/math-use-builtins-sqrt.h | 4 + sysdeps/generic/math-use-builtins-trunc.h | 4 + sysdeps/generic/math-use-builtins.h | 56 ++------- sysdeps/powerpc/fpu/math-use-builtins-fma.h | 9 ++ sysdeps/powerpc/fpu/math-use-builtins.h | 77 ------------ sysdeps/s390/fpu/math-use-builtins-ceil.h | 15 +++ sysdeps/s390/fpu/math-use-builtins-floor.h | 15 +++ .../s390/fpu/math-use-builtins-nearbyint.h | 15 +++ sysdeps/s390/fpu/math-use-builtins-rint.h | 15 +++ sysdeps/s390/fpu/math-use-builtins-round.h | 15 +++ sysdeps/s390/fpu/math-use-builtins-trunc.h | 15 +++ sysdeps/s390/fpu/math-use-builtins.h | 119 ------------------ 28 files changed, 181 insertions(+), 312 deletions(-) create mode 100644 sysdeps/aarch64/fpu/math-use-builtins-ceil.h create mode 100644 sysdeps/aarch64/fpu/math-use-builtins-floor.h create mode 100644 sysdeps/aarch64/fpu/math-use-builtins-fma.h create mode 100644 sysdeps/aarch64/fpu/math-use-builtins-nearbyint.h create mode 100644 sysdeps/aarch64/fpu/math-use-builtins-rint.h create mode 100644 sysdeps/aarch64/fpu/math-use-builtins-round.h create mode 100644 sysdeps/aarch64/fpu/math-use-builtins-sqrt.h create mode 100644 sysdeps/aarch64/fpu/math-use-builtins-trunc.h delete mode 100644 sysdeps/aarch64/fpu/math-use-builtins.h create mode 100644 sysdeps/generic/math-use-builtins-ceil.h create mode 100644 sysdeps/generic/math-use-builtins-copysign.h create mode 100644 sysdeps/generic/math-use-builtins-floor.h create mode 100644 sysdeps/generic/math-use-builtins-fma.h create mode 100644 sysdeps/generic/math-use-builtins-nearbyint.h create mode 100644 sysdeps/generic/math-use-builtins-rint.h create mode 100644 sysdeps/generic/math-use-builtins-round.h create mode 100644 sysdeps/generic/math-use-builtins-sqrt.h create mode 100644 sysdeps/generic/math-use-builtins-trunc.h create mode 100644 sysdeps/powerpc/fpu/math-use-builtins-fma.h delete mode 100644 sysdeps/powerpc/fpu/math-use-builtins.h create mode 100644 sysdeps/s390/fpu/math-use-builtins-ceil.h create mode 100644 sysdeps/s390/fpu/math-use-builtins-floor.h create mode 100644 sysdeps/s390/fpu/math-use-builtins-nearbyint.h create mode 100644 sysdeps/s390/fpu/math-use-builtins-rint.h create mode 100644 sysdeps/s390/fpu/math-use-builtins-round.h create mode 100644 sysdeps/s390/fpu/math-use-builtins-trunc.h delete mode 100644 sysdeps/s390/fpu/math-use-builtins.h diff --git a/sysdeps/aarch64/fpu/math-use-builtins-ceil.h b/sysdeps/aarch64/fpu/math-use-builtins-ceil.h new file mode 100644 index 0000000000..17d6452e51 --- /dev/null +++ b/sysdeps/aarch64/fpu/math-use-builtins-ceil.h @@ -0,0 +1,4 @@ +#define USE_CEIL_BUILTIN 1 +#define USE_CEILF_BUILTIN 1 +#define USE_CEILL_BUILTIN 0 +#define USE_CEILF128_BUILTIN 0 diff --git a/sysdeps/aarch64/fpu/math-use-builtins-floor.h b/sysdeps/aarch64/fpu/math-use-builtins-floor.h new file mode 100644 index 0000000000..553c0674af --- /dev/null +++ b/sysdeps/aarch64/fpu/math-use-builtins-floor.h @@ -0,0 +1,4 @@ +#define USE_FLOOR_BUILTIN 1 +#define USE_FLOORF_BUILTIN 1 +#define USE_FLOORL_BUILTIN 0 +#define USE_FLOORF128_BUILTIN 0 diff --git a/sysdeps/aarch64/fpu/math-use-builtins-fma.h b/sysdeps/aarch64/fpu/math-use-builtins-fma.h new file mode 100644 index 0000000000..eede75aa41 --- /dev/null +++ b/sysdeps/aarch64/fpu/math-use-builtins-fma.h @@ -0,0 +1,4 @@ +#define USE_FMA_BUILTIN 1 +#define USE_FMAF_BUILTIN 1 +#define USE_FMAL_BUILTIN 0 +#define USE_FMAF128_BUILTIN 0 diff --git a/sysdeps/aarch64/fpu/math-use-builtins-nearbyint.h b/sysdeps/aarch64/fpu/math-use-builtins-nearbyint.h new file mode 100644 index 0000000000..a2590c920f --- /dev/null +++ b/sysdeps/aarch64/fpu/math-use-builtins-nearbyint.h @@ -0,0 +1,4 @@ +#define USE_NEARBYINT_BUILTIN 1 +#define USE_NEARBYINTF_BUILTIN 1 +#define USE_NEARBYINTL_BUILTIN 0 +#define USE_NEARBYINTF128_BUILTIN 0 diff --git a/sysdeps/aarch64/fpu/math-use-builtins-rint.h b/sysdeps/aarch64/fpu/math-use-builtins-rint.h new file mode 100644 index 0000000000..45c3307692 --- /dev/null +++ b/sysdeps/aarch64/fpu/math-use-builtins-rint.h @@ -0,0 +1,4 @@ +#define USE_RINT_BUILTIN 1 +#define USE_RINTF_BUILTIN 1 +#define USE_RINTL_BUILTIN 0 +#define USE_RINTF128_BUILTIN 0 diff --git a/sysdeps/aarch64/fpu/math-use-builtins-round.h b/sysdeps/aarch64/fpu/math-use-builtins-round.h new file mode 100644 index 0000000000..f6083d7d0a --- /dev/null +++ b/sysdeps/aarch64/fpu/math-use-builtins-round.h @@ -0,0 +1,4 @@ +#define USE_ROUND_BUILTIN 1 +#define USE_ROUNDF_BUILTIN 1 +#define USE_ROUNDL_BUILTIN 0 +#define USE_ROUNDF128_BUILTIN 0 diff --git a/sysdeps/aarch64/fpu/math-use-builtins-sqrt.h b/sysdeps/aarch64/fpu/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..e94c915ba6 --- /dev/null +++ b/sysdeps/aarch64/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 diff --git a/sysdeps/aarch64/fpu/math-use-builtins-trunc.h b/sysdeps/aarch64/fpu/math-use-builtins-trunc.h new file mode 100644 index 0000000000..4fc6da42b6 --- /dev/null +++ b/sysdeps/aarch64/fpu/math-use-builtins-trunc.h @@ -0,0 +1,4 @@ +#define USE_TRUNC_BUILTIN 1 +#define USE_TRUNCF_BUILTIN 1 +#define USE_TRUNCL_BUILTIN 0 +#define USE_TRUNCF128_BUILTIN 0 diff --git a/sysdeps/aarch64/fpu/math-use-builtins.h b/sysdeps/aarch64/fpu/math-use-builtins.h deleted file mode 100644 index 50a1ba0db5..0000000000 --- a/sysdeps/aarch64/fpu/math-use-builtins.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Using math gcc builtins instead of generic implementation. aarch64 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 - . */ - -#ifndef MATH_USE_BUILTINS_H -#define MATH_USE_BUILTINS_H 1 - -#include /* For __GNUC_PREREQ. */ - -/* Define these macros to 1 to use __builtin_xyz instead of the - generic implementation. */ -#define USE_NEARBYINT_BUILTIN 1 -#define USE_NEARBYINTF_BUILTIN 1 -#define USE_NEARBYINTL_BUILTIN 0 -#define USE_NEARBYINTF128_BUILTIN 0 - -#define USE_RINT_BUILTIN 1 -#define USE_RINTF_BUILTIN 1 -#define USE_RINTL_BUILTIN 0 -#define USE_RINTF128_BUILTIN 0 - -#define USE_FLOOR_BUILTIN 1 -#define USE_FLOORF_BUILTIN 1 -#define USE_FLOORL_BUILTIN 0 -#define USE_FLOORF128_BUILTIN 0 - -#define USE_CEIL_BUILTIN 1 -#define USE_CEILF_BUILTIN 1 -#define USE_CEILL_BUILTIN 0 -#define USE_CEILF128_BUILTIN 0 - -#define USE_TRUNC_BUILTIN 1 -#define USE_TRUNCF_BUILTIN 1 -#define USE_TRUNCL_BUILTIN 0 -#define USE_TRUNCF128_BUILTIN 0 - -#define USE_ROUND_BUILTIN 1 -#define USE_ROUNDF_BUILTIN 1 -#define USE_ROUNDL_BUILTIN 0 -#define USE_ROUNDF128_BUILTIN 0 - -#define USE_COPYSIGNL_BUILTIN 1 -#if __GNUC_PREREQ (7, 0) -# define USE_COPYSIGNF128_BUILTIN 1 -#else -# define USE_COPYSIGNF128_BUILTIN 0 -#endif - -#define USE_SQRT_BUILTIN 1 -#define USE_SQRTF_BUILTIN 1 - -#define USE_FMA_BUILTIN 1 -#define USE_FMAF_BUILTIN 1 -#define USE_FMAL_BUILTIN 0 -#define USE_FMAF128_BUILTIN 0 - -#endif diff --git a/sysdeps/generic/math-use-builtins-ceil.h b/sysdeps/generic/math-use-builtins-ceil.h new file mode 100644 index 0000000000..0698033493 --- /dev/null +++ b/sysdeps/generic/math-use-builtins-ceil.h @@ -0,0 +1,4 @@ +#define USE_CEIL_BUILTIN 0 +#define USE_CEILF_BUILTIN 0 +#define USE_CEILL_BUILTIN 0 +#define USE_CEILF128_BUILTIN 0 diff --git a/sysdeps/generic/math-use-builtins-copysign.h b/sysdeps/generic/math-use-builtins-copysign.h new file mode 100644 index 0000000000..3cf9bbe1fd --- /dev/null +++ b/sysdeps/generic/math-use-builtins-copysign.h @@ -0,0 +1,7 @@ +/* Generic implementations for float and double always use the __builtin. */ +#define USE_COPYSIGNL_BUILTIN 1 +#if __GNUC_PREREQ (7, 0) +# define USE_COPYSIGNF128_BUILTIN 1 +#else +# define USE_COPYSIGNF128_BUILTIN 0 +#endif diff --git a/sysdeps/generic/math-use-builtins-floor.h b/sysdeps/generic/math-use-builtins-floor.h new file mode 100644 index 0000000000..b0858d9eda --- /dev/null +++ b/sysdeps/generic/math-use-builtins-floor.h @@ -0,0 +1,4 @@ +#define USE_FLOOR_BUILTIN 0 +#define USE_FLOORF_BUILTIN 0 +#define USE_FLOORL_BUILTIN 0 +#define USE_FLOORF128_BUILTIN 0 diff --git a/sysdeps/generic/math-use-builtins-fma.h b/sysdeps/generic/math-use-builtins-fma.h new file mode 100644 index 0000000000..51dcb6a240 --- /dev/null +++ b/sysdeps/generic/math-use-builtins-fma.h @@ -0,0 +1,4 @@ +#define USE_FMA_BUILTIN 0 +#define USE_FMAF_BUILTIN 0 +#define USE_FMAL_BUILTIN 0 +#define USE_FMAF128_BUILTIN 0 diff --git a/sysdeps/generic/math-use-builtins-nearbyint.h b/sysdeps/generic/math-use-builtins-nearbyint.h new file mode 100644 index 0000000000..ab453532b0 --- /dev/null +++ b/sysdeps/generic/math-use-builtins-nearbyint.h @@ -0,0 +1,4 @@ +#define USE_NEARBYINT_BUILTIN 0 +#define USE_NEARBYINTF_BUILTIN 0 +#define USE_NEARBYINTL_BUILTIN 0 +#define USE_NEARBYINTF128_BUILTIN 0 diff --git a/sysdeps/generic/math-use-builtins-rint.h b/sysdeps/generic/math-use-builtins-rint.h new file mode 100644 index 0000000000..24793757f6 --- /dev/null +++ b/sysdeps/generic/math-use-builtins-rint.h @@ -0,0 +1,4 @@ +#define USE_RINT_BUILTIN 0 +#define USE_RINTF_BUILTIN 0 +#define USE_RINTL_BUILTIN 0 +#define USE_RINTF128_BUILTIN 0 diff --git a/sysdeps/generic/math-use-builtins-round.h b/sysdeps/generic/math-use-builtins-round.h new file mode 100644 index 0000000000..de2dce1f5b --- /dev/null +++ b/sysdeps/generic/math-use-builtins-round.h @@ -0,0 +1,4 @@ +#define USE_ROUND_BUILTIN 0 +#define USE_ROUNDF_BUILTIN 0 +#define USE_ROUNDL_BUILTIN 0 +#define USE_ROUNDF128_BUILTIN 0 diff --git a/sysdeps/generic/math-use-builtins-sqrt.h b/sysdeps/generic/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..7b4fed380f --- /dev/null +++ b/sysdeps/generic/math-use-builtins-sqrt.h @@ -0,0 +1,4 @@ +#define USE_SQRT_BUILTIN 0 +#define USE_SQRTF_BUILTIN 0 +#define USE_SQRTL_BUILTIN 0 +#define USE_SQRTF128_BUILTIN 0 diff --git a/sysdeps/generic/math-use-builtins-trunc.h b/sysdeps/generic/math-use-builtins-trunc.h new file mode 100644 index 0000000000..59e6d97d13 --- /dev/null +++ b/sysdeps/generic/math-use-builtins-trunc.h @@ -0,0 +1,4 @@ +#define USE_TRUNC_BUILTIN 0 +#define USE_TRUNCF_BUILTIN 0 +#define USE_TRUNCL_BUILTIN 0 +#define USE_TRUNCF128_BUILTIN 0 diff --git a/sysdeps/generic/math-use-builtins.h b/sysdeps/generic/math-use-builtins.h index cf25ed8a21..78d6146762 100644 --- a/sysdeps/generic/math-use-builtins.h +++ b/sysdeps/generic/math-use-builtins.h @@ -23,49 +23,15 @@ /* Define these macros to 1 to use __builtin_xyz instead of the generic implementation. */ -#define USE_NEARBYINT_BUILTIN 0 -#define USE_NEARBYINTF_BUILTIN 0 -#define USE_NEARBYINTL_BUILTIN 0 -#define USE_NEARBYINTF128_BUILTIN 0 -#define USE_RINT_BUILTIN 0 -#define USE_RINTF_BUILTIN 0 -#define USE_RINTL_BUILTIN 0 -#define USE_RINTF128_BUILTIN 0 - -#define USE_FLOOR_BUILTIN 0 -#define USE_FLOORF_BUILTIN 0 -#define USE_FLOORL_BUILTIN 0 -#define USE_FLOORF128_BUILTIN 0 - -#define USE_CEIL_BUILTIN 0 -#define USE_CEILF_BUILTIN 0 -#define USE_CEILL_BUILTIN 0 -#define USE_CEILF128_BUILTIN 0 - -#define USE_TRUNC_BUILTIN 0 -#define USE_TRUNCF_BUILTIN 0 -#define USE_TRUNCL_BUILTIN 0 -#define USE_TRUNCF128_BUILTIN 0 - -#define USE_ROUND_BUILTIN 0 -#define USE_ROUNDF_BUILTIN 0 -#define USE_ROUNDL_BUILTIN 0 -#define USE_ROUNDF128_BUILTIN 0 - -#define USE_COPYSIGNL_BUILTIN 1 -#if __GNUC_PREREQ (7, 0) -# define USE_COPYSIGNF128_BUILTIN 1 -#else -# define USE_COPYSIGNF128_BUILTIN 0 -#endif - -#define USE_SQRT_BUILTIN 0 -#define USE_SQRTF_BUILTIN 0 - -#define USE_FMA_BUILTIN 0 -#define USE_FMAF_BUILTIN 0 -#define USE_FMAL_BUILTIN 0 -#define USE_FMAF128_BUILTIN 0 - -#endif /* math-use-builtins.h */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* MATH_USE_BUILTINS_H */ diff --git a/sysdeps/powerpc/fpu/math-use-builtins-fma.h b/sysdeps/powerpc/fpu/math-use-builtins-fma.h new file mode 100644 index 0000000000..5652e55185 --- /dev/null +++ b/sysdeps/powerpc/fpu/math-use-builtins-fma.h @@ -0,0 +1,9 @@ +#define USE_FMA_BUILTIN 1 +#define USE_FMAF_BUILTIN 1 +#define USE_FMAL_BUILTIN 0 +/* This is not available for P8 or BE targets. */ +#ifdef __FP_FAST_FMAF128 +# define USE_FMAF128_BUILTIN 1 +#else +# define USE_FMAF128_BUILTIN 0 +#endif diff --git a/sysdeps/powerpc/fpu/math-use-builtins.h b/sysdeps/powerpc/fpu/math-use-builtins.h deleted file mode 100644 index 72e28ec9cc..0000000000 --- a/sysdeps/powerpc/fpu/math-use-builtins.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Using math gcc builtins instead of generic implementation. PowerPC version. - Copyright (C) 2019-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 - . */ - -#ifndef MATH_USE_BUILTINS_H -#define MATH_USE_BUILTINS_H 1 - -#include /* For __GNUC_PREREQ. */ - -/* Define these macros to 1 to use __builtin_xyz instead of the - generic implementation. */ -#define USE_NEARBYINT_BUILTIN 0 -#define USE_NEARBYINTF_BUILTIN 0 -#define USE_NEARBYINTL_BUILTIN 0 -#define USE_NEARBYINTF128_BUILTIN 0 - -#define USE_RINT_BUILTIN 0 -#define USE_RINTF_BUILTIN 0 -#define USE_RINTL_BUILTIN 0 -#define USE_RINTF128_BUILTIN 0 - -#define USE_FLOOR_BUILTIN 0 -#define USE_FLOORF_BUILTIN 0 -#define USE_FLOORL_BUILTIN 0 -#define USE_FLOORF128_BUILTIN 0 - -#define USE_CEIL_BUILTIN 0 -#define USE_CEILF_BUILTIN 0 -#define USE_CEILL_BUILTIN 0 -#define USE_CEILF128_BUILTIN 0 - -#define USE_TRUNC_BUILTIN 0 -#define USE_TRUNCF_BUILTIN 0 -#define USE_TRUNCL_BUILTIN 0 -#define USE_TRUNCF128_BUILTIN 0 - -#define USE_ROUND_BUILTIN 0 -#define USE_ROUNDF_BUILTIN 0 -#define USE_ROUNDL_BUILTIN 0 -#define USE_ROUNDF128_BUILTIN 0 - -#define USE_COPYSIGNL_BUILTIN 1 -#if __GNUC_PREREQ (7, 0) -# define USE_COPYSIGNF128_BUILTIN 1 -#else -# define USE_COPYSIGNF128_BUILTIN 0 -#endif - -#define USE_SQRT_BUILTIN 0 -#define USE_SQRTF_BUILTIN 0 - -#define USE_FMA_BUILTIN 1 -#define USE_FMAF_BUILTIN 1 -#define USE_FMAL_BUILTIN 0 - -/* This is not available for P8 or BE targets. */ -#ifdef __FP_FAST_FMAF128 -# define USE_FMAF128_BUILTIN 1 -#else -# define USE_FMAF128_BUILTIN 0 -#endif - -#endif diff --git a/sysdeps/s390/fpu/math-use-builtins-ceil.h b/sysdeps/s390/fpu/math-use-builtins-ceil.h new file mode 100644 index 0000000000..bec147a17f --- /dev/null +++ b/sysdeps/s390/fpu/math-use-builtins-ceil.h @@ -0,0 +1,15 @@ +#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT +# define USE_CEIL_BUILTIN 1 +# define USE_CEILF_BUILTIN 1 +# define USE_CEILL_BUILTIN 1 +# if __GNUC_PREREQ (8, 0) +# define USE_CEILF128_BUILTIN 1 +# else +# define USE_CEILF128_BUILTIN 0 +# endif +#else +# define USE_CEIL_BUILTIN 0 +# define USE_CEILF_BUILTIN 0 +# define USE_CEILL_BUILTIN 0 +# define USE_CEILF128_BUILTIN 0 +#endif diff --git a/sysdeps/s390/fpu/math-use-builtins-floor.h b/sysdeps/s390/fpu/math-use-builtins-floor.h new file mode 100644 index 0000000000..6c034e03bb --- /dev/null +++ b/sysdeps/s390/fpu/math-use-builtins-floor.h @@ -0,0 +1,15 @@ +#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT +# define USE_FLOOR_BUILTIN 1 +# define USE_FLOORF_BUILTIN 1 +# define USE_FLOORL_BUILTIN 1 +# if __GNUC_PREREQ (8, 0) +# define USE_FLOORF128_BUILTIN 1 +# else +# define USE_FLOORF128_BUILTIN 0 +# endif +#else +# define USE_FLOOR_BUILTIN 0 +# define USE_FLOORF_BUILTIN 0 +# define USE_FLOORL_BUILTIN 0 +# define USE_FLOORF128_BUILTIN 0 +#endif diff --git a/sysdeps/s390/fpu/math-use-builtins-nearbyint.h b/sysdeps/s390/fpu/math-use-builtins-nearbyint.h new file mode 100644 index 0000000000..2f3936e362 --- /dev/null +++ b/sysdeps/s390/fpu/math-use-builtins-nearbyint.h @@ -0,0 +1,15 @@ +#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT +# define USE_NEARBYINT_BUILTIN 1 +# define USE_NEARBYINTF_BUILTIN 1 +# define USE_NEARBYINTL_BUILTIN 1 +# if __GNUC_PREREQ (8, 0) +# define USE_NEARBYINTF128_BUILTIN 1 +# else +# define USE_NEARBYINTF128_BUILTIN 0 +# endif +#else +# define USE_NEARBYINT_BUILTIN 0 +# define USE_NEARBYINTF_BUILTIN 0 +# define USE_NEARBYINTL_BUILTIN 0 +# define USE_NEARBYINTF128_BUILTIN 0 +#endif diff --git a/sysdeps/s390/fpu/math-use-builtins-rint.h b/sysdeps/s390/fpu/math-use-builtins-rint.h new file mode 100644 index 0000000000..2ba16eeaec --- /dev/null +++ b/sysdeps/s390/fpu/math-use-builtins-rint.h @@ -0,0 +1,15 @@ +#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT +# define USE_RINT_BUILTIN 1 +# define USE_RINTF_BUILTIN 1 +# define USE_RINTL_BUILTIN 1 +# if __GNUC_PREREQ (8, 0) +# define USE_RINTF128_BUILTIN 1 +# else +# define USE_RINTF128_BUILTIN 0 +# endif +#else +# define USE_RINT_BUILTIN 0 +# define USE_RINTF_BUILTIN 0 +# define USE_RINTL_BUILTIN 0 +# define USE_RINTF128_BUILTIN 0 +#endif diff --git a/sysdeps/s390/fpu/math-use-builtins-round.h b/sysdeps/s390/fpu/math-use-builtins-round.h new file mode 100644 index 0000000000..d92daa9654 --- /dev/null +++ b/sysdeps/s390/fpu/math-use-builtins-round.h @@ -0,0 +1,15 @@ +#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT +# define USE_ROUND_BUILTIN 1 +# define USE_ROUNDF_BUILTIN 1 +# define USE_ROUNDL_BUILTIN 1 +# if __GNUC_PREREQ (8, 0) +# define USE_ROUNDF128_BUILTIN 1 +# else +# define USE_ROUNDF128_BUILTIN 0 +# endif +#else +# define USE_ROUND_BUILTIN 0 +# define USE_ROUNDF_BUILTIN 0 +# define USE_ROUNDL_BUILTIN 0 +# define USE_ROUNDF128_BUILTIN 0 +#endif diff --git a/sysdeps/s390/fpu/math-use-builtins-trunc.h b/sysdeps/s390/fpu/math-use-builtins-trunc.h new file mode 100644 index 0000000000..9b5b02de41 --- /dev/null +++ b/sysdeps/s390/fpu/math-use-builtins-trunc.h @@ -0,0 +1,15 @@ +#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT +# define USE_TRUNC_BUILTIN 1 +# define USE_TRUNCF_BUILTIN 1 +# define USE_TRUNCL_BUILTIN 1 +# if __GNUC_PREREQ (8, 0) +# define USE_TRUNCF128_BUILTIN 1 +# else +# define USE_TRUNCF128_BUILTIN 0 +# endif +#else +# define USE_TRUNC_BUILTIN 0 +# define USE_TRUNCF_BUILTIN 0 +# define USE_TRUNCL_BUILTIN 0 +# define USE_TRUNCF128_BUILTIN 0 +#endif diff --git a/sysdeps/s390/fpu/math-use-builtins.h b/sysdeps/s390/fpu/math-use-builtins.h deleted file mode 100644 index 3a80f86b2e..0000000000 --- a/sysdeps/s390/fpu/math-use-builtins.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Using math gcc builtins instead of generic implementation. s390/s390x version. - Copyright (C) 2019-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 - . */ - -#ifndef MATH_USE_BUILTINS_S390_H -#define MATH_USE_BUILTINS_S390_H 1 - -#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT - -# include /* For __GNUC_PREREQ. */ - -/* GCC emits the z196 zarch "load fp integer" instructions for these - builtins if build with at least --march=z196 -mzarch. Otherwise a - function call to libc is emitted. */ -# define USE_NEARBYINT_BUILTIN 1 -# define USE_NEARBYINTF_BUILTIN 1 -# define USE_NEARBYINTL_BUILTIN 1 - -# define USE_RINT_BUILTIN 1 -# define USE_RINTF_BUILTIN 1 -# define USE_RINTL_BUILTIN 1 - -# define USE_FLOOR_BUILTIN 1 -# define USE_FLOORF_BUILTIN 1 -# define USE_FLOORL_BUILTIN 1 - -# define USE_CEIL_BUILTIN 1 -# define USE_CEILF_BUILTIN 1 -# define USE_CEILL_BUILTIN 1 - -# define USE_TRUNC_BUILTIN 1 -# define USE_TRUNCF_BUILTIN 1 -# define USE_TRUNCL_BUILTIN 1 - -# define USE_ROUND_BUILTIN 1 -# define USE_ROUNDF_BUILTIN 1 -# define USE_ROUNDL_BUILTIN 1 - -# if __GNUC_PREREQ (8, 0) -# define USE_NEARBYINTF128_BUILTIN 1 -# define USE_RINTF128_BUILTIN 1 -# define USE_FLOORF128_BUILTIN 1 -# define USE_CEILF128_BUILTIN 1 -# define USE_TRUNCF128_BUILTIN 1 -# define USE_ROUNDF128_BUILTIN 1 -# else -# define USE_NEARBYINTF128_BUILTIN 0 -# define USE_RINTF128_BUILTIN 0 -# define USE_FLOORF128_BUILTIN 0 -# define USE_CEILF128_BUILTIN 0 -# define USE_TRUNCF128_BUILTIN 0 -# define USE_ROUNDF128_BUILTIN 0 -# endif - -#else - -/* Disable the builtins if we do not have the z196 zarch instructions. */ -# define USE_NEARBYINT_BUILTIN 0 -# define USE_NEARBYINTF_BUILTIN 0 -# define USE_NEARBYINTL_BUILTIN 0 -# define USE_NEARBYINTF128_BUILTIN 0 - -# define USE_RINT_BUILTIN 0 -# define USE_RINTF_BUILTIN 0 -# define USE_RINTL_BUILTIN 0 -# define USE_RINTF128_BUILTIN 0 - -# define USE_FLOOR_BUILTIN 0 -# define USE_FLOORF_BUILTIN 0 -# define USE_FLOORL_BUILTIN 0 -# define USE_FLOORF128_BUILTIN 0 - -# define USE_CEIL_BUILTIN 0 -# define USE_CEILF_BUILTIN 0 -# define USE_CEILL_BUILTIN 0 -# define USE_CEILF128_BUILTIN 0 - -# define USE_TRUNC_BUILTIN 0 -# define USE_TRUNCF_BUILTIN 0 -# define USE_TRUNCL_BUILTIN 0 -# define USE_TRUNCF128_BUILTIN 0 - -# define USE_ROUND_BUILTIN 0 -# define USE_ROUNDF_BUILTIN 0 -# define USE_ROUNDL_BUILTIN 0 -# define USE_ROUNDF128_BUILTIN 0 - -#endif /* ! HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT */ - -#define USE_COPYSIGNL_BUILTIN 1 -#if __GNUC_PREREQ (7, 0) -# define USE_COPYSIGNF128_BUILTIN 1 -#else -# define USE_COPYSIGNF128_BUILTIN 0 -#endif - -#define USE_SQRT_BUILTIN 0 -#define USE_SQRTF_BUILTIN 0 - -#define USE_FMA_BUILTIN 0 -#define USE_FMAF_BUILTIN 0 -#define USE_FMAL_BUILTIN 0 -#define USE_FMAF128_BUILTIN 0 - -#endif /* math-use-builtins.h */ From patchwork Tue Jun 9 21:32:50 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: 1306305 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=ljUEOV/t; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNdl2JCcz9sRR for ; Wed, 10 Jun 2020 07:33:15 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C9331388B004; Tue, 9 Jun 2020 21:33:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C9331388B004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738391; bh=FTrP+F30HK2YMCy9nEziAr85vKynzs1AA2Kq9LWiXLU=; 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=ljUEOV/tbNX/Hmm+1DXxn8XLF+3EHTB2wHGvrk4rg2/D5SjfYTc2fabRKM6jSvSUl UgzPxcDNYQs7BQG1UJJahmhMVjyRzVOhHAfV0hmAVm7YjMwLADK4jy4Qd+PtYDm3zM Tr2BYmrH/kAudkaOXCqdqjRt4PvL+CJb/UGUTQHs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by sourceware.org (Postfix) with ESMTPS id 3BBC6388A837 for ; Tue, 9 Jun 2020 21:33:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3BBC6388A837 Received: by mail-qk1-x736.google.com with SMTP id l17so88803qki.9 for ; Tue, 09 Jun 2020 14:33:09 -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=FTrP+F30HK2YMCy9nEziAr85vKynzs1AA2Kq9LWiXLU=; b=S62pZals6snu6PvGcKntVFTqFnjFYMDPmk5ij6JqwHpehlXO0kNCyyfKyKOs6QeLNi IEd/kZWj4ZxvKzA1etO8RyTT7vB0nBMvltGaTSq9Hbo5jbTAONcrDICogvqoUqDmnoC8 oo0zV5LZZgqQe9eHOluTb7Jm4h09b3Atm9ojhEy+LhUFzbWCVKToEmDNk3XlEuY0tTNC 0Qn1MhHs8oaovFYO7BJptp1KNUz/WBcVImBDkRbyqeWTMu0CIePNqjToyWaqhxUxKLlV MiRdDy2tNSIxg6cZvO6JIn4Pq4lDSvc+QkXDuTcduPSY1BPrRycv81VWHhemjxegjGhn XMxA== X-Gm-Message-State: AOAM531y6WPqEWQW/n2+qb1MRTJgvaidiKwYu+izi2vHUCyIhXcjJcnd FNYqE3mvFgF0PNMFs7BLXPkSO5V7eh8= X-Google-Smtp-Source: ABdhPJynzzU0ER/E3gH1VTNiaHg5vpgRiYdhf/tWmOn2xfZ3zpv6AJUyWQMkADXUbmedcgmteW7dUw== X-Received: by 2002:ae9:e84c:: with SMTP id a73mr27691151qkg.158.1591738388362; Tue, 09 Jun 2020 14:33:08 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:07 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 02/13] aarch64: Use math-use-builtins for ceil{f} Date: Tue, 9 Jun 2020 18:32:50 -0300 Message-Id: <20200609213301.3591135-2-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" The define is already set on the math-use-builtins-ceil.h, the patch just removes the implementations (it was missed on c9feb1be93). Checked on aarch64-linux-gnu. Reviewed-by: Szabolcs Nagy --- sysdeps/aarch64/fpu/s_ceil.c | 29 ----------------------------- sysdeps/aarch64/fpu/s_ceilf.c | 29 ----------------------------- 2 files changed, 58 deletions(-) delete mode 100644 sysdeps/aarch64/fpu/s_ceil.c delete mode 100644 sysdeps/aarch64/fpu/s_ceilf.c diff --git a/sysdeps/aarch64/fpu/s_ceil.c b/sysdeps/aarch64/fpu/s_ceil.c deleted file mode 100644 index f3cefdc824..0000000000 --- a/sysdeps/aarch64/fpu/s_ceil.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2011-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 - . */ - -#define NO_MATH_REDIRECT -#include -#include - -double -__ceil (double x) -{ - return __builtin_ceil (x); -} - -libm_alias_double (__ceil, ceil) diff --git a/sysdeps/aarch64/fpu/s_ceilf.c b/sysdeps/aarch64/fpu/s_ceilf.c deleted file mode 100644 index 1cde85fbaa..0000000000 --- a/sysdeps/aarch64/fpu/s_ceilf.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright (C) 2011-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 - . */ - -#define NO_MATH_REDIRECT -#include -#include - -float -__ceilf (float x) -{ - return __builtin_ceilf (x); -} - -libm_alias_float (__ceil, ceil) From patchwork Tue Jun 9 21:32:51 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: 1306307 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=mksB+G9w; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNdx4CMBz9sRR for ; Wed, 10 Jun 2020 07:33:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 508AB388B034; Tue, 9 Jun 2020 21:33:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 508AB388B034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738395; bh=YeEhOgOKBNq4oP0VHQtcp3yJAA8+y0UFWQneD9IVBZQ=; 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=mksB+G9wG1AeTgfpMZODtqMnA8Oq+Z/VhLkNNuj2wMS1GnCTaRnFMn2W6MxJsZpY5 W63dp3lEJ5wbKjSyw2jCUknNkkDJswsP4j/mBQO9OdC95sjRHJSZSzxZMVSFl08NyH JLVyWhQPlIWXgue88Jyq+WyuFWzjW/RD5gSrEuMo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by sourceware.org (Postfix) with ESMTPS id AEC00388B034 for ; Tue, 9 Jun 2020 21:33:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AEC00388B034 Received: by mail-qk1-x743.google.com with SMTP id c14so76182qka.11 for ; Tue, 09 Jun 2020 14:33:12 -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=YeEhOgOKBNq4oP0VHQtcp3yJAA8+y0UFWQneD9IVBZQ=; b=ZhJ5TpJfpR2i0iD59iwfz7W+awbDV+VFUQ9cbWhPNkXL1Gasmp0cDjuz2XPGXvFCcf mqmPDUzQAcJDBFIZ1y0T57wp5F7oaGNs8BPtLhv2g5lMgvkbm3fPaC+2DfywBVX2dzsZ 2GT5e1m3rxgbJvafeQdTE9800sLiat+UIJNivO8EUT0lsfdp67G/o/lu3qWZqxqHJq5Y iYJqfzcJkrRwzlFq+366h0siiF/s5OjQLtYxdjxPmNcVkIrqkBfhNFm26kNx6tUSKnTT nxZFpSA/UdcF2Gav6M1YjF7HXGKHw2bvHSOEEyE+4X983sBF7Um5Fhd6guD7sleS3Dif 1h9g== X-Gm-Message-State: AOAM5318gXeYbbMLzOyAqQvvb8FNkRBu4/v1Mkj2ChsHl6vYNDvR6jcN w9NmEQL82KyngzsIAD+p1ZMUMT2xOQo= X-Google-Smtp-Source: ABdhPJxU16gY2z5I67vS+yTrHVlg6TWILMPxOpxLRG2Cqf3p3u/xQelRmlXpUcuNmFOlwsoMM1H2Yw== X-Received: by 2002:a37:b401:: with SMTP id d1mr30746763qkf.206.1591738390624; Tue, 09 Jun 2020 14:33:10 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:09 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 03/13] s390x: Use fma{f} builtin Date: Tue, 9 Jun 2020 18:32:51 -0300 Message-Id: <20200609213301.3591135-3-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 s390x-linux-gnu. --- sysdeps/s390/fpu/math-use-builtins-fma.h | 4 +++ sysdeps/s390/fpu/s_fma.c | 32 ------------------------ sysdeps/s390/fpu/s_fmaf.c | 32 ------------------------ 3 files changed, 4 insertions(+), 64 deletions(-) create mode 100644 sysdeps/s390/fpu/math-use-builtins-fma.h delete mode 100644 sysdeps/s390/fpu/s_fma.c delete mode 100644 sysdeps/s390/fpu/s_fmaf.c diff --git a/sysdeps/s390/fpu/math-use-builtins-fma.h b/sysdeps/s390/fpu/math-use-builtins-fma.h new file mode 100644 index 0000000000..eede75aa41 --- /dev/null +++ b/sysdeps/s390/fpu/math-use-builtins-fma.h @@ -0,0 +1,4 @@ +#define USE_FMA_BUILTIN 1 +#define USE_FMAF_BUILTIN 1 +#define USE_FMAL_BUILTIN 0 +#define USE_FMAF128_BUILTIN 0 diff --git a/sysdeps/s390/fpu/s_fma.c b/sysdeps/s390/fpu/s_fma.c deleted file mode 100644 index ae924d05e8..0000000000 --- a/sysdeps/s390/fpu/s_fma.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Compute x * y + z as ternary operation. S/390 version. - Copyright (C) 2010-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2010. - - 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 - -double -__fma (double x, double y, double z) -{ - double r; - __asm__ ("madbr %0,%1,%2" : "=f" (r) : "%f" (x), "fR" (y), "0" (z)); - return r; -} -#ifndef __fma -libm_alias_double (__fma, fma) -#endif diff --git a/sysdeps/s390/fpu/s_fmaf.c b/sysdeps/s390/fpu/s_fmaf.c deleted file mode 100644 index 9e5bc533b8..0000000000 --- a/sysdeps/s390/fpu/s_fmaf.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Compute x * y + z as ternary operation. S/390 version. - Copyright (C) 2010-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 2010. - - 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 - -float -__fmaf (float x, float y, float z) -{ - float r; - __asm__ ("maebr %0,%1,%2" : "=f" (r) : "%f" (x), "fR" (y), "0" (z)); - return r; -} -#ifndef __fmaf -libm_alias_float (__fma, fma) -#endif From patchwork Tue Jun 9 21:32:52 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: 1306308 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=dcHdZkYF; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNf174Whz9sRR for ; Wed, 10 Jun 2020 07:33:29 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D0692388C007; Tue, 9 Jun 2020 21:33:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0692388C007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738395; bh=CveUWVVvm/M0GjUqqxCM+Z8S2kKm0ZGA13YZveoGSYQ=; 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=dcHdZkYFAw8x7G9vC5dbwDn2f3FWma90Y8n+Buakb1RtrTMFTrruRQ9BiIxi2NjfC EJL+ICLLPj/eEDZEDJy16pbeeSYc+KhX6DZknPNdqmgiRzY4ou0EOu4urGbf6H+H4h vUFj2G169BR9rQMR4caZmAd0UhHXEDYQKa61YPds= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by sourceware.org (Postfix) with ESMTPS id 1EE89388B03D for ; Tue, 9 Jun 2020 21:33:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1EE89388B03D Received: by mail-qt1-x843.google.com with SMTP id y1so132335qtv.12 for ; Tue, 09 Jun 2020 14:33:13 -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=CveUWVVvm/M0GjUqqxCM+Z8S2kKm0ZGA13YZveoGSYQ=; b=dYZfOp0WAsI7P0u1W0QK8nbPZrdNpIulM9QRqR47D0Kge2olaVYjElrCblEXhtgVOG /XZG+p+JLTapdkETwAr/yXgvEOWSxwF1EnPZAGkLBaZfNO112CAAOFW2sY5ZCWMMeZ07 6lwuL4qWDBIFM84ZGzXFpK1NJt+9ASz8uVL0XwvxUF9D96YLKOon7iUv38/uqehvbyXN 37Azs86Yd1wBsDnkADza161GaTwofV3O1XT4ggVkvfr2eo8QkPhYh8vaMxMjaHcS0g+P Pdf9FbSGMuZn3wE9Zj9nHglCx/2nj0Cx21UOmYJRCFDW/Fv04pEOECezhY1qGKuoe1xP xCoQ== X-Gm-Message-State: AOAM5314YzQJVcLkPLUROV0mf5+qtZ0IeyEACU64pwEOMmnobUS94/Dg fJh/8rsiKuPevabcseZJKU0sh5c9/DM= X-Google-Smtp-Source: ABdhPJyeXudamFuDtGxxpfCL4ALQvoF4uYZUjSRRMUCPMRDupjBpC9VMZFlYru+Mt/RQcQQ0hNSxkA== X-Received: by 2002:ac8:1c72:: with SMTP id j47mr18283574qtk.198.1591738391893; Tue, 09 Jun 2020 14:33:11 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:11 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 04/13] powerpc: Use sqrt{f} builtin Date: Tue, 9 Jun 2020 18:32:52 -0300 Message-Id: <20200609213301.3591135-4-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, 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" The powerpc sqrt implementation is also simplified: - the static constants are open coded within the implementation. - for !USE_SQRT_BUILTIN the function is implemented directly on __ieee754_sqrt (it avoid an superflous extra jump). Checked on powerpc-linux-gnu and powerpc64le-linux-gnu. Reviewed-by: Paul A. Clarke --- sysdeps/powerpc/fpu/e_sqrt.c | 57 ++++++-------------- sysdeps/powerpc/fpu/e_sqrtf.c | 56 ++++++------------- sysdeps/powerpc/fpu/math-use-builtins-sqrt.h | 9 ++++ 3 files changed, 42 insertions(+), 80 deletions(-) create mode 100644 sysdeps/powerpc/fpu/math-use-builtins-sqrt.h diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c index a47f77966f..505ae72339 100644 --- a/sysdeps/powerpc/fpu/e_sqrt.c +++ b/sysdeps/powerpc/fpu/e_sqrt.c @@ -18,22 +18,16 @@ #include #include -#include #include -#include -#include -#include -#include #include +#include -#ifndef _ARCH_PPCSQ -static const double almost_half = 0.5000000000000001; /* 0.5 + 2^-53 */ -static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; -static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; -static const float two108 = 3.245185536584267269e+32; -static const float twom54 = 5.551115123125782702e-17; -extern const float __t_sqrt[1024]; - +double +__ieee754_sqrt (double x) +{ +#if USE_SQRT_BUILTIN + return __builtin_sqrt (x); +#else /* The method is based on a description in Computation of elementary functions on the IBM RISC System/6000 processor, P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. @@ -48,10 +42,7 @@ extern const float __t_sqrt[1024]; generated guesses (which mostly runs on the integer unit, while the Newton-Raphson is running on the FPU). */ -double -__slow_ieee754_sqrt (double x) -{ - const float inf = a_inf.value; + extern const float __t_sqrt[1024]; if (x > 0) { @@ -60,7 +51,7 @@ __slow_ieee754_sqrt (double x) ieee_double_shape_type ew_u; ieee_double_shape_type iw_u; ew_u.value = (x); - if (x != inf) + if (x != INFINITY) { /* Variables named starting with 's' exist in the argument-reduced space, so that 2 > sx >= 0.5, @@ -112,7 +103,7 @@ __slow_ieee754_sqrt (double x) INSERT_WORDS (fsg, fsgi, 0); iw_u.parts.msw = fsgi; iw_u.parts.lsw = (0); - e = -__builtin_fma (sy, sg, -almost_half); + e = -__builtin_fma (sy, sg, -0x1.0000000000001p-1); sd = -__builtin_fma (sg, sg, -sx); if ((xi0 & 0x7ff00000) == 0) goto denorm; @@ -122,7 +113,7 @@ __slow_ieee754_sqrt (double x) sy2 = sy + sy; /* complete the INSERT_WORDS (fsg, fsgi, 0) operation. */ fsg = iw_u.value; - e = -__builtin_fma (sy, sg, -almost_half); + e = -__builtin_fma (sy, sg, -0x1.0000000000001p-1); sd = -__builtin_fma (sg, sg, -sx); sy = __builtin_fma (e, sy2, sy); shx = sx * fsg; @@ -131,7 +122,7 @@ __slow_ieee754_sqrt (double x) rounded incorrectly. */ sy2 = sy + sy; g = sg * fsg; - e = -__builtin_fma (sy, sg, -almost_half); + e = -__builtin_fma (sy, sg, -0x1.0000000000001p-1); d = -__builtin_fma (g, sg, -shx); sy = __builtin_fma (e, sy2, sy); fesetenv_register (fe); @@ -140,38 +131,24 @@ __slow_ieee754_sqrt (double x) /* For denormalised numbers, we normalise, calculate the square root, and return an adjusted result. */ fesetenv_register (fe); - return __slow_ieee754_sqrt (x * two108) * twom54; + return __ieee754_sqrt (x * 0x1p+108f) * 0x1p-54f; } } else if (x < 0) { /* For some reason, some PowerPC32 processors don't implement FE_INVALID_SQRT. */ -#ifdef FE_INVALID_SQRT +# ifdef FE_INVALID_SQRT __feraiseexcept (FE_INVALID_SQRT); fenv_union_t u = { .fenv = fegetenv_register () }; if ((u.l & FE_INVALID) == 0) -#endif +# endif __feraiseexcept (FE_INVALID); - x = a_nan.value; + x = NAN; } return f_wash (x); +#endif /* USE_SQRT_BUILTIN */ } -#endif /* _ARCH_PPCSQ */ -#undef __ieee754_sqrt -double -__ieee754_sqrt (double x) -{ - double z; - -#ifdef _ARCH_PPCSQ - asm ("fsqrt %0,%1\n" :"=f" (z):"f" (x)); -#else - z = __slow_ieee754_sqrt (x); -#endif - - return z; -} libm_alias_finite (__ieee754_sqrt, __sqrt) diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c index f119dcf5d9..ae76bb1e10 100644 --- a/sysdeps/powerpc/fpu/e_sqrtf.c +++ b/sysdeps/powerpc/fpu/e_sqrtf.c @@ -18,22 +18,16 @@ #include #include -#include #include -#include -#include -#include -#include #include +#include -#ifndef _ARCH_PPCSQ -static const float almost_half = 0.50000006; /* 0.5 + 2^-24 */ -static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; -static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; -static const float two48 = 281474976710656.0; -static const float twom24 = 5.9604644775390625e-8; -extern const float __t_sqrt[1024]; - +float +__ieee754_sqrtf (float x) +{ +#if USE_SQRTF_BUILTIN + return __builtin_sqrtf (x); +#else /* The method is based on a description in Computation of elementary functions on the IBM RISC System/6000 processor, P. W. Markstein, IBM J. Res. Develop, 34(1) 1990. @@ -48,14 +42,11 @@ extern const float __t_sqrt[1024]; generated guesses (which mostly runs on the integer unit, while the Newton-Raphson is running on the FPU). */ -float -__slow_ieee754_sqrtf (float x) -{ - const float inf = a_inf.value; + extern const float __t_sqrt[1024]; if (x > 0) { - if (x != inf) + if (x != INFINITY) { /* Variables named starting with 's' exist in the argument-reduced space, so that 2 > sx >= 0.5, @@ -94,7 +85,7 @@ __slow_ieee754_sqrtf (float x) sy2 = sy + sy; sg = __builtin_fmaf (sy, sd, sg); /* 16-bit approximation to sqrt(sx). */ - e = -__builtin_fmaf (sy, sg, -almost_half); + e = -__builtin_fmaf (sy, sg, -0x1.0000020365653p-1); SET_FLOAT_WORD (fsg, fsgi); sd = -__builtin_fmaf (sg, sg, -sx); sy = __builtin_fmaf (e, sy2, sy); @@ -106,7 +97,7 @@ __slow_ieee754_sqrtf (float x) rounded incorrectly. */ sy2 = sy + sy; g = sg * fsg; - e = -__builtin_fmaf (sy, sg, -almost_half); + e = -__builtin_fmaf (sy, sg, -0x1.0000020365653p-1); d = -__builtin_fmaf (g, sg, -shx); sy = __builtin_fmaf (e, sy2, sy); fesetenv_register (fe); @@ -115,38 +106,23 @@ __slow_ieee754_sqrtf (float x) /* For denormalised numbers, we normalise, calculate the square root, and return an adjusted result. */ fesetenv_register (fe); - return __slow_ieee754_sqrtf (x * two48) * twom24; + return __ieee754_sqrtf (x * 0x1p+48) * 0x1p-24; } } else if (x < 0) { /* For some reason, some PowerPC32 processors don't implement FE_INVALID_SQRT. */ -#ifdef FE_INVALID_SQRT +# ifdef FE_INVALID_SQRT feraiseexcept (FE_INVALID_SQRT); fenv_union_t u = { .fenv = fegetenv_register () }; if ((u.l & FE_INVALID) == 0) -#endif +# endif feraiseexcept (FE_INVALID); - x = a_nan.value; + x = NAN; } return f_washf (x); -} -#endif /* _ARCH_PPCSQ */ - -#undef __ieee754_sqrtf -float -__ieee754_sqrtf (float x) -{ - float z; - -#ifdef _ARCH_PPCSQ - asm ("fsqrts %0,%1\n" :"=f" (z):"f" (x)); -#else - z = __slow_ieee754_sqrtf (x); -#endif - - return z; +#endif /* USE_SQRTF_BUILTIN */ } libm_alias_finite (__ieee754_sqrtf, __sqrtf) diff --git a/sysdeps/powerpc/fpu/math-use-builtins-sqrt.h b/sysdeps/powerpc/fpu/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..653309a7e7 --- /dev/null +++ b/sysdeps/powerpc/fpu/math-use-builtins-sqrt.h @@ -0,0 +1,9 @@ +#ifdef _ARCH_PPCSQ +# define USE_SQRT_BUILTIN 1 +# define USE_SQRTF_BUILTIN 1 +#else +# define USE_SQRT_BUILTIN 0 +# define USE_SQRTF_BUILTIN 0 +#endif +#define USE_SQRTL_BUILTIN 0 +#define USE_SQRTF128_BUILTIN 0 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: 1306309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=MOmq1rik; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNf62smYz9sRR for ; Wed, 10 Jun 2020 07:33:34 +1000 (AEST) 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 From patchwork Tue Jun 9 21:32:54 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: 1306310 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=C4VD5iV3; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNfB438lz9sRR for ; Wed, 10 Jun 2020 07:33:38 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D7FF5388C00D; Tue, 9 Jun 2020 21:33:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7FF5388C00D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738398; bh=NjWAOvPMXH8/Wl6HfCNGDV6/YuZiktOOpbAHCBFC1BY=; 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=C4VD5iV3WJDCWUSdaRrjneIUzytfDyCg6ggKz4sH6D6Gv4sICO/ScCMqogiGLPE1m CqKVciJEFcAPRRZANhMlFgWUWKYiJk/qIBCEYFqIK9ybJ+t7pfscF4pkjXvWsr/TlY PZ0aO0UVSjxquqy7hf/yzguaYYszr8UNSRb/82lo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by sourceware.org (Postfix) with ESMTPS id 9214C388C003 for ; Tue, 9 Jun 2020 21:33:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9214C388C003 Received: by mail-qt1-x829.google.com with SMTP id w90so152645qtd.8 for ; Tue, 09 Jun 2020 14:33:15 -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=NjWAOvPMXH8/Wl6HfCNGDV6/YuZiktOOpbAHCBFC1BY=; b=Gx12S0l+IHBa9Sg7PoTYXKe5I3RyeClgVOoWh3wX9JtlKFHFs9fUzT1Gm0big55HF3 NBRj/4iDbq98lZnhtGND02GQw3Va+xiu6gJdrRYkm6oF8iGwq9nLFuXbVwL6Ez27l0/n 4LA95PYicbHbc48JxaaWgWBWymwITMYHmhNNQsBh8nJK1/2Mq/bXD+8fNnLWbR17zuJh GG8J2ndIsN6xtEN7GhDBdOvjlJGYtm43ADwc5C+kaFGRxBLV68cGJq05MJap+d2wV++4 QtcSo/2zuq+Y8B7CQP4YrFTYekxF3qJDyaA78NJB7a5ijMqL5WPCO4DoGZVmeORpAOSP 7EHw== X-Gm-Message-State: AOAM531MJhdFuiwilHZ7Wxoye7gtWq3doHz8FYtKylZSfggF/w/nZAsf V1xw78ph61KLBXQ5zLPRnvwqrfg+DXQ= X-Google-Smtp-Source: ABdhPJzxf8ZWSHnP7In7C6FGvBNM+EfWymWPcg5zE6Bee+/Gl3Vtsal7sHNc9qbDfVDLyQk6hoy++A== X-Received: by 2002:aed:2369:: with SMTP id i38mr4952280qtc.238.1591738394850; Tue, 09 Jun 2020 14:33:14 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:14 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 06/13] i386: Use builtin sqrtl Date: Tue, 9 Jun 2020 18:32:54 -0300 Message-Id: <20200609213301.3591135-6-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, 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 i686-linux-gnu. --- sysdeps/i386/fpu/e_sqrtl.c | 21 --------------------- sysdeps/{x86_64 => x86}/fpu/e_sqrtl.c | 0 2 files changed, 21 deletions(-) delete mode 100644 sysdeps/i386/fpu/e_sqrtl.c rename sysdeps/{x86_64 => x86}/fpu/e_sqrtl.c (100%) diff --git a/sysdeps/i386/fpu/e_sqrtl.c b/sysdeps/i386/fpu/e_sqrtl.c deleted file mode 100644 index 8f284dd75c..0000000000 --- a/sysdeps/i386/fpu/e_sqrtl.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * - * Adapted for `long double' by Ulrich Drepper . - */ - -#include -#include - -#undef __ieee754_sqrtl -long double -__ieee754_sqrtl (long double x) -{ - long double res; - - asm ("fsqrt" : "=t" (res) : "0" (x)); - - return res; -} -libm_alias_finite (__ieee754_sqrtl, __sqrtl) diff --git a/sysdeps/x86_64/fpu/e_sqrtl.c b/sysdeps/x86/fpu/e_sqrtl.c similarity index 100% rename from sysdeps/x86_64/fpu/e_sqrtl.c rename to sysdeps/x86/fpu/e_sqrtl.c From patchwork Tue Jun 9 21:32:55 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: 1306311 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=uJf0A0IP; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNfG3S5Bz9sRh for ; Wed, 10 Jun 2020 07:33:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 694C3388C012; Tue, 9 Jun 2020 21:33:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 694C3388C012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738400; bh=V+6Vb3TiEeRfOPHyyq+Rv+zc8MDQ+NMWx0VlKWEx9Hk=; 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=uJf0A0IPPWAnyNuU5rl1ybOinqGRaHr1VDWeYX39GkQFA5ghpvJNZGGHAgrtEbkPY TZEhCdJGIOquyfJIlXMCjNbo1IK/Ff6JzjtBjkPuVQgjdhDqCrbpgMfUpvifCHFnDN f1SScrxZJyuvzTuq2U32kinx+ydB5Ivtp5t5IhdE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by sourceware.org (Postfix) with ESMTPS id 38BE6388A82A for ; Tue, 9 Jun 2020 21:33:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 38BE6388A82A Received: by mail-qt1-x841.google.com with SMTP id g18so128975qtu.13 for ; Tue, 09 Jun 2020 14:33:17 -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=V+6Vb3TiEeRfOPHyyq+Rv+zc8MDQ+NMWx0VlKWEx9Hk=; b=dmnoPcCO3QAgKEIW9fgesQ1OAT2iO+ZMCtdCAE+4FV/fcz8pXczHb6IwytB7N1kdX0 E4qwrvgNK4k5q3lotiQ4uukohgTIcbOw50p6tRDJnyZ3m9+dZEcHTF8u0SC4hEODDJRw vOhLCFW6+B1iE04izUEoE91YeIOs5dOjW/zI/LTA52LpGjwQBDh2up8NUh1iv4d8lEJQ e5orZO8Pqoneowdj/dQoX4B7tNVpByaljQ3ETGS65LvaFaFPxfq0L6vO9o1FR9OY79OJ LZVAJe1xBKfOfuXu9rdnwoJFcPRNU+aaCF6nSX7og/aUGtyIVIqXekTRSdwwgpu+UBok AgCg== X-Gm-Message-State: AOAM531YvhC64+bZ9AKsNCeIrWLjazMOoO7yZP199k3uRck/y2Zta9BD YwSbLWuMq8j09pxOi1547eYkTtEWxBY= X-Google-Smtp-Source: ABdhPJyKhtPTyUcWJp+dvSWhx6VqhOSwZFvImyqBZ/kO0MjUpWjr5HIauLbLiJ8LFW4EhzHMJZ8bYw== X-Received: by 2002:aed:21a4:: with SMTP id l33mr27931816qtc.72.1591738396183; Tue, 09 Jun 2020 14:33:16 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:15 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 07/13] alpha: Use builtin sqrt{f} Date: Tue, 9 Jun 2020 18:32:55 -0300 Message-Id: <20200609213301.3591135-7-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" The generic implementation is simplified by removing the 'optimization' for !_IEEE_FP_INEXACT (which does not handle inexact neither some values). Checked on alpha-linux-gnu. --- sysdeps/alpha/alphaev6/fpu/e_sqrt.S | 53 ------- sysdeps/alpha/alphaev6/fpu/e_sqrtf.S | 53 ------- sysdeps/alpha/fpu/e_sqrt.c | 164 +-------------------- sysdeps/alpha/fpu/e_sqrtf.c | 9 +- sysdeps/alpha/fpu/math-use-builtins-sqrt.h | 9 ++ 5 files changed, 13 insertions(+), 275 deletions(-) delete mode 100644 sysdeps/alpha/alphaev6/fpu/e_sqrt.S delete mode 100644 sysdeps/alpha/alphaev6/fpu/e_sqrtf.S create mode 100644 sysdeps/alpha/fpu/math-use-builtins-sqrt.h diff --git a/sysdeps/alpha/alphaev6/fpu/e_sqrt.S b/sysdeps/alpha/alphaev6/fpu/e_sqrt.S deleted file mode 100644 index 33596e2ed3..0000000000 --- a/sysdeps/alpha/alphaev6/fpu/e_sqrt.S +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 2000-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 - - .arch ev6 - .set noreorder - .set noat - -ENTRY(__ieee754_sqrt) -#ifdef PROF - ldgp gp, 0(pv) - lda AT, _mcount - jsr AT, (AT), _mcount - .prologue 1 -#else - .prologue 0 -#endif - - .align 4 -#ifdef _IEEE_FP_INEXACT - sqrtt/suid $f16, $f0 -#else - sqrtt/sud $f16, $f0 -#endif - ret - nop - nop - -END(__ieee754_sqrt) - -#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) -strong_alias(__ieee754_sqrt, __sqrt_dummy) -compat_symbol(libm, __sqrt_dummy, __sqrt_finite, GLIBC_2_15) -#endif -#if SHLIB_COMPAT (libm, GLIBC_2_18, GLIBC_2_31) -compat_symbol(libm, __ieee754_sqrt, __sqrt_finite, GLIBC_2_18) -#endif diff --git a/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S b/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S deleted file mode 100644 index 36e04cce38..0000000000 --- a/sysdeps/alpha/alphaev6/fpu/e_sqrtf.S +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (C) 2000-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 - - .arch ev6 - .set noreorder - .set noat - -ENTRY(__ieee754_sqrtf) -#ifdef PROF - ldgp gp, 0(pv) - lda AT, _mcount - jsr AT, (AT), _mcount - .prologue 1 -#else - .prologue 0 -#endif - - .align 4 -#ifdef _IEEE_FP_INEXACT - sqrts/suid $f16, $f0 -#else - sqrts/sud $f16, $f0 -#endif - ret - nop - nop - -END(__ieee754_sqrtf) - -#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) -strong_alias(__ieee754_sqrtf, __sqrtf_dummy) -compat_symbol(libm, __sqrtf_dummy, __sqrtf_finite, GLIBC_2_15) -#endif -#if SHLIB_COMPAT (libm, GLIBC_2_18, GLIBC_2_31) -compat_symbol(libm, __ieee754_sqrtf, __sqrtf_finite, GLIBC_2_18) -#endif diff --git a/sysdeps/alpha/fpu/e_sqrt.c b/sysdeps/alpha/fpu/e_sqrt.c index 4cf2ad693a..c75ed07bd6 100644 --- a/sysdeps/alpha/fpu/e_sqrt.c +++ b/sysdeps/alpha/fpu/e_sqrt.c @@ -16,171 +16,11 @@ License along with the GNU C Library. If not, see . */ -#include -#include #include -#if !defined(_IEEE_FP_INEXACT) - -/* - * This version is much faster than generic sqrt implementation, but - * it doesn't handle the inexact flag. It doesn't handle exceptional - * values either, but will defer to the full ieee754_sqrt routine which - * can. - */ - -/* Careful with rearranging this without consulting the assembly below. */ -const static struct sqrt_data_struct { - unsigned long dn, up, half, almost_three_half; - unsigned long one_and_a_half, two_to_minus_30, one, nan; - const int T2[64]; -} sqrt_data __attribute__((used)) = { - 0x3fefffffffffffff, /* __dn = nextafter(1,-Inf) */ - 0x3ff0000000000001, /* __up = nextafter(1,+Inf) */ - 0x3fe0000000000000, /* half */ - 0x3ff7ffffffc00000, /* almost_three_half = 1.5-2^-30 */ - 0x3ff8000000000000, /* one_and_a_half */ - 0x3e10000000000000, /* two_to_minus_30 */ - 0x3ff0000000000000, /* one */ - 0xffffffffffffffff, /* nan */ - - { 0x1500, 0x2ef8, 0x4d67, 0x6b02, 0x87be, 0xa395, 0xbe7a, 0xd866, - 0xf14a, 0x1091b,0x11fcd,0x13552,0x14999,0x15c98,0x16e34,0x17e5f, - 0x18d03,0x19a01,0x1a545,0x1ae8a,0x1b5c4,0x1bb01,0x1bfde,0x1c28d, - 0x1c2de,0x1c0db,0x1ba73,0x1b11c,0x1a4b5,0x1953d,0x18266,0x16be0, - 0x1683e,0x179d8,0x18a4d,0x19992,0x1a789,0x1b445,0x1bf61,0x1c989, - 0x1d16d,0x1d77b,0x1dddf,0x1e2ad,0x1e5bf,0x1e6e8,0x1e654,0x1e3cd, - 0x1df2a,0x1d635,0x1cb16,0x1be2c,0x1ae4e,0x19bde,0x1868e,0x16e2e, - 0x1527f,0x1334a,0x11051,0xe951, 0xbe01, 0x8e0d, 0x5924, 0x1edd } -}; - -asm ("\ - /* Define offsets into the structure defined in C above. */ \n\ - $DN = 0*8 \n\ - $UP = 1*8 \n\ - $HALF = 2*8 \n\ - $ALMOST_THREE_HALF = 3*8 \n\ - $NAN = 7*8 \n\ - $T2 = 8*8 \n\ - \n\ - /* Stack variables. */ \n\ - $K = 0 \n\ - $Y = 8 \n\ - \n\ - .text \n\ - .align 5 \n\ - .globl __ieee754_sqrt \n\ - .ent __ieee754_sqrt \n\ -__ieee754_sqrt: \n\ - ldgp $29, 0($27) \n\ - subq $sp, 16, $sp \n\ - .frame $sp, 16, $26, 0\n" -#ifdef PROF -" lda $28, _mcount \n\ - jsr $28, ($28), _mcount\n" -#endif -" .prologue 1 \n\ - \n\ - .align 4 \n\ - stt $f16, $K($sp) # e0 : \n\ - mult $f31, $f31, $f31 # .. fm : \n\ - lda $4, sqrt_data # e0 : \n\ - fblt $f16, $fixup # .. fa : \n\ - \n\ - ldah $2, 0x5fe8 # e0 : \n\ - ldq $3, $K($sp) # .. e1 : \n\ - ldt $f12, $HALF($4) # e0 : \n\ - ldt $f18, $ALMOST_THREE_HALF($4) # .. e1 : \n\ - \n\ - sll $3, 52, $5 # e0 : \n\ - lda $6, 0x7fd # .. e1 : \n\ - fnop # .. fa : \n\ - fnop # .. fm : \n\ - \n\ - subq $5, 1, $5 # e1 : \n\ - srl $3, 33, $1 # .. e0 : \n\ - cmpule $5, $6, $5 # e0 : \n\ - beq $5, $fixup # .. e1 : \n\ - \n\ - mult $f16, $f12, $f11 # fm : $f11 = x * 0.5 \n\ - subl $2, $1, $2 # .. e0 : \n\ - addt $f12, $f12, $f17 # .. fa : $f17 = 1.0 \n\ - srl $2, 12, $1 # e0 : \n\ - \n\ - and $1, 0xfc, $1 # e0 : \n\ - addq $1, $4, $1 # e1 : \n\ - ldl $1, $T2($1) # e0 : \n\ - addt $f12, $f17, $f15 # .. fa : $f15 = 1.5 \n\ - \n\ - subl $2, $1, $2 # e0 : \n\ - ldt $f14, $DN($4) # .. e1 : \n\ - sll $2, 32, $2 # e0 : \n\ - stq $2, $Y($sp) # e0 : \n\ - \n\ - ldt $f13, $Y($sp) # e0 : \n\ - mult/su $f11, $f13, $f10 # fm 2: $f10 = (x * 0.5) * y \n\ - mult $f10, $f13, $f10 # fm 4: $f10 = ((x*0.5)*y)*y \n\ - subt $f15, $f10, $f1 # fa 4: $f1 = (1.5-0.5*x*y*y) \n\ - \n\ - mult $f13, $f1, $f13 # fm 4: yp = y*(1.5-0.5*x*y^2)\n\ - mult/su $f11, $f13, $f1 # fm 4: $f11 = x * 0.5 * yp \n\ - mult $f1, $f13, $f11 # fm 4: $f11 = (x*0.5*yp)*yp \n\ - subt $f18, $f11, $f1 # fa 4: $f1=(1.5-2^-30)-x/2*yp^2\n\ - \n\ - mult $f13, $f1, $f13 # fm 4: ypp = $f13 = yp*$f1 \n\ - subt $f15, $f12, $f1 # .. fa : $f1 = (1.5 - 0.5) \n\ - ldt $f15, $UP($4) # .. e0 : \n\ - mult/su $f16, $f13, $f10 # fm 4: z = $f10 = x * ypp \n\ - \n\ - mult $f10, $f13, $f11 # fm 4: $f11 = z*ypp \n\ - mult $f10, $f12, $f12 # fm : $f12 = z*0.5 \n\ - subt $f1, $f11, $f1 # fa 4: $f1 = 1 - z*ypp \n\ - mult $f12, $f1, $f12 # fm 4: $f12 = z/2*(1 - z*ypp)\n\ - \n\ - addt $f10, $f12, $f0 # fa 4: zp=res= z+z/2*(1-z*ypp)\n\ - mult/c $f0, $f14, $f12 # fm 4: zmi = zp * DN \n\ - mult/c $f0, $f15, $f11 # fm : zpl = zp * UP \n\ - mult/c $f0, $f12, $f1 # fm : $f1 = zp * zmi \n\ - \n\ - mult/c $f0, $f11, $f15 # fm : $f15 = zp * zpl \n\ - subt/su $f1, $f16, $f13 # .. fa : y1 = zp*zmi - x \n\ - subt/su $f15, $f16, $f14 # fa 4: y2 = zp*zpl - x \n\ - fcmovge $f13, $f12, $f0 # fa 3: res = (y1>=0)?zmi:res \n\ - \n\ - fcmovlt $f14, $f11, $f0 # fa 4: res = (y2<0)?zpl:res \n\ - addq $sp, 16, $sp # .. e0 : \n\ - ret # .. e1 : \n\ - \n\ - .align 4 \n\ -$fixup: \n\ - addq $sp, 16, $sp \n\ - br __full_ieee754_sqrt !samegp \n\ - \n\ - .end __ieee754_sqrt"); - -#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) -asm (".global __sqrt_dummy; __sqrt_dummy = __ieee754_sqrt"); -#else -asm (".global __sqrt_finite; __sqrt_finite = __ieee754_sqrt"); -#endif - -static double __full_ieee754_sqrt(double) __attribute_used__; -#define __ieee754_sqrt __full_ieee754_sqrt - -#elif SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) - -strong_alias (__ieee754_sqrt, __sqrt_dummy) -#define __ieee754_sqrt __ieee754_sqrt - -#endif /* _IEEE_FP_INEXACT */ - #include -#undef __ieee754_sqrt -/* Work around forgotten symbol in alphaev6 build. */ -#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) -compat_symbol (libm, __sqrt_dummy, __sqrt_finite, GLIBC_2_15); -#endif #if SHLIB_COMPAT (libm, GLIBC_2_18, GLIBC_2_31) -compat_symbol (libm, __ieee754_sqrt, __sqrt_finite, GLIBC_2_18); +strong_alias (__ieee754_sqrt, __sqrt_finite_2_18) +compat_symbol (libm, __sqrt_finite_2_18, __sqrt_finite, GLIBC_2_18); #endif diff --git a/sysdeps/alpha/fpu/e_sqrtf.c b/sysdeps/alpha/fpu/e_sqrtf.c index eb3f968576..38c41db537 100644 --- a/sysdeps/alpha/fpu/e_sqrtf.c +++ b/sysdeps/alpha/fpu/e_sqrtf.c @@ -1,13 +1,8 @@ #include -#define __ieee754_sqrtf __ieee754_sqrtf #include -/* Work around forgotten symbol in alphaev6 build. */ -#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_18) -strong_alias(__ieee754_sqrtf, __sqrtf_dummy) -compat_symbol (libm, __sqrtf_dummy, __sqrtf_finite, GLIBC_2_15); -#endif #if SHLIB_COMPAT (libm, GLIBC_2_18, GLIBC_2_31) -compat_symbol (libm, __ieee754_sqrtf, __sqrtf_finite, GLIBC_2_18); +strong_alias (__ieee754_sqrtf, __sqrtf_finite_2_18) +compat_symbol (libm, __sqrtf_finite_2_18, __sqrtf_finite, GLIBC_2_18); #endif diff --git a/sysdeps/alpha/fpu/math-use-builtins-sqrt.h b/sysdeps/alpha/fpu/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..550b097ed6 --- /dev/null +++ b/sysdeps/alpha/fpu/math-use-builtins-sqrt.h @@ -0,0 +1,9 @@ +#ifdef __alpha_ev6__ +# define USE_SQRT_BUILTIN 1 +# define USE_SQRTF_BUILTIN 1 +#else +# define USE_SQRT_BUILTIN 0 +# define USE_SQRTF_BUILTIN 0 +#endif +#define USE_SQRTL_BUILTIN 0 +#define USE_SQRTF128_BUILTIN 0 From patchwork Tue Jun 9 21:32:56 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: 1306312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=K0Xq2gUe; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNfM0pscz9sRR for ; Wed, 10 Jun 2020 07:33:47 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6AF1A388C01D; Tue, 9 Jun 2020 21:33:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AF1A388C01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738402; bh=3okG2pg8HSbYUmU4L9ZKPIIIomxkLbu60JcGUFeoP1s=; 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=K0Xq2gUe1VjeHwyz1lIqMmA0KZCYaaIcaz5oIFQtyX+O3CWE0wBqn1xXQWxkev6oF G5dKFlbhy3KhCJUzJElm9KGacA/Wbu0GNXExpwiYTeeiJEOlK7gnVfhYmERkM0zQk+ EVx9Os9Xc1wTn8IYdYP/VJSKZLRicwEey0e81gCc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by sourceware.org (Postfix) with ESMTPS id 6E719388C010 for ; Tue, 9 Jun 2020 21:33:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6E719388C010 Received: by mail-qt1-x844.google.com with SMTP id e16so192968qtg.0 for ; Tue, 09 Jun 2020 14:33:19 -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=3okG2pg8HSbYUmU4L9ZKPIIIomxkLbu60JcGUFeoP1s=; b=lKOYR7/bhlHb6fFs8YSebGjylgZ+iar2sCwgEX3GP46kD/5K84dzmslrK2xDHujEds qOa2Ubj6H9njOh+cJG5MEO9Qx+780MyKDva/WyEpIRSQy85038V/qSVI8TzpON6a9ToZ Wn8Da7OSz7XiasNckKDB3G9kc+RnEQS38VDNJ+r02z7xHMOVOnnLdSMkQOhNNuTxbJ0U 7hqYxvAm9iQtx0T4DpopqqfHUvtA8mMeG/dHLmK3x/eJa6QTeGbRn/+nmdqj4BO8lP2n zWiaWFeolKt+nc97VuArqSdB8ceWMxfIK3j2lh7O9XdGjlo8Qai3r5WgDANiP7NhqFLr cEMQ== X-Gm-Message-State: AOAM531OPJCCrDN1E64m/JGUr/wcnOL+OueCdhZLiM9mBdNK3znaCFh4 FRoC31J7uy8yE+wFArFnBPsO7kTBVDY= X-Google-Smtp-Source: ABdhPJyEScOINcUk+ML25qKHLVsJQZ1yfgKj4x3dQAbgFZ3jlVKpkvX4PxGVauU4zSEB+2KUqh4JvQ== X-Received: by 2002:ac8:78d:: with SMTP id l13mr30614951qth.37.1591738397555; Tue, 09 Jun 2020 14:33:17 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:17 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 08/13] mips: Use sqrt{f} builtin Date: Tue, 9 Jun 2020 18:32:56 -0300 Message-Id: <20200609213301.3591135-8-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 with a build against mips-linux-gnu and mips64-linux-gnu and comparing the resulting binaries. --- sysdeps/mips/fpu/e_sqrt.c | 38 ----------------------- sysdeps/mips/fpu/e_sqrtf.c | 38 ----------------------- sysdeps/mips/fpu/math-use-builtins-sqrt.h | 6 ++++ sysdeps/mips/mips32/fpu/e_sqrt.c | 1 - sysdeps/mips/mips32/fpu/e_sqrtf.c | 1 - sysdeps/mips/mips64/n32/fpu/e_sqrt.c | 1 - sysdeps/mips/mips64/n32/fpu/e_sqrtf.c | 1 - sysdeps/mips/mips64/n64/fpu/e_sqrt.c | 1 - sysdeps/mips/mips64/n64/fpu/e_sqrtf.c | 1 - 9 files changed, 6 insertions(+), 82 deletions(-) delete mode 100644 sysdeps/mips/fpu/e_sqrt.c delete mode 100644 sysdeps/mips/fpu/e_sqrtf.c create mode 100644 sysdeps/mips/fpu/math-use-builtins-sqrt.h delete mode 100644 sysdeps/mips/mips32/fpu/e_sqrt.c delete mode 100644 sysdeps/mips/mips32/fpu/e_sqrtf.c delete mode 100644 sysdeps/mips/mips64/n32/fpu/e_sqrt.c delete mode 100644 sysdeps/mips/mips64/n32/fpu/e_sqrtf.c delete mode 100644 sysdeps/mips/mips64/n64/fpu/e_sqrt.c delete mode 100644 sysdeps/mips/mips64/n64/fpu/e_sqrtf.c diff --git a/sysdeps/mips/fpu/e_sqrt.c b/sysdeps/mips/fpu/e_sqrt.c deleted file mode 100644 index 47488e993c..0000000000 --- a/sysdeps/mips/fpu/e_sqrt.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Hartvig Ekner , 2002. - - 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 - -#if (_MIPS_ISA >= _MIPS_ISA_MIPS2) - -double __attribute__ ((nomips16)) -__ieee754_sqrt (double x) -{ - double z; - __asm__ ("sqrt.d %0,%1" : "=f" (z) : "f" (x)); - return z; -} -libm_alias_finite (__ieee754_sqrt, __sqrt) - -#else - -#include - -#endif diff --git a/sysdeps/mips/fpu/e_sqrtf.c b/sysdeps/mips/fpu/e_sqrtf.c deleted file mode 100644 index dc33788bf3..0000000000 --- a/sysdeps/mips/fpu/e_sqrtf.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2002-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Hartvig Ekner , 2002. - - 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 - -#if (_MIPS_ISA >= _MIPS_ISA_MIPS2) - -float __attribute__ ((nomips16)) -__ieee754_sqrtf (float x) -{ - float z; - __asm__ ("sqrt.s %0,%1" : "=f" (z) : "f" (x)); - return z; -} -libm_alias_finite (__ieee754_sqrtf, __sqrtf) - -#else - -#include - -#endif diff --git a/sysdeps/mips/fpu/math-use-builtins-sqrt.h b/sysdeps/mips/fpu/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..37f49ebc9f --- /dev/null +++ b/sysdeps/mips/fpu/math-use-builtins-sqrt.h @@ -0,0 +1,6 @@ +#include + +#define USE_SQRT_BUILTIN (_MIPS_ISA >= _MIPS_ISA_MIPS2) +#define USE_SQRTF_BUILTIN (_MIPS_ISA >= _MIPS_ISA_MIPS2) +#define USE_SQRTL_BUILTIN 0 +#define USE_SQRTF128_BUILTIN 0 diff --git a/sysdeps/mips/mips32/fpu/e_sqrt.c b/sysdeps/mips/mips32/fpu/e_sqrt.c deleted file mode 100644 index 81f4e77697..0000000000 --- a/sysdeps/mips/mips32/fpu/e_sqrt.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/mips/mips32/fpu/e_sqrtf.c b/sysdeps/mips/mips32/fpu/e_sqrtf.c deleted file mode 100644 index fb0700d45c..0000000000 --- a/sysdeps/mips/mips32/fpu/e_sqrtf.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/mips/mips64/n32/fpu/e_sqrt.c b/sysdeps/mips/mips64/n32/fpu/e_sqrt.c deleted file mode 100644 index 81f4e77697..0000000000 --- a/sysdeps/mips/mips64/n32/fpu/e_sqrt.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/mips/mips64/n32/fpu/e_sqrtf.c b/sysdeps/mips/mips64/n32/fpu/e_sqrtf.c deleted file mode 100644 index fb0700d45c..0000000000 --- a/sysdeps/mips/mips64/n32/fpu/e_sqrtf.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/mips/mips64/n64/fpu/e_sqrt.c b/sysdeps/mips/mips64/n64/fpu/e_sqrt.c deleted file mode 100644 index 81f4e77697..0000000000 --- a/sysdeps/mips/mips64/n64/fpu/e_sqrt.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/mips/mips64/n64/fpu/e_sqrtf.c b/sysdeps/mips/mips64/n64/fpu/e_sqrtf.c deleted file mode 100644 index fb0700d45c..0000000000 --- a/sysdeps/mips/mips64/n64/fpu/e_sqrtf.c +++ /dev/null @@ -1 +0,0 @@ -#include From patchwork Tue Jun 9 21:32:57 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: 1306313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=EV/301AE; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNfR1v12z9sRR for ; Wed, 10 Jun 2020 07:33:51 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EBE57388C018; Tue, 9 Jun 2020 21:33:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EBE57388C018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738403; bh=AXq5m2y/Qecib8PpbNsA+GyW0lCTE0GInTJ1SA/pq9w=; 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=EV/301AEgez5VkkVxWpfIhJLD/WJidOzQptrTtjQT44w0NmC/0ksX0+rPsxut0fbq TPMakdXVaD7ML/VsjGUdMXbs3fUvJE1hFxA+7gaTU/oRr5J+4yRrL1fZfOYDeCWtsI /ZQnwLROCJuG9DPPM7Zb+PvGmdOKDctsr2Nv+/zI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by sourceware.org (Postfix) with ESMTPS id E68B2388C011 for ; Tue, 9 Jun 2020 21:33:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E68B2388C011 Received: by mail-qt1-x841.google.com with SMTP id d27so172686qtg.4 for ; Tue, 09 Jun 2020 14:33:19 -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=AXq5m2y/Qecib8PpbNsA+GyW0lCTE0GInTJ1SA/pq9w=; b=ZFzaKydUNVA/uuoRF+FKcNOMD18iHfeZxZ0ONthW7vgN+DWLiEdpjtmuyojreuqbio QOusMhbiPjwoYOwXxuP9g2wut9v/lruEt/Zy1raGSbrkH6AR52gFKzA9FdLNwngiPYEi rOINA85H6KCUDC+uS06fK+4xLAcdN/WQP1gpeP7rG1FBVX+EMro1L8EDXYazt92u0bPo 9qSY8Y1750Hz+4l90fu+p2oSu9iuuOQ3d4GQIMnoxz30ONrCCuPZ2JnruAq4uhpEof+k e3hDf9VmmqUK80bkI8WdHgYiCb3UC4zVhzN2TYvgzIa8KJNv/Y3QBRqkc3UVT4SCTnUi AadA== X-Gm-Message-State: AOAM5328cJMmJNtVLs0Mhn6nPTNZnT7sLak8esCs8Lu9Nx6VyHvz+csn 9G6/+AaxeKFIlsfWkLmN61nzig8bLcQ= X-Google-Smtp-Source: ABdhPJxKsueXe1IY6wzb27OLKbBATzN9d+H4JO1cVLQNMUf9lLrgbftrMiFXfVaCQSL5HeuR9Ssm2w== X-Received: by 2002:ac8:339b:: with SMTP id c27mr29783533qtb.210.1591738398975; Tue, 09 Jun 2020 14:33:18 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:18 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 09/13] sparc: Use sqrt{f} builtin Date: Tue, 9 Jun 2020 18:32:57 -0300 Message-Id: <20200609213301.3591135-9-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" It also enabled to use fsqrtd on sparc64. Checked on sparcv9-linux-gnu and sparc64-linux-gnu. --- sysdeps/sparc/fpu/math-use-builtins-sqrt.h | 4 +++ sysdeps/sparc/sparc32/e_sqrt.c | 34 ---------------------- 2 files changed, 4 insertions(+), 34 deletions(-) create mode 100644 sysdeps/sparc/fpu/math-use-builtins-sqrt.h delete mode 100644 sysdeps/sparc/sparc32/e_sqrt.c diff --git a/sysdeps/sparc/fpu/math-use-builtins-sqrt.h b/sysdeps/sparc/fpu/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..e94c915ba6 --- /dev/null +++ b/sysdeps/sparc/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 diff --git a/sysdeps/sparc/sparc32/e_sqrt.c b/sysdeps/sparc/sparc32/e_sqrt.c deleted file mode 100644 index e8a42c4d7b..0000000000 --- a/sysdeps/sparc/sparc32/e_sqrt.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1991-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 -#include - -#ifndef __GNUC__ - #error This file uses GNU C extensions; you must compile with GCC. -#endif - -/* Return the square root of X. */ -double -__ieee754_sqrt (double x) -{ - register double result; - asm ("fsqrtd %1, %0" : "=f" (result) : "f" (x)); - return result; -} -libm_alias_finite (__ieee754_sqrt, __sqrt) From patchwork Tue Jun 9 21:32:58 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: 1306314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=T4jS7QF0; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNfW2flLz9sRR for ; Wed, 10 Jun 2020 07:33:55 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7C064388B038; Tue, 9 Jun 2020 21:33:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C064388B038 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738404; bh=TLKPcjkHCyqDUNEHSZcqypgWFaLUxmktN3OESaYTa5o=; 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=T4jS7QF0z9kfA0EqFxCiLi3K57uXBKtdrqNhvSP2NfF/2ReBEkqVvbPppESoD7muZ U49Ej0lTDtXG2pVfhcNMNtyLHlEyF6cVhLQx4eFt/9k1yTr4r0CPSiZXQn1LC32J17 iGpSnt6VkVPqDnOt3DZUlg0+nRQ6qz2dda8blmO0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by sourceware.org (Postfix) with ESMTPS id 3C85A388C010 for ; Tue, 9 Jun 2020 21:33:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3C85A388C010 Received: by mail-qk1-x730.google.com with SMTP id c185so103152qke.7 for ; Tue, 09 Jun 2020 14:33:21 -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=TLKPcjkHCyqDUNEHSZcqypgWFaLUxmktN3OESaYTa5o=; b=PPi7LB+PYHUMlnVdstn/Kkifex3OMIwG4M0tmPMA5pbgdWQNGR6EB2S2rNkQFtgmVE bI3ZYC7AYofOqJBRndWgoIlgBsrh8O7b4Nb1OJ7ctlahMvVG/Zx9en3R6Hpz/LZbhve0 xQuxr9esv5WCh2A1LEfbgcnPYXI7fV+BO+lyGzDcrFQde+3OossFTKOh3fNqdnL1MHDg /fx5a0POXd7xd/ZAKBh5RcEDS8y9bUpfZQLxZ04og2c2+B33JORPtbxjUcnmey6wRVGV EIxeJbFm5IssrX/lgdAR3ERSrwhPS5Bq8nxEKtnlBMybiPuRIhDqSVKP8KHMgbsD0A4c q3vA== X-Gm-Message-State: AOAM530zEs+nXXlwc+1lq+cu1ANpemLmiYNI+Ge7/rCF+JDpAN5DeE9O bCoEB8WtCPjBgcD6l5kktomUABraQ/U= X-Google-Smtp-Source: ABdhPJwXH6lBbPR5nTXYLAqe8SWturbHElqecPaJMZ/NWMy4A2IE/Zu14s288VUirFo5OgJLfThK4Q== X-Received: by 2002:a05:620a:a9c:: with SMTP id v28mr28739478qkg.335.1591738400385; Tue, 09 Jun 2020 14:33:20 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:19 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 10/13] s390: Use sqrt{f} builtin Date: Tue, 9 Jun 2020 18:32:58 -0300 Message-Id: <20200609213301.3591135-10-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.8 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 s390x-linux-gnu. --- sysdeps/s390/fpu/e_sqrt.c | 30 ----------------------- sysdeps/s390/fpu/e_sqrtf.c | 30 ----------------------- sysdeps/s390/fpu/math-use-builtins-sqrt.h | 4 +++ 3 files changed, 4 insertions(+), 60 deletions(-) delete mode 100644 sysdeps/s390/fpu/e_sqrt.c delete mode 100644 sysdeps/s390/fpu/e_sqrtf.c create mode 100644 sysdeps/s390/fpu/math-use-builtins-sqrt.h diff --git a/sysdeps/s390/fpu/e_sqrt.c b/sysdeps/s390/fpu/e_sqrt.c deleted file mode 100644 index 484c6aae95..0000000000 --- a/sysdeps/s390/fpu/e_sqrt.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky . - 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 - -double -__ieee754_sqrt (double x) -{ - double res; - - __asm__ ( "sqdbr %0,%1" : "=f" (res) : "f" (x) ); - return res; -} -libm_alias_finite (__ieee754_sqrt, __sqrt) diff --git a/sysdeps/s390/fpu/e_sqrtf.c b/sysdeps/s390/fpu/e_sqrtf.c deleted file mode 100644 index bce49c90f1..0000000000 --- a/sysdeps/s390/fpu/e_sqrtf.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2004-2020 Free Software Foundation, Inc. - Contributed by Martin Schwidefsky . - 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 - -float -__ieee754_sqrtf (float x) -{ - float res; - - __asm__ ( "sqebr %0,%1" : "=f" (res) : "f" (x) ); - return res; -} -libm_alias_finite (__ieee754_sqrtf, __sqrtf) diff --git a/sysdeps/s390/fpu/math-use-builtins-sqrt.h b/sysdeps/s390/fpu/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..e94c915ba6 --- /dev/null +++ b/sysdeps/s390/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 From patchwork Tue Jun 9 21:32:59 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: 1306315 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=QLKVY1jn; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNfb3qK3z9sRR for ; Wed, 10 Jun 2020 07:33:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 09A34388C027; Tue, 9 Jun 2020 21:33:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 09A34388C027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738406; bh=FGuh5lxBl9PQj9COU+2XBCtuK+zUsxsD8JlbsFZ9/G4=; 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=QLKVY1jnKkHD7Me/YwCmawO7YfvkpqlvF8emLzDdfy1CsHV1dzS/YLFFaVi3Ze2CF +6lv73C5N4xhqPxmtSYIB5W1c69tMfwQqpcVJyYABedaIPQRnAxaMLepL3TVHLo8VP PHAi9YojpUzy4rEdLhlgn6++iwFVm0nzoVZB7hh0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by sourceware.org (Postfix) with ESMTPS id 4D5D5388C021 for ; Tue, 9 Jun 2020 21:33:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4D5D5388C021 Received: by mail-qv1-xf43.google.com with SMTP id p15so82810qvr.9 for ; Tue, 09 Jun 2020 14:33:23 -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=FGuh5lxBl9PQj9COU+2XBCtuK+zUsxsD8JlbsFZ9/G4=; b=Dsg7tmJVrCsC/erT8joKHRIGOMaHaOXBuGQ9hUfhgEpk/uSlTdycZuclTwOV/BcNLe c7jo+zfI3mRWw6XQm1OmIECN3qKoZO6krPXD2/lCh6usSuGZuPpn/MxwSO1RowkswFVv o9ynh0/cG4LopTL7v6lzjdALZ24wgAB5gB7kmqObQaDGnkvI7YFBT3slPO5rf0RMEuB7 IK6vBpBP64Nt9fKiOcL/m4SnyzufSTUwVz7qrpeHIAAu4I8bUZRH11aL/zTyKsOWYzfp kRno2AdDoo9KNqhdG15rgNZxSNx4FiaJFr3f/K/pfcfzarWPkPSPvKWr/81pJakagVRC KLDA== X-Gm-Message-State: AOAM532ksNJ3q1d3GzhbVPGqPv9ZWhxV8q/4EIevifaAYMIm+n4KY0Au jUb1Nvvst0xb22ZdiL9oDSwJ8YXt+vc= X-Google-Smtp-Source: ABdhPJwtwUQoIWpqRzlJl8568Ydu7P5saWsM3gPz2lRskze/YWqoJ/Dvf1f3nFITuDNmutN3QBUjIA== X-Received: by 2002:a05:6214:4e7:: with SMTP id cl7mr97765qvb.215.1591738402655; Tue, 09 Jun 2020 14:33:22 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:21 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 11/13] riscv: Use sqrt{f} builtin Date: Tue, 9 Jun 2020 18:32:59 -0300 Message-Id: <20200609213301.3591135-11-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.8 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 with a build for riscv64-linux-gnu-rv64imac-lp64 (no builtin support), riscv64-linux-gnu-rv64imafdc-lp64, and riscv64-linux-gnu-rv64imafdc-lp64d. --- sysdeps/riscv/rvd/e_sqrt.c | 28 ---------------------- sysdeps/riscv/rvd/math-use-builtins-sqrt.h | 4 ++++ sysdeps/riscv/rvf/e_sqrtf.c | 28 ---------------------- 3 files changed, 4 insertions(+), 56 deletions(-) delete mode 100644 sysdeps/riscv/rvd/e_sqrt.c create mode 100644 sysdeps/riscv/rvd/math-use-builtins-sqrt.h delete mode 100644 sysdeps/riscv/rvf/e_sqrtf.c diff --git a/sysdeps/riscv/rvd/e_sqrt.c b/sysdeps/riscv/rvd/e_sqrt.c deleted file mode 100644 index 7defcb5785..0000000000 --- a/sysdeps/riscv/rvd/e_sqrt.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Double precision floating point square root. RISC-V version. - Copyright (C) 2017-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 - -double -__ieee754_sqrt (double x) -{ - asm ("fsqrt.d %0, %1" : "=f" (x) : "f" (x)); - return x; -} -libm_alias_finite (__ieee754_sqrt, __sqrt) diff --git a/sysdeps/riscv/rvd/math-use-builtins-sqrt.h b/sysdeps/riscv/rvd/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..e94c915ba6 --- /dev/null +++ b/sysdeps/riscv/rvd/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 diff --git a/sysdeps/riscv/rvf/e_sqrtf.c b/sysdeps/riscv/rvf/e_sqrtf.c deleted file mode 100644 index 04835e3e53..0000000000 --- a/sysdeps/riscv/rvf/e_sqrtf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Single precision floating point square root. RISC-V version. - Copyright (C) 2017-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 - -float -__ieee754_sqrtf (float x) -{ - asm ("fsqrt.s %0, %1" : "=f" (x) : "f" (x)); - return x; -} -libm_alias_finite (__ieee754_sqrtf, __sqrtf) From patchwork Tue Jun 9 21:33:00 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: 1306316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=vUB9w5dR; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNfg0Gdqz9sRR for ; Wed, 10 Jun 2020 07:34:03 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8B3D8388C02B; Tue, 9 Jun 2020 21:33:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B3D8388C02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738406; bh=FHX8RFI8P+H1E8hsYvX6L5D1ZkWc84UoVXTuPGu8RbA=; 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=vUB9w5dRH95h+m39WW0JiTDgxTXsYVODqXZZhwDp+hfBPMmo/u/II01txiGbOqrhx jx7RcsVg3DdWGUgb+qpTMTaXu0YDp/OUJaRFmCqIuiXvtrX0o37VPkd6agU4X/NbWF 0wX7OF8z2ZjJOi0uZ/xxrsjXRC4JDtW8bUFr3BDk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by sourceware.org (Postfix) with ESMTPS id 9252C388C022 for ; Tue, 9 Jun 2020 21:33:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9252C388C022 Received: by mail-qv1-xf2a.google.com with SMTP id r16so91539qvm.6 for ; Tue, 09 Jun 2020 14:33:24 -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=FHX8RFI8P+H1E8hsYvX6L5D1ZkWc84UoVXTuPGu8RbA=; b=PQazpQyx7rpjUfwtwd4mNsumngdthA8NevfPuWJ9MJSMibGZqt8xD9Fs2q0pxaApI0 JE32EvQDrbUm7OSzDQqzMNBrFBkedlIf4zsEuhJU465PIjqWYlqKBBm0Oyj0gg4uAtBr zygsRdlWJXbeXGUnzjyDtz+fjYOLYuyVhignTsncbPcCju+Mi5l1kjIHyZYickf2gwao R3qtV4JTPkstdbVrmAKbKA53ZoutuMUNUkj1KbnD6yO63NzE9qHo6GbPXAbb13uO81lR dDIpjzCQmGqy9L0/K6++917dlB0tCBYZV0/xwFERiAnOdfmJ5ObFf7dlDjtzyxZPW2T+ brfA== X-Gm-Message-State: AOAM532v7GRl5TxVc5GKWWF9YPSoxr7i2SxttdJSFPQ/PRKuqR0OwBo7 k6ye42rF6W/a6lR6EK7fn5NwZB7mtY8= X-Google-Smtp-Source: ABdhPJzsqwzyDiqlX4lXh3uarutuZ9WGnet2gmNAdOEAgo492kf7O3avs+m5kpQYI1TkdOAYchxtDQ== X-Received: by 2002:a05:6214:313:: with SMTP id i19mr105546qvu.183.1591738403896; Tue, 09 Jun 2020 14:33:23 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:23 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 12/13] arm: Use sqrt{f} builtin Date: Tue, 9 Jun 2020 18:33:00 -0300 Message-Id: <20200609213301.3591135-12-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.8 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 arm-linux-gnueabi and armv7-linux-gnueabihf --- sysdeps/arm/e_sqrt.c | 46 ---------------------------- sysdeps/arm/e_sqrtf.c | 46 ---------------------------- sysdeps/arm/math-use-builtins-sqrt.h | 9 ++++++ 3 files changed, 9 insertions(+), 92 deletions(-) delete mode 100644 sysdeps/arm/e_sqrt.c delete mode 100644 sysdeps/arm/e_sqrtf.c create mode 100644 sysdeps/arm/math-use-builtins-sqrt.h diff --git a/sysdeps/arm/e_sqrt.c b/sysdeps/arm/e_sqrt.c deleted file mode 100644 index d264c4263b..0000000000 --- a/sysdeps/arm/e_sqrt.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Compute square root for double. ARM version. - Copyright (C) 2016-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 - . */ - -#ifdef __SOFTFP__ - -/* Use architecture-indendent sqrt implementation. */ -# include - -#else - -/* Use VFP square root instruction. */ -# include -# include -# include - -double -__ieee754_sqrt (double x) -{ - double ret; -# if __ARM_ARCH >= 6 - asm ("vsqrt.f64 %P0, %P1" : "=w" (ret) : "w" (x)); -# else - /* As in GCC, for VFP9 Erratum 760019 avoid overwriting the - input. */ - asm ("vsqrt.f64 %P0, %P1" : "=&w" (ret) : "w" (x)); -# endif - return ret; -} -libm_alias_finite (__ieee754_sqrt, __sqrt) - -#endif diff --git a/sysdeps/arm/e_sqrtf.c b/sysdeps/arm/e_sqrtf.c deleted file mode 100644 index c3f31119a3..0000000000 --- a/sysdeps/arm/e_sqrtf.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Compute square root for float. ARM version. - Copyright (C) 2016-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 - . */ - -#ifdef __SOFTFP__ - -/* Use architecture-indendent sqrtf implementation. */ -# include - -#else - -/* Use VFP square root instruction. */ -# include -# include -# include - -float -__ieee754_sqrtf (float x) -{ - float ret; -# if __ARM_ARCH >= 6 - asm ("vsqrt.f32 %0, %1" : "=t" (ret) : "t" (x)); -# else - /* As in GCC, for VFP9 Erratum 760019 avoid overwriting the - input. */ - asm ("vsqrt.f32 %0, %1" : "=&t" (ret) : "t" (x)); -# endif - return ret; -} -libm_alias_finite (__ieee754_sqrtf, __sqrtf) - -#endif diff --git a/sysdeps/arm/math-use-builtins-sqrt.h b/sysdeps/arm/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..e765e7c49d --- /dev/null +++ b/sysdeps/arm/math-use-builtins-sqrt.h @@ -0,0 +1,9 @@ +#ifdef __SOFTFP__ +# define USE_SQRT_BUILTIN 0 +# define USE_SQRTF_BUILTIN 0 +#else +# define USE_SQRT_BUILTIN 1 +# define USE_SQRTF_BUILTIN 1 +#endif +#define USE_SQRTL_BUILTIN 0 +#define USE_SQRTF128_BUILTIN 0 From patchwork Tue Jun 9 21:33:01 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: 1306317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=t7mjfWOL; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hNfl1S2Hz9sRR for ; Wed, 10 Jun 2020 07:34:07 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D452388C026; Tue, 9 Jun 2020 21:33:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D452388C026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1591738409; bh=wH86W7QDoo7ji6nMm++jF04pg9YPb+ECjkrMrR2hbBc=; 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=t7mjfWOLz9fclEIMTfecDusHYb1SkH151J5hMBEVy0qrusS7HCdJBDkcgkgGqdwGU ZsbhcRlFX2hmobemls0Y90Y6smpCd5Is9W4v9o6rVYOwhbOo65Zxtx6hzp9/T6h/q5 5rlNFFzdkXlwROhHezCNL74+spI77+48nadteGJI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by sourceware.org (Postfix) with ESMTPS id 04B35388C026 for ; Tue, 9 Jun 2020 21:33:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 04B35388C026 Received: by mail-qv1-xf44.google.com with SMTP id di13so73130qvb.12 for ; Tue, 09 Jun 2020 14:33:26 -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=wH86W7QDoo7ji6nMm++jF04pg9YPb+ECjkrMrR2hbBc=; b=Pzdbf4JoXd/kAvVl+p5KPUcJCOadsCMTRd7bWagX4hmR1eSgIZDEWecqBrnsiQSjtp jwyRUNp0xwwhZbYFsmIjYkDuasfD5Hji93I5/3/bo+7LceiTzpUVZfam6Eik1JQwN+mM UMRRCYuE5BAqKhYwB+UWB0ZsqqXdx6Olq5gG4gpt1T+Hou9GP2mQGvOaYBlVKnRrOA8D 8X904pcS8nmfy/tJsMYj0i6m1Hzh7SbPWxtHR5uGm0Ty8OuGhx2eLJN7qEoQMoim/zaB CdOf0cff1TMI7RDuNoPp7wLj9x9OgJGu7G7o+Ehobgue3onEo2tBBOpD0Xd5sXJHeVqJ +dhQ== X-Gm-Message-State: AOAM533Vu+NQtaE3oROWlojvAdYG/UHjt/mlqmwjwwIkDPg/HL3FgBUp foWGum40WlTtRvSXX6YC7wgaxkSZHRU= X-Google-Smtp-Source: ABdhPJzG9z4Yn4Ja21VwIP96mB34117TItpUfuNTGgdSkpypgYjydfI29LsKCyf6aIe7Q+FGA6tnuw== X-Received: by 2002:a05:6214:170e:: with SMTP id db14mr109845qvb.113.1591738405357; Tue, 09 Jun 2020 14:33:25 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id d193sm10746214qke.124.2020.06.09.14.33.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 14:33:24 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 13/13] m68k: Use sqrt{f} builtin for coldfire Date: Tue, 9 Jun 2020 18:33:01 -0300 Message-Id: <20200609213301.3591135-13-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.8 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 with a build for m68k-linux-gnu-coldfire. --- sysdeps/m68k/coldfire/fpu/e_sqrt.c | 26 ------------------ sysdeps/m68k/coldfire/fpu/e_sqrtf.c | 27 ------------------- .../coldfire/fpu/math-use-builtins-sqrt.h | 4 +++ 3 files changed, 4 insertions(+), 53 deletions(-) delete mode 100644 sysdeps/m68k/coldfire/fpu/e_sqrt.c delete mode 100644 sysdeps/m68k/coldfire/fpu/e_sqrtf.c create mode 100644 sysdeps/m68k/coldfire/fpu/math-use-builtins-sqrt.h diff --git a/sysdeps/m68k/coldfire/fpu/e_sqrt.c b/sysdeps/m68k/coldfire/fpu/e_sqrt.c deleted file mode 100644 index c67630d1b8..0000000000 --- a/sysdeps/m68k/coldfire/fpu/e_sqrt.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 2006-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 - -double -__ieee754_sqrt (double x) -{ - asm ("fdsqrt.d %1,%0" : "=f" (x) : "fm" (x)); - return x; -} -libm_alias_finite (__ieee754_sqrt, __sqrt) diff --git a/sysdeps/m68k/coldfire/fpu/e_sqrtf.c b/sysdeps/m68k/coldfire/fpu/e_sqrtf.c deleted file mode 100644 index c2e4928957..0000000000 --- a/sysdeps/m68k/coldfire/fpu/e_sqrtf.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2006-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 - -float -__ieee754_sqrtf (float x) -{ - double result; - asm ("fssqrt.s %1,%0" : "=f" (result) : "dm" (x)); - return result; -} -libm_alias_finite (__ieee754_sqrtf, __sqrtf) diff --git a/sysdeps/m68k/coldfire/fpu/math-use-builtins-sqrt.h b/sysdeps/m68k/coldfire/fpu/math-use-builtins-sqrt.h new file mode 100644 index 0000000000..e94c915ba6 --- /dev/null +++ b/sysdeps/m68k/coldfire/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