From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 58BA2384640E for ; Wed, 3 Apr 2024 12:12:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 58BA2384640E 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 58BA2384640E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::102e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712146331; cv=none; b=gT4Vx51rN34dB+JoFk6cT69g0HTafmFpqNR5AxzYcJUsraLs6kLcdLmS2PGyvUl5JUwNxEt4Z5lSB6l9gf1BZQqdeyHicKZMG2c1VnITMFt7b/pG5HtpxJpa9IOzLtNRNUVuRfsYfp380YmMIJ3d7FIpAqDq5ey2xgXum0c2HPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712146331; c=relaxed/simple; bh=FOMDCenPAQlg5NMjQI5UJGbXM22kuiEHG338KjBy7TA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=TYT6YN3wQbDd1ueDK/3OaEpD+MXPVBvaOucgwEqIBgMXLrzDOGGsL8ZhJXnGz997rWexcUz/tPjyama8Bj/GtvvWpGaAA0gbHYv1H5WuWUZMcNV7rGIs8bNxjWW6YdP1ioUN27AJv5lkK0y8VwxNqZiAmhgUtiJyhDHXNw34K4U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2a27ba3b1f3so892081a91.3 for ; Wed, 03 Apr 2024 05:12:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146325; x=1712751125; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FQ5rLm032Y5QqQskna1qADGnTVJQSJ0WGlTt4XHwCYk=; b=Jy+CDZAtGCVliN0/CSdB3bWhtJxF02EgmDYLXPSpwWefvEu6h66K1Wnl2eHQiMUXi1 02Gg5NBbau/fG0WAyjLGv3a5aPfQsJLI+PZfgUb/8AaEGmuTFtVEpNZr/d/Rd8p8hTdi U/PKNBsBpztgS0pdaFJA+8KAvZmIKq34raRUNWOhJFKDbSlXxnM0Jdnw+068aeLsBB7G kpYPkskTivvIwNKXgwmoE1TlUngKm9U4WE83f6faAiRevXnRQqPancCUiWu60bAYPUY/ hN1D7Bp54ncGzcXBDGG8jTsQwQbvTRBfBAwdOxH+cMBIa5tcZdCOnic06CwRrJnYm+PN yB7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146325; x=1712751125; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FQ5rLm032Y5QqQskna1qADGnTVJQSJ0WGlTt4XHwCYk=; b=WfzvA64GpzzgqVgnLHZrpp9gvisKEj8kRgKVb+vOCag8azI7CusVIjGhMv6Qt4Zsdu Q6a7QCKcAZSUCJ8tpmZr1Aw+yyBv/OnexNLGPFP7NcvF8yJZ57FphZo8WwazeJSRrpT8 tLr+0UJxI8WvcZBXjpTBVZe2WRs4Y5Sg3QSuWdfG96OQx+6/ZFrC5qVhTU+8Q1fSU1Ad 2aFIZm2zLFolzi+6MZa/T+bTqU7Lch0hKZCHHvRMVGO+GNSN2gnj0RAv89j9JCzc1mTu 1PBxYT3KlyegJZMOVGK23M2edavJZJn3r5YQJpG1ze9vfvJu4Px43Ho1YVQR3GeY62js oRsA== X-Gm-Message-State: AOJu0YzLqditofPs+IDK6HiO0p7CDQwXVG8TuP/TY0tAbj3KYAc+0LwS wnBhWmqpXTHb4hnRFGGzzYFruhjR8WC7uyM44I62r2n0zrP7Gcab4MFUlUOFrA3yQwtDbDfjdRn k X-Google-Smtp-Source: AGHT+IHYj4SaybyH9sCyoBArt6bd2yL2W0PlcgJs5DizAM2Ns968teRr8qA6BUND7a3S9DBrXbdWvw== X-Received: by 2002:a17:90a:f008:b0:2a2:8c6d:17bf with SMTP id bt8-20020a17090af00800b002a28c6d17bfmr1966247pjb.4.1712146324747; Wed, 03 Apr 2024 05:12:04 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:b18e:12db:8f9c:da5:36ce]) by smtp.gmail.com with ESMTPSA id q6-20020a17090a938600b0029ffcf1df72sm13574141pjo.38.2024.04.03.05.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:12:04 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "H . J . Lu" Subject: [PATCH v2 06/10] x86: Do not raise inexact exception on floorl Date: Wed, 3 Apr 2024 09:11:46 -0300 Message-Id: <20240403121150.1018799-7-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240403121150.1018799-1-adhemerval.zanella@linaro.org> References: <20240403121150.1018799-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.6 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: It is not allowed anymore on ISO C23. Checked on x86_64-linux-gnu and i686-linux-gnu. --- sysdeps/i386/fpu/s_floorl.S | 39 ----------------------------------- sysdeps/x86/fpu/s_floorl.c | 38 ++++++++++++++++++++++++++++++++++ sysdeps/x86_64/fpu/s_floorl.S | 33 ----------------------------- 3 files changed, 38 insertions(+), 72 deletions(-) delete mode 100644 sysdeps/i386/fpu/s_floorl.S create mode 100644 sysdeps/x86/fpu/s_floorl.c delete mode 100644 sysdeps/x86_64/fpu/s_floorl.S diff --git a/sysdeps/i386/fpu/s_floorl.S b/sysdeps/i386/fpu/s_floorl.S deleted file mode 100644 index 3ec28b477b..0000000000 --- a/sysdeps/i386/fpu/s_floorl.S +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Public domain. - */ - -#include -#include - -RCSID("$NetBSD: $") - -ENTRY(__floorl) - 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 $0x400,%edx /* round towards -oo */ - orl 4(%esp),%edx - andl $0xf7ff,%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 (__floorl) -libm_alias_ldouble (__floor, floor) diff --git a/sysdeps/x86/fpu/s_floorl.c b/sysdeps/x86/fpu/s_floorl.c new file mode 100644 index 0000000000..3eca033f46 --- /dev/null +++ b/sysdeps/x86/fpu/s_floorl.c @@ -0,0 +1,38 @@ +/* Return largest integral value not less than argument. x86 version. + Copyright (C) 2024 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 +__floorl (long double x) +{ + fenv_t fenv; + long double r; + + libc_feholdexcept_setround_387 (&fenv, FE_DOWNWARD); + 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 (__floor, floor) diff --git a/sysdeps/x86_64/fpu/s_floorl.S b/sysdeps/x86_64/fpu/s_floorl.S deleted file mode 100644 index b74d1a4d6b..0000000000 --- a/sysdeps/x86_64/fpu/s_floorl.S +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Public domain. - */ - -#include -#include - -ENTRY(__floorl) - 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 $0x400,%edx /* round towards -oo */ - orl -28(%rsp),%edx - andl $0xf7ff,%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 (__floorl) -libm_alias_ldouble (__floor, floor) -- 2.34.1