From patchwork Tue May 7 12:19:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 795204 Delivered-To: patch@linaro.org Received: by 2002:a5d:525c:0:b0:34e:ceec:bfcd with SMTP id k28csp264792wrc; Tue, 7 May 2024 05:20:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxG+y5Jxdz2i2ibGwlBJZKg4tg7dr3Fh1k0EadkpPwbiimK+BlUD6y7XxkZfgJrkxmgriAktW4kjXc/JRsTf5p X-Google-Smtp-Source: AGHT+IGdf/63Z4v3FWJ/9U/xmAhZMyXoprZkUm+V0Jgy6GwMuc9UbaWGGlMG/UTPrjcQUVruu/rP X-Received: by 2002:a05:622a:138a:b0:43b:14a:f9ac with SMTP id o10-20020a05622a138a00b0043b014af9acmr4137561qtk.14.1715084436555; Tue, 07 May 2024 05:20:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715084436; cv=pass; d=google.com; s=arc-20160816; b=fHXkytP5nzLU1SaLpu+HiQTpSJ1bnjLMMYKNhuNUY2DDm0ucIdHZZDSy8R+S3QUQHP drEgvM5WbGnXWCcLoIFkLlVZE1AsqTNG4d7r4U8FFrPTdyR3aDDh4rjP8fylyjzKgRpW UFDh6xMa+VBvILdxu2I8hhMAYXv9SHwgx0S/2KaEJzNgZ+1WO8Ll+VkqdhaJIanuX7/L 2Jwgad3JRHKNJ44LKTEK0A7B9Kf8KtgtGcnDSUH4g3JDOn6+UAIRMlcTHTKbQSgBJA4c ANlWWWRwtIuY3oijgloWkVjF/aHi2zAfeEFUYi41X60uAR3qyS2LIEhmy+jsIMBu+U0V ZvPw== 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:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=kwtJRUYAK3ovcwpJlZ7ljXUczLCVPg9Heh0CKwCR/1o=; fh=jHjSHPBQnOS3gECwE+nL6a77A0Vu++XxKWf953XJfvI=; b=OGYKHyUS4U72/KNtQQ4WzHrUpZUs9YgPj2HZcQdg2DpmUQZW2uPSPs2DqB6kbjeTbW RJ3NIk+Pg4NzuOuWfiXcneV1HH/YAQ4MwYocDJd+y6a4BIPJ58i391aWthtMbfsbReLx zhlWvzJYzuhKsG442nfoBO33bdxIBIvQx1ZwzRv/W7BhWiiivXncRZ+VvS7Wn7OBZ7Cr SyVUsqO18qHdnmCZ+MsJuDeSDDcGNjmGRa/4eF1uCHmXNXZgAyvk2DNKvPdM9PWGg3XB lkUbMHATrwdcRQeN00D9Nm4CQgIAbP4xJlQi4np/ZDwZpUZxCfS+HtaJ2B4ttrvU2i7O oiow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FozrzH9w; 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 b21-20020a05622a021500b00436f4a5db6bsi12149492qtx.522.2024.05.07.05.20.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 05:20:36 -0700 (PDT) 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=FozrzH9w; 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 0C3823846062 for ; Tue, 7 May 2024 12:20:36 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 7B5493858D1E for ; Tue, 7 May 2024 12:20:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B5493858D1E 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 7B5493858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::635 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715084424; cv=none; b=unKmA3hmLMcSsoa60MvSNh+77mNvMHmUpv59Rteu0bAptYUOOfseHiTh4XoN9CjR8M4VWZYF7STW3g2OeupRtncYN9PL68t6YgvhCqU/+kDE0+uLr39+fw/fR3mE1VUa/GPTBoR38m+FSXOMfeBsSt1UPt8fHLurkNvGbWaUPqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715084424; c=relaxed/simple; bh=Q1KRZwhHTz++LiW4TegyEJnT6qtGTvpyX2fQfBaigPs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hdaVwy22wZSMb8TEwBEPwwhT3XO3/i9JyVfw3Euzow2Lc9JA/O+XuFzK6oCOpzRreYRzVKdhtinEGGKINqYdQnawaNsPChGynhZPI121+Uyit6FzH1TIPWZRLnVwb6FsjUprMkVlfcqoR2ERdAM6P4V1wALoBTRrlsayHiosgGs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1ecd9a81966so33777985ad.0 for ; Tue, 07 May 2024 05:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715084421; x=1715689221; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kwtJRUYAK3ovcwpJlZ7ljXUczLCVPg9Heh0CKwCR/1o=; b=FozrzH9wPKNFtbfn+u33nbPqqQkWHAwdbDbvf2g+YryjR192nwXHrf0ez7Jc6blgyR f5IeHOjX8JNHuoW6KOhqSUEn3NhJ2lvfQLgjZwYhm+nBD/8Xwycr8TEENCleV/hMU3E7 3ERYPBxgyRvT+OOwupoqRygi3yaakesfF3tICKHsJfo3gdMfx/AUudOXpyyCgfy7/pg6 AakH4VKLNYazKK9wRwLU+EBEh5CdpE4LlmC0RWe6/E3VHLb5AKZCfwXkq3B9Xi6Xt8I9 w+FZu1BIsnIN/sxvQvjErbxgqJSTTnPQv47gB9EkkvNqfgAF1fLj+1UlPcrwuToT45MY fzBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715084421; x=1715689221; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kwtJRUYAK3ovcwpJlZ7ljXUczLCVPg9Heh0CKwCR/1o=; b=J4LDpfg76qux0Js56lsWA9WN/P3kj4ctk7BiBY6mTETC6oopA5rSb2eSu61SzmLxFE cBhv5YlBFe/mrb2agxK+IDxZWxUq/hhUOUlHxl1cHX8fPAe/SLG5Pz9Vc9u8ejgrOo6F wn5/i0Ku69wmc2Xx+fJ3U4valZUob+jIBe+8yGzEqfEcjGrxKS8N7osCS8lDQB680eCS wdENIF7mpGdy47l0jUv/FHoXLP0o8j47kDFsLawFkcz94qnw3aODF4pXtdiW9EltcvCr Mf6u6A2EmPn+QCmtTWaAjOMkLKJkJpiGlIRHLBQQyNIKh0ajptZa+5cC/rQpspwfz2DX fyKQ== X-Gm-Message-State: AOJu0Yz6/GfQ2Sp3/YBSOiAt82CTPidK4vEvVb4InAVVb9SkvQ84YTj/ PmRReR0QvcMvl3fdiNPbijFtSsMtvL9JCdIo91f8lDu4opKMEu/E60zp5zLkq88NJWYeJ8spAx1 R X-Received: by 2002:a17:902:cf01:b0:1e5:560d:8519 with SMTP id i1-20020a170902cf0100b001e5560d8519mr4374972plg.0.1715084420867; Tue, 07 May 2024 05:20:20 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:6e56:e1f4:f746:9f5f:9ad4]) by smtp.gmail.com with ESMTPSA id q3-20020a170902dac300b001e512537a5fsm9933143plx.9.2024.05.07.05.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 05:20:19 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Paul E Murphy Subject: [PATCH v3] powerpc: Fix __fesetround_inline_nocheck on POWER9+ (BZ 31682) Date: Tue, 7 May 2024 09:19:48 -0300 Message-ID: <20240507122016.2645778-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 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.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 The e68b1151f7460d5fa88c3a567c13f66052da79a7 commit changed the __fesetround_inline_nocheck implementation to use mffscrni (through __fe_mffscrn) instead of mtfsfi. For generic powerpc ceil/floor/trunc, the function is supposed to disable the floating-point inexact exception enablebbit, however mffscrni does not change any exception enable bits. This patch fixes by reverting the optimization for the __fesetround_inline_nocheck. Checked on powerpc-linux-gnu. Reviewed-by: Paul E. Murphy --- sysdeps/powerpc/fpu/fenv_libc.h | 16 +++++----------- sysdeps/powerpc/fpu/round_to_integer.h | 6 +++--- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h index f9167056a8..0a06e4486b 100644 --- a/sysdeps/powerpc/fpu/fenv_libc.h +++ b/sysdeps/powerpc/fpu/fenv_libc.h @@ -182,19 +182,13 @@ __fesetround_inline (int round) return 0; } -/* Same as __fesetround_inline, however without runtime check to use DFP - mtfsfi syntax (as relax_fenv_state) or if round value is valid. */ +/* Same as __fesetround_inline, and it also disable the floating-point + inexact execption (bit 60 - XE, assuming NI is 0). It does not check + if ROUND is a valid value. */ static inline void -__fesetround_inline_nocheck (const int round) +__fesetround_inline_disable_inexact (const int round) { -#ifdef _ARCH_PWR9 - __fe_mffscrn (round); -#else - if (__glibc_likely (GLRO(dl_hwcap2) & PPC_FEATURE2_ARCH_3_00)) - __fe_mffscrn (round); - else - asm volatile ("mtfsfi 7,%0" : : "n" (round)); -#endif + asm volatile ("mtfsfi 7,%0" : : "n" (round)); } #define FPSCR_MASK(bit) (1 << (31 - (bit))) diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h index b68833640f..6996519c61 100644 --- a/sysdeps/powerpc/fpu/round_to_integer.h +++ b/sysdeps/powerpc/fpu/round_to_integer.h @@ -42,14 +42,14 @@ set_fenv_mode (enum round_mode mode) switch (mode) { case CEIL: - __fesetround_inline_nocheck (FE_UPWARD); + __fesetround_inline_disable_inexact (FE_UPWARD); break; case FLOOR: - __fesetround_inline_nocheck (FE_DOWNWARD); + __fesetround_inline_disable_inexact (FE_DOWNWARD); break; case TRUNC: case ROUND: - __fesetround_inline_nocheck (FE_TOWARDZERO); + __fesetround_inline_disable_inexact (FE_TOWARDZERO); break; case NEARBYINT: /* Disable FE_INEXACT exception */