From patchwork Tue Jan 16 15:16:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Cederman X-Patchwork-Id: 84187 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 19360385841B for ; Tue, 16 Jan 2024 15:17:15 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtp-out3.simply.com (smtp-out3.simply.com [94.231.106.210]) by sourceware.org (Postfix) with ESMTPS id C83B13858D20 for ; Tue, 16 Jan 2024 15:16:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C83B13858D20 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=gaisler.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gaisler.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C83B13858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=94.231.106.210 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705418207; cv=none; b=bdmmX/Gxc06fd1QPkZ9E4shtvI4bEPBD69YLSBaSByyZmg2Hdtc5fTxrkP5CE/hmFhvR1wftfFf/XiTzOlk5KKg9P8n2yRjDmc65WqqFo379uQQHv6NgdLjyJsX+HurAhj/hGzbCSht/HxqJdfs7T/zdtAEqP56jw5nuRn5u/wQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705418207; c=relaxed/simple; bh=zh0sGkPeis9pEr9Z/37HDPkHA0ZPXmq0aQIZUTbeKqc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=IGyh5zhsbfCl2rOPj+RkDTaUt5OIiuHAvxdq84LIpaeSrvBM0YVOI+HVWCwk011bPQ0Z8plilaS5VvyToB/GccSwYb6UnS1GiZ18cOgNY9Xq0KNQjt9evP7rEdMVDh10wm+Sw/0KUS/CRKpuXQ1JWzD1himCpIYbI+wh7U4NKAo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by smtp.simply.com (Simply.com) with ESMTP id 4TDszw6K6Gz67xZ; Tue, 16 Jan 2024 16:16:44 +0100 (CET) Received: from cederman.got.gaisler.com (h-98-128-223-123.NA.cust.bahnhof.se [98.128.223.123]) by smtp.simply.com (Simply.com) with ESMTPA id 4TDszw4wCFz67y3; Tue, 16 Jan 2024 16:16:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaisler.com; s=unoeuro; t=1705418204; bh=hWnZh4Iv4Q8PUHKci43Izd3QfqIa4F2Xs0GMQvDYzUk=; h=From:To:Cc:Subject:Date; b=PAX1E52qQd3MXnTw3XduNyDYh6OsX8t4YzcQw46VOAlMjb/HoKK3IwzHW5b/6NlPW 5eTsJh4rwl2NR4xE4f2vFzjuB+mTqMxJCzG01M5ffbnSFufWXzpRsiuY1njGM4gWxg ILTJmQ8GS1luaUnT+DvU9sCYXBbdBDK6+VeC3Fpw= From: Daniel Cederman To: libc-alpha@sourceware.org Cc: daniel@gaisler.com, andreas@gaisler.com Subject: [PATCH v3] sparc: Force calculation that raises exception Date: Tue, 16 Jan 2024 16:16:41 +0100 Message-Id: <20240116151641.3583965-1-cederman@gaisler.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, 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+patchwork=sourceware.org@sourceware.org Use the math_force_eval() macro to force the calculation to complete and raise the exception. With this change the math/test-fenv test pass. Signed-off-by: Daniel Cederman Reviewed-by: Adhemerval Zanella --- sysdeps/sparc/fpu/fraiseexcpt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sysdeps/sparc/fpu/fraiseexcpt.c b/sysdeps/sparc/fpu/fraiseexcpt.c index 26a7720ec9..642666c12a 100644 --- a/sysdeps/sparc/fpu/fraiseexcpt.c +++ b/sysdeps/sparc/fpu/fraiseexcpt.c @@ -20,6 +20,7 @@ #include #include #include +#include int __feraiseexcept (int excepts) @@ -42,7 +43,7 @@ __feraiseexcept (int excepts) /* One example of an invalid operation is 0/0. */ __asm ("" : "=e" (d) : "0" (c.zero)); d /= c.zero; - __asm __volatile ("" : : "e" (d)); + math_force_eval (d); } /* Next: division by zero. */ @@ -50,7 +51,7 @@ __feraiseexcept (int excepts) { __asm ("" : "=e" (d) : "0" (c.one)); d /= c.zero; - __asm __volatile ("" : : "e" (d)); + math_force_eval (d); } /* Next: overflow. */ @@ -58,7 +59,7 @@ __feraiseexcept (int excepts) { __asm ("" : "=e" (d) : "0" (c.max)); d *= d; - __asm __volatile ("" : : "e" (d)); + math_force_eval (d); } /* Next: underflow. */ @@ -66,7 +67,7 @@ __feraiseexcept (int excepts) { __asm ("" : "=e" (d) : "0" (c.min)); d *= d; - __asm __volatile ("" : : "e" (d)); + math_force_eval (d); } /* Last: inexact. */ @@ -74,7 +75,7 @@ __feraiseexcept (int excepts) { __asm ("" : "=e" (d) : "0" (c.one)); d /= c.pi; - __asm __volatile ("" : : "e" (d)); + math_force_eval (d); } /* Success. */