From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) by sourceware.org (Postfix) with ESMTPS id 369433858D28 for ; Mon, 1 Apr 2024 14:13:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 369433858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 369433858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1136 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711980800; cv=none; b=YcvqoY/vnaRtDfa97Qv+WrM63BBFNvu1rNHWb9KB3Ik4aPPebfZStGKUze3yW5IuIDhxKlK2FiJ8F5F/CuaGc2oHSjDrw9S3Xv6iJBI/VXZ76VCn6PZHxn8K/mN8fer2MRYMTe8s46+obfXVSVqcWoCtZC1du4un3Qw2AmY7MGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711980800; c=relaxed/simple; bh=SfJBWOsWJO7ZyhzkD2HIB9YhpQGGzt1/wFw79Wqlr4E=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=StJLuVPlq54A+665sXmblI+WgT+4b0SKmpzJqs6SL9TbdG/HrEg49BQzFRIJBWzXUHM9gdfsv9xhI+dFq+VJsKNnxFJbGrfhGPrO6R8zWe/vcL8azl2v9I3gi8vU8l6hxEoRv+5U+Dik8oTGZYE57whvwUJ2DDBX90LmwM5M9+s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-615053a5252so2121377b3.1 for ; Mon, 01 Apr 2024 07:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711980797; x=1712585597; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=y1EcWNU2S5669Qh1WsiM9+uS/6fJENQEWkyiOykSRUE=; b=VyW1vhyQkCDkp42IJpRPA15XE60Q5NVeMy+6loKm0DnfmoCGHIGuwZiaUMIycjuo/h sunGt8TdNyQmJB/j7aw0FQrFYJowwBq4e7HH87YWRw63v3Hgt012DMrO0TLTUaCJHFEU rHbdrha4dE+FPV1bfGfmzFGan9gbmbSljc/XyzVUE+Qa6TdDopiKxKkujj7urZfNqkaO dcoEpTkpyI9zEBbf3VeWfq4TpcvJwv8z7BbQr51n5Mxc+/0CivsqOk2D1bPwLCpgjPc7 j/BODQIv06F4gFR1bCsPGaMrZjCXqfY0CWlY6kS+X+h3o18RCAz+Mt3+zWjEPte0UvqC TjNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711980797; x=1712585597; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y1EcWNU2S5669Qh1WsiM9+uS/6fJENQEWkyiOykSRUE=; b=l+5USHzB0jMLKBSAwPF1lIp1zcF5gK80MZVVhhej/EjcH9UKYnugtTyjusbO/KQZgs nEwPlTpzohfaVWyg1/B/8XXHzhBdw99l0wdadtO32qfjlWXQlXcQLk37IZvrbes25LLs o+OygRRTAQfWyz0s40EX5Tt20V/IOecI3ngogkUT0Kh9m4gz9COkX0KQy3G5SCHCEkyT pP6saRUyOlXl7x+AVL9CfL2VleF6bkTb81VbdOkvnhYQQ93383kNkg+sLeiboKrrRjSL sd38ILjZlLfCe/Y6gi0zoilw55SwSzAixISbq0NNDbvp7IXE2wF4d0ERQkc04BuUZoxu in6g== X-Gm-Message-State: AOJu0YwsVGcQnrwo5IMF5wiIRy4tDE3ENHIE3yBZApJMcOFDPM8FgcHy OZzKt/BppbogFVCS2O3MQEf69tJtAden/d2wFjczf0L4wCDAip7yvF3XUWlGyERqVK98RWH5jiu ich+CB62iHmOrfQvlSYWNaAfNenY= X-Google-Smtp-Source: AGHT+IHP0zmw6CPWITQgbzF8CE4+fMZh5X0i04UbQUNJZ81i2o44rmT25OSMA2dgyz3Qa0hQCNrZpEH9xpWik3ZJStA= X-Received: by 2002:a0d:e644:0:b0:611:563e:1131 with SMTP id p65-20020a0de644000000b00611563e1131mr6352429ywe.19.1711980797395; Mon, 01 Apr 2024 07:13:17 -0700 (PDT) MIME-Version: 1.0 References: <20231228172026.2013007-1-adhemerval.zanella@linaro.org> <20231228172026.2013007-8-adhemerval.zanella@linaro.org> In-Reply-To: <20231228172026.2013007-8-adhemerval.zanella@linaro.org> From: "H.J. Lu" Date: Mon, 1 Apr 2024 07:12:41 -0700 Message-ID: Subject: Re: [PATCH 07/12] x86: Do not raise inexact exception on ceill To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3019.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Dec 28, 2023 at 9:23=E2=80=AFAM Adhemerval Zanella wrote: > > 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. 2024. > + 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" : "=3Dt" (r) : "0" (x)); > + /* Preserve "invalid" exceptions from sNaN input. */ > + fenv.__status_word |=3D 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) > -- > 2.34.1 > --=20 H.J.