From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fW+FC3iTTlA7A76+" 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 List-Id: --fW+FC3iTTlA7A76+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 ;; --fW+FC3iTTlA7A76+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEnRzl+6e9+DTrEhyEXb/Nrl8ZTfEFAmW+YXEACgkQXb/Nrl8Z TfGwwA//cLaKiw1wKMaSEIT4WFJNsV8IpKXcXLKxHp9GiA75OjAhzHzKc+scrW+o 0+Z8Dyv4hTARRarqzAHXqUDsp66ZBPdXXQx8kZgtRXcvxT7e80HKtpVrVeJtj1C3 kMQ0+LvINBZEz65LTNCmuanmwYOdOs8oXuEdYbo3gDi1fGrwAAarZa+Pf7w6Lync o2H0atDdCy5dMZIGL0vJ9bsqfJj7rS5mBjWCiq1QhQ3vzoSrhvNtDj7OO63oK79y D5U6wZPtd7jEBDNlZwq8po+ZVLZ51TZztE25nFtpEsaNGlzA1VP1ziiJAtSjr1xC LHilS8R9LJhmFt5N6zgA17vJRVEZoONYC83Ma1s3+8SwRFV4PU8rYU8EjTHP0rIE 9mohVXEWCUlk8nPNtEF14BVQZ9NcnTuX3usAc8RqKb1IzCr7gjqHr7JnZIk/owgQ Xnc0PJUSj4/ecxz6YPtWv9GOccXTXt+4fsE6G8Lkg353EhID7is5IuAV3gx1+iew yn3r1eyquOu0ZEh5Jm9aA7HWUZc6RFfbclqKqXlOS5TdaDYYq70OY8DyDC9c4aVB 4D2g1usAjSzPhkB0kBEBZPj+noqH2E26/aoA8S/S4qKHvfug6HJFzNZ0imvHZirw 44HK+GMcYLMFopI/C4/nQfkwBMbnW6SZG6ixvpn1Jrosd8C7guM= =ugBH -----END PGP SIGNATURE----- --fW+FC3iTTlA7A76+--