From patchwork Thu Dec 28 17:20:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 758605 Delivered-To: patch@linaro.org Received: by 2002:a5d:67c6:0:b0:336:6142:bf13 with SMTP id n6csp4115555wrw; Thu, 28 Dec 2023 09:23:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHEGjW9ub/rBTa98/ZaWc6XLnB/LIMLc4p1NNdXISE+KkFWyHfPMO36SRInXcRKkHN1BbsR X-Received: by 2002:a05:622a:1483:b0:425:4043:41a5 with SMTP id t3-20020a05622a148300b00425404341a5mr13107758qtx.81.1703784196938; Thu, 28 Dec 2023 09:23:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703784196; cv=pass; d=google.com; s=arc-20160816; b=kwcZ1Soh3D/k2Wzu9y1Nh2l8fnzUDXmrEAAmdoC6mP/cHKXWn45sqOKAyXX7Dq8Q2i 0LW5qntzlMcMl4HiCamgSXVopZYjCo4AxqkOyAuC3PUwp6rUfVQGKPoy3zVaI6K3czsa WXbi5+UURV7lGvqTvIrRxuQzEEk0ynabDdjqQqeI3XEDB1vEsDFIPK4wrsgt6/dHUvpB 8o6aktxJ50DAVUEXAMOw7VtWFKyhzsO+7sy/WbTn7929bO4nwXL9i/Ppb4B+n22Se2Bn vw8nNmeEVahC2iHRJ6FTbZysqwxbpmu+BD1A0YMlm1hlu2vBeQEXRFMOQCg2cZw5fxdq I2RQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=+NbhUyx25vjdS6Rhk8Zdirg4THsnNQU8QR+D2Twnb8Y=; fh=dHLBnA+MhGtNtN2B2JMAELi4oD+gmgMg7DL8H0jYbkI=; b=Ss3ZTY70kt5SWwJPjnJVt56wQ1H23n4tTkgqdvIbYXLVmnFzzLSTRkkEmmEEubyLwR IdQ0uH0a/hXMpmVVk0GNiYZS3wgNPZk7kN7GMqLApj+Mf7KjCf322qIHt/a4Z89Aoh8G M5zz5kZfGkE2RHAwTqbLNsa8zHiBqZMMA0YaVLb1YiSUZBjqTKJMQSjkCxkSUFJ0rfN3 TMt9kxF8XL7NBNYQrMjJYgKOckU5dq+AHw2nrkdi8r1lIQgnVyFYxTc4j/woIBdeP0q8 WumnFElovN/pW4EOCeZ5pd3YfP6adxGsPHK0dOYNcdaVcqLtAhzDCEBGLp6wdzSAgabu dK+Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lf3OxaO+; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g10-20020ac8580a000000b00427f8d3b919si1603186qtg.4.2023.12.28.09.23.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 09:23:16 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lf3OxaO+; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 847753858013 for ; Thu, 28 Dec 2023 17:23:16 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 6ABD03858286 for ; Thu, 28 Dec 2023 17:20:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6ABD03858286 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6ABD03858286 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703784045; cv=none; b=ta+vPxfR1A9yScNVfuOmBlL9Bnx8Sy0Iale/LxnAtltTTzjlyzMpHBPANbnLAOjhteYYu7f9aiQ7xjSYS0BIDdFaXyKul2aZPNBfeo/VwqGRf0vchMovSzIk0hQEMsVzmLY8NcudWe5SCKIM+AJAChRAkJFge+8BKIZNp9vQuhY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703784045; c=relaxed/simple; bh=iccIFjLRfp4IHbcfo8DyFNAJ2jg78Xfxd8GNb3JH0HQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=d6UEUu2I78J+IOjJ4KOuaaneObIRUnlGt16t5OsIBu21/6uyjCRKLVlK4rksBKpirhVaqHXIrh/55QfYcI2NmLJl7W0kCfzb84OTs7jIsCNWymnfLVxLZLcPWwB1y6Ldlg9Py+J/7QHJQkJVyqnuJSCNPwzvmF1YtraDbIKB+WU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6d98f6e8de1so1816266b3a.0 for ; Thu, 28 Dec 2023 09:20:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703784042; x=1704388842; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+NbhUyx25vjdS6Rhk8Zdirg4THsnNQU8QR+D2Twnb8Y=; b=lf3OxaO+2++mHcgLPUcJ8hoRAaKVySBYWlV9DM+EeCW4VA3jd7R74PcIZE/QBbxqIa LIHG65dRID87m0ulroRU+y3J3JqV4sfcqUQ9saDPwP3UelaJPYIbfsHCXJbmaI5Itjp3 1e8ku+iySIzq/Ye1Po6fD28flipkMNZ1UQZvXjnfe7u1nc+BgUbSqICTk5rzZTalTHj0 7ShrcKxYWSKCPOCK72USCfjmwCRJoYyGBDer9+2pCmMWKmBuMHc+jaoFiIjXs8tqdNxv b1MDN3rfpRGr6RnZrBMrSqWkj5TH1sYrSZkft5ZI9xWmC+vbphKdYanyPpl4xMFS6jT8 kDmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703784042; x=1704388842; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+NbhUyx25vjdS6Rhk8Zdirg4THsnNQU8QR+D2Twnb8Y=; b=KyFKjgYMF81qXoWuu2imI1TiiVIFLeR2sqds7RaZn7AokGwNrbX5UYKR13QFf2TvjP C5TWmix37xqoricBivTLMmoHqgZhS7AH+wwJkETJOudjMc2iExkl2DMX3tMgpISN6u1y 0tQakDIh3UOY6pq9zp4zHL3aRb/Zg1k/oz9W65XbbCsgaBMkgv7VY1iyNSxVadpMvRY/ 83gBFpj/v7NG1syHydNceynGJh+uKL+Vi4FdxJHbsE+Iyij1XKQZ46LOeQk6t5jmCvnE 1THzdO1mNrnsyunO+CGtihlVn8jeeq0hhkvfuJfuHS2D8ilf26hPg0KiQMxz3jS2OB8m sOLw== X-Gm-Message-State: AOJu0YyeyB4mWOyUCVKSFShSsIxKZSkUD1XrIbx7De0rNwEYxkbDZkSM Z06KerFKC8bPxMNUNfOKuu/c1xu3gpE1culUgH/+bziKXcQ= X-Received: by 2002:a05:6a00:1889:b0:6d9:bcc4:4d08 with SMTP id x9-20020a056a00188900b006d9bcc44d08mr3402608pfh.56.1703784041773; Thu, 28 Dec 2023 09:20:41 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c1:bd9:84dc:8a87:ea0:57d7]) by smtp.gmail.com with ESMTPSA id q7-20020aa79827000000b006d9a94a03a8sm9593839pfl.77.2023.12.28.09.20.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 09:20:41 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 07/12] x86: Do not raise inexact exception on ceill Date: Thu, 28 Dec 2023 14:20:21 -0300 Message-Id: <20231228172026.2013007-8-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231228172026.2013007-1-adhemerval.zanella@linaro.org> References: <20231228172026.2013007-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org It is not allowed anymore on ISO C23. Checked on x86_64-linux-gnu and i686-linux-gnu. --- sysdeps/i386/fpu/s_ceill.S | 39 ------------------------------------ sysdeps/x86/fpu/s_ceill.c | 38 +++++++++++++++++++++++++++++++++++ sysdeps/x86_64/fpu/s_ceill.S | 34 ------------------------------- 3 files changed, 38 insertions(+), 73 deletions(-) delete mode 100644 sysdeps/i386/fpu/s_ceill.S create mode 100644 sysdeps/x86/fpu/s_ceill.c delete mode 100644 sysdeps/x86_64/fpu/s_ceill.S diff --git a/sysdeps/i386/fpu/s_ceill.S b/sysdeps/i386/fpu/s_ceill.S deleted file mode 100644 index a551fce7f9..0000000000 --- a/sysdeps/i386/fpu/s_ceill.S +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Public domain. - */ - -#include -#include - -RCSID("$NetBSD: $") - -ENTRY(__ceill) - fldt 4(%esp) - subl $32,%esp - cfi_adjust_cfa_offset (32) - - fnstenv 4(%esp) /* store fpu environment */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x0800,%edx /* round towards +oo */ - orl 4(%esp),%edx - andl $0xfbff,%edx - movl %edx,(%esp) - fldcw (%esp) /* load modified control word */ - - frndint /* round */ - - /* Preserve "invalid" exceptions from sNaN input. */ - fnstsw - andl $0x1, %eax - orl %eax, 8(%esp) - - fldenv 4(%esp) /* restore original environment */ - - addl $32,%esp - cfi_adjust_cfa_offset (-32) - ret -END (__ceill) -libm_alias_ldouble (__ceil, ceil) diff --git a/sysdeps/x86/fpu/s_ceill.c b/sysdeps/x86/fpu/s_ceill.c new file mode 100644 index 0000000000..96c901e383 --- /dev/null +++ b/sysdeps/x86/fpu/s_ceill.c @@ -0,0 +1,38 @@ +/* Return smallest integral value not less than argument. x86 version. + Copyright (C) 2023 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 +#include + +long double +__ceill (long double x) +{ + fenv_t fenv; + long double r; + + libc_feholdexcept_setround_387 (&fenv, FE_UPWARD); + asm volatile ("frndint" : "=t" (r) : "0" (x)); + /* Preserve "invalid" exceptions from sNaN input. */ + fenv.__status_word |= libc_fetestexcept_387 (FE_INVALID); + libc_fesetenv_387 (&fenv); + + return r; +} +libm_alias_ldouble (__ceil, ceil) diff --git a/sysdeps/x86_64/fpu/s_ceill.S b/sysdeps/x86_64/fpu/s_ceill.S deleted file mode 100644 index 16dbecd56d..0000000000 --- a/sysdeps/x86_64/fpu/s_ceill.S +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Public domain. - */ - -#include -#include - - -ENTRY(__ceill) - fldt 8(%rsp) - - fnstenv -28(%rsp) /* store fpu environment */ - - /* We use here %edx although only the low 1 bits are defined. - But none of the operations should care and they are faster - than the 16 bit operations. */ - movl $0x0800,%edx /* round towards +oo */ - orl -28(%rsp),%edx - andl $0xfbff,%edx - movl %edx,-32(%rsp) - fldcw -32(%rsp) /* load modified control word */ - - frndint /* round */ - - /* Preserve "invalid" exceptions from sNaN input. */ - fnstsw - andl $0x1, %eax - orl %eax, -24(%rsp) - - fldenv -28(%rsp) /* restore original environment */ - - ret -END (__ceill) -libm_alias_ldouble (__ceil, ceil)