From patchwork Sat Feb 3 15:53:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 196333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp1082112dyc; Sat, 3 Feb 2024 07:54:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0DZmE15dfZXQ3T5hYPfmS/5hiSTi5+0So9agvOxrnjm/1y9wyCBqPA3xrjnSGuVVhR/a/ X-Received: by 2002:a05:622a:1983:b0:42a:cdb9:5d82 with SMTP id u3-20020a05622a198300b0042acdb95d82mr2577398qtc.5.1706975660146; Sat, 03 Feb 2024 07:54:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706975660; cv=pass; d=google.com; s=arc-20160816; b=xGreVMcVRYPHUevuMmFzYJ2M77Y+A7tPJtzS/fEpZXeKO0I+7LMZ63cal7mp1QDrCJ rcHqCogn8TfvSNMZb5QRthHuOpponr4X70eV9GeKrR3FDqxLa8xdiawkzBVFS50abPqa xri7B6XrUZ1SA0fnXhd8FA8hAAeCDe9WQQp2Bw3xpBCxzGWfb7wiBFL47i0XISqYDfAd EGzeO+dNGQZla4OhE/4K9oMdOIqAK7jerXu2k2em2T1hqaqHMsI3SYDnyx3Ek+NPQEwr aH4Ckjdn/xH+ulWQgs148XcWboy7+YhyCOPybcwrwTsF6dYf3HOlSQtap6u3IxYiuDWV xQ6w== 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-disposition :mime-version:message-id:subject:to:from:date:arc-filter :dmarc-filter:delivered-to; bh=29PwogxD1sHqJj+wV4ZUaLAPTDJfIYzN66BqYkMcQvs=; fh=Fiis+JkZSq+MskZaV84qta/jq0r91iFMsGYIAxF5vXQ=; b=UdTsvdReBE0UEhPwI876sJ/QiEOi5YFOJKDxVvOOSE60DxZclB5txkQZLgxrt7uUHC r3t/bwOJwziQ8/djgYtvw6TkclRYRS7n8+eaTOpzxXu2blrVXCtpmIT1y+dX0VzYxqIe gffW3wbwfLli/8PG7527biHHX7HsCcOZvxuipcFRBgTmK8MDBVIKFTBsFs0mLTbvO6K3 52Lz7gyVf3u0pK2PNjCGz7V80m6QCTybjyV0CFN/pxIGZjVnEk0bp7VxgEX4Y++grdD5 o8T+jmOdcAbf8Xu1j/6EGidEwIcpOXVNgVldF33G9ZmI0KL4prLSlqHnjoLIX9YSsSbd ATWQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" X-Forwarded-Encrypted: i=1; AJvYcCW22ABYGH/kdDT5Xw5LoOLNcu1zsKV9s8XvLBnx6LZThCyudKgck/kXysvTQsoWho1HR2Ys493m9Cyw0wvtyWA33dAuEg== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id t22-20020a05622a149600b0042bf155a436si4591644qtx.522.2024.02.03.07.54.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 07:54:20 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D6DBA3857B83 for ; Sat, 3 Feb 2024 15:54:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from dellerweb.de (unknown [IPv6:2a02:c207:3003:236::1]) by sourceware.org (Postfix) with ESMTPS id 129A3385840E for ; Sat, 3 Feb 2024 15:53:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 129A3385840E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=parisc-linux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=parisc-linux.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 129A3385840E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a02:c207:3003:236::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706975621; cv=none; b=M5GDoypl0oCFl+iDLfRrIGLFpDBNKchm5k/S5jVzk+nzuV8vV8j7sSYje4NXAviaI3B065jUaTdMP89VVlv9mg8saOMSxfgXRSs8SFOfwiHW788a4z6sCnSMVKILcOsXFbv7pJPrt/mgQt9SVKMWKCwtD3PAb7NC3gl3OZVEzm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706975621; c=relaxed/simple; bh=LLbVmSc6J/zj1fyirBt4lOJpOz9ErwYPSjQEgn/exM8=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=G8YSbLeVgHZ/7KKK9VO84qH6krzkUQdzlWVhulG45YaKvyfKGTtYf6i3bnEbWN0ZA1IIGIV8UGbIlcNlxGRIPuOR+QIpWoBsWEcUb/S2CbOJfPE0GXo/9RCbS6Fhtg5shPAZsdvesNWMZb7q9Joe/EuXE+DJVuQc18qMg4aai18= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mx3210.localdomain (unknown [142.126.114.79]) by dellerweb.de (Postfix) with ESMTPSA id 3302116000F8; Sat, 3 Feb 2024 16:53:37 +0100 (CET) Received: by mx3210.localdomain (Postfix, from userid 1000) id 36E6D22012D; Sat, 3 Feb 2024 15:53:34 +0000 (UTC) Date: Sat, 3 Feb 2024 15:53:33 +0000 From: John David Anglin To: GCC Patches Subject: [committed] libatomic: Provide FPU exception defines for hppa Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789893709901940019 X-GMAIL-MSGID: 1789893709901940019 Tested on hppa64-hp-hpux11.11. Committed to trunk. Dave --- libatomic: Provide FPU exception defines for hppa The exception defines in do not match the exception bits in the FPU status register on hppa-linux and hppa64-hpux11.11. On linux, they match the trap enable bits. On 64-bit hpux, they match the exception bits for IA64. The IA64 bits are in a different order and location than HPPA. HP uses table look ups to reorder the bits in code to test and raise exceptions. All the architectures that I looked at just pass the FPU status register to __atomic_feraiseexcept(). The simplest approach for hppa is to define FE_INEXACT, etc, to match the status register and not include . 2024-02-03 John David Anglin libatomic/ChangeLog: PR target/59778 * configure.tgt (hppa*): Set ARCH. * config/pa/fenv.c: New file. diff --git a/libatomic/config/pa/fenv.c b/libatomic/config/pa/fenv.c new file mode 100644 index 00000000000..232e8416ffd --- /dev/null +++ b/libatomic/config/pa/fenv.c @@ -0,0 +1,74 @@ +/* Copyright (C) 2012-2024 Free Software Foundation, Inc. + + This file is part of the GNU Atomic Library (libatomic). + + Libatomic is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Libatomic 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 General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#include "libatomic_i.h" + +#define FE_INEXACT (1<<27) +#define FE_UNDERFLOW (1<<28) +#define FE_OVERFLOW (1<<29) +#define FE_DIVBYZERO (1<<30) +#define FE_INVALID (1<<31) + +/* Raise the supported floating-point exceptions from EXCEPTS. Other + bits in EXCEPTS are ignored. */ + +void +__atomic_feraiseexcept (int excepts __attribute__ ((unused))) +{ + volatile float r __attribute__ ((unused)); +#ifdef FE_INVALID + if (excepts & FE_INVALID) + { + volatile float zero = 0.0f; + r = zero / zero; + } +#endif +#ifdef FE_DIVBYZERO + if (excepts & FE_DIVBYZERO) + { + volatile float zero = 0.0f; + r = 1.0f / zero; + } +#endif +#ifdef FE_OVERFLOW + if (excepts & FE_OVERFLOW) + { + volatile float max = __FLT_MAX__; + r = max * max; + } +#endif +#ifdef FE_UNDERFLOW + if (excepts & FE_UNDERFLOW) + { + volatile float min = __FLT_MIN__; + r = min * min; + } +#endif +#ifdef FE_INEXACT + if (excepts & FE_INEXACT) + { + volatile float three = 3.0f; + r = 1.0f / three; + } +#endif +} diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt index 67a5f2dff80..4237f283fe4 100644 --- a/libatomic/configure.tgt +++ b/libatomic/configure.tgt @@ -36,6 +36,7 @@ case "${target_cpu}" in XCFLAGS="${XCFLAGS} -mfp-trap-mode=sui" ARCH=alpha ;; + hppa*) ARCH=pa ;; rs6000 | powerpc*) ARCH=powerpc ;; riscv*) ARCH=riscv ;; sh*) ARCH=sh ;;