From patchwork Mon May 6 17:07:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 795027 Delivered-To: patch@linaro.org Received: by 2002:adf:a453:0:b0:34e:ceec:bfcd with SMTP id e19csp1027687wra; Mon, 6 May 2024 10:08:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXUM1qZWVD/dof5OP7/tsrOvEZgD58F9/KG0imb9Z5JbqqP7AoZHlhpR550JdYi7UqjVZif1WXceOHnP2KVgV6U X-Google-Smtp-Source: AGHT+IHj76nmbkYMd/C1q1bzX4jD8x0D/u3IQakzhfCHL4LiVxic/svPr9my31Q1sqCNYTfkXbM2 X-Received: by 2002:a05:620a:20d8:b0:792:a265:3cc6 with SMTP id f24-20020a05620a20d800b00792a2653cc6mr1451602qka.33.1715015306912; Mon, 06 May 2024 10:08:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715015306; cv=pass; d=google.com; s=arc-20160816; b=O0pW+YZMG+50RferjG46Rs5JeWfuXyDnXdFX7+p3EbJg7pHu+iFz9fSeqOGJ2ySnNN oqW4Dp2uyR7w5xgldFS0+xL0jeXUk4oda0oPOgcsAa81Vh8EJjHvO59GyXhF517QONtm J1IO/m5W9jZ2Qhev901UzXxKQyixMoadKYW+07CHaDBLVqXJmPJplLDWLNiCYru4DEzU TThMcW0x0qamT2Aqmf6M7fokdzSDqYm4Wd2w+ZsLhNjoX6sxHaDIxANdpiRMPr5yegVu MyCYVzbS67kHh9mp8MWfV6AoQ+QCt34AEYL+RZ7KinJxe/ENtNNnRBoci6veG5t/SFU/ wkxg== 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=ZAZ9QkGBxzY7iwPfBpqZTZwWAo+ByHB9dXBv2mSFh04=; fh=jHjSHPBQnOS3gECwE+nL6a77A0Vu++XxKWf953XJfvI=; b=ftUG8zHZbZT1ZwzjnGBStakZvb178Lo+POFY+V/GI2DPa00Dx3Ynz1ItBvqRDf4BsC FZzno3StxNhNnf3++lK9kcdJ/dmkPi6ChNFpolNRXXWkD0G+QwuIDPGjnOq4tbHAKIZw 893OvYlUX6pOm1knZLTwT8Rs/cF5Ap874NWPMXm1bAG1B7Almz93mMUh42oIzIwniS4C GPLFZaMqVEiqyBoguYvuc9LsYBUQ8DDbHFUrlq0Gy2jwGi+PmEHKL/PBXVZRrPB6/7I8 oP89Lt1vABXVJAORBXIrw1gQ0Yu9BYH6ryE3ygMTpJpHIjx8ZlKXBS7XbjDmAogeIbJ/ NzKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WIwguiRI; 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 i9-20020a05620a404900b0079299819525si2944292qko.560.2024.05.06.10.08.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 10:08:26 -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=WIwguiRI; 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 458253858435 for ; Mon, 6 May 2024 17:08:26 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id EEB603858D1E for ; Mon, 6 May 2024 17:08:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EEB603858D1E 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 EEB603858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715015295; cv=none; b=WSaG3L/0nQIsqcHq0t0CXS4pEBEfVhuLxooJMAIalnvQFvxDO369Rh9icb0TJmqhS18tV1WJDoqmW6yLqnh8QW0Yr+DCW3HCqZtqdffILmXMeUeZJGyJRxyT9Q+oAAk4CmlP5OHPAQKtBSU7k4jaSvbSwGhDvdmzXBH8i/jEEDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715015295; c=relaxed/simple; bh=SQ9oabttxuzumBz7U4PA9Ng9raOZMoTcb9ctKTovg3k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=n9AvvN4McJu5DWYBEW0Vg/YqePOhLrYHH/HYmqa6JUfjpD3/JtEON2/paV67qdH97pM+QUwsCRnI+BFyJ15zTxvZUYigCqxQ/yMs4u+PaqazOlNDF3e8ltL/HNC1j56zDxMRkvvt/R2OGtP82MDIMNfyi0Sm1iq5SGdV5b5eokA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e3ca546d40so16054575ad.3 for ; Mon, 06 May 2024 10:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715015292; x=1715620092; 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=ZAZ9QkGBxzY7iwPfBpqZTZwWAo+ByHB9dXBv2mSFh04=; b=WIwguiRIozSiP5+S/YGAiG/8hbGxWxkIIbzbe754nzUuHGrhrSn0JWWTYHNUMN4Swc 1M4w4XdxUkyEMhu2o+871u2k/2RYTZG9lQUKKhJN68UGtUboCvL5eoTUspqniTvFH16+ loIB7L5pu/wkR4YR7Oadqavm2mubIj+bStuP9BSBetR9M5OFDal8DVXENrFO+NhPptMk Lvk6UIH1LbzPJUd2lG+wjc55377kEuNfiJHCdhu2FGm+5dXnPo/hSzkZ5Pexpk1IuDGX fkQjWr+H39xZ5/hbRPkqk0sFP75Tvbgl2u5W0Lk9wHhT6qiev/Mz0YCNriw6aqxgPz79 OCNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715015292; x=1715620092; 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=ZAZ9QkGBxzY7iwPfBpqZTZwWAo+ByHB9dXBv2mSFh04=; b=WVS3RkLvuKbbGK+SSeFUEW5XEmOrHek2DxgZf5z8cCs7VrNccKQNZxn6eOQMigHm1c Bgc0eMfTrPHxvXvUH1sALp6UZx7UHU1RZ/jIgYvajUScgycxYFgXBp/vPrUb4JqjYNSB O74X+o7Ik/+ISzA+6EKzgdlZoyWsnuuEugDjALzZ+ANh8sJOSOR4L7Qw+aMwLgrQiljn 4JVaASJqeELr5yKBc4E5zqjj4gUq9PH7sva1H42JNJtzCNJhLxZqr8MHIqfrXxHj/I/g e/eebzicpMnBH8KyLrTPj0Tefh7vWD+rwDLQLeN/WxXSCvG8ebWWaF4NL7cXwme2Dx4L oUpw== X-Gm-Message-State: AOJu0Yxy6O5UqM0EzEn0dlTM5029k0Xy2DocYNN7EDE3Gogb8o/INL79 ++r9+xM51NMWtoHWmMGpqfiNn/u17qQCUFDTzRjKT5vfkQcqWNDWBQ50wIO+d+dyPqdAASpaZ47 j4/w= X-Received: by 2002:a17:903:32c9:b0:1e4:9ad5:7537 with SMTP id i9-20020a17090332c900b001e49ad57537mr11035799plr.34.1715015291996; Mon, 06 May 2024 10:08:11 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:6e56:fc45:bb45:8b35:9b81]) by smtp.gmail.com with ESMTPSA id z7-20020a170903018700b001eb2fb28eabsm8446995plg.227.2024.05.06.10.08.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 10:08:11 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Paul E Murphy Subject: [PATCH v2] powerpc: Fix __fesetround_inline_nocheck on POWER9+ (BZ 31682) Date: Mon, 6 May 2024 14:07:59 -0300 Message-ID: <20240506170807.1644139-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 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, 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: Peter Bergner --- 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..84b53d5d3e 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, but it also disable the floating-point + exceptions (bits 56:63 - VE, OE, UE, ZE, XE, NI, and RN). It does + not check if ROUND is a valid value. */ static inline void -__fesetround_inline_nocheck (const int round) +__fesetround_inline_disable_except (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..c053719530 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_except (FE_UPWARD); break; case FLOOR: - __fesetround_inline_nocheck (FE_DOWNWARD); + __fesetround_inline_disable_except (FE_DOWNWARD); break; case TRUNC: case ROUND: - __fesetround_inline_nocheck (FE_TOWARDZERO); + __fesetround_inline_disable_except (FE_TOWARDZERO); break; case NEARBYINT: /* Disable FE_INEXACT exception */