From owner-freebsd-hackers@freebsd.org Sat May 25 21:31:02 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 483CE15B6C12 for ; Sat, 25 May 2019 21:31:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA2F48A00C; Sat, 25 May 2019 21:31:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 686D415988; Sat, 25 May 2019 21:31:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::d4d0:df7c:8e17:8c8f] (unknown [IPv6:2001:470:7a58:0:d4d0:df7c:8e17:8c8f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id D053C3D856; Sat, 25 May 2019 23:30:58 +0200 (CEST) From: Dimitry Andric Message-Id: <3E0ACABC-D17B-45AD-9810-06ADA52F597A@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_76C08A40-D0CB-4F7E-8593-DEE4D48C7C96"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: What is the portable 128-bit floating point type? Date: Sat, 25 May 2019 23:30:58 +0200 In-Reply-To: <20190525210311.GW2748@kib.kiev.ua> Cc: Yuri , Freebsd hackers list To: Konstantin Belousov References: <20190525200437.GV2748@kib.kiev.ua> <20190525210311.GW2748@kib.kiev.ua> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: DA2F48A00C X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-1.00)[-0.995,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 21:31:02 -0000 --Apple-Mail=_76C08A40-D0CB-4F7E-8593-DEE4D48C7C96 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 25 May 2019, at 23:03, Konstantin Belousov wrote: > > On Sat, May 25, 2019 at 01:50:24PM -0700, Yuri wrote: >> On 2019-05-25 13:04, Konstantin Belousov wrote: >>> Neither i386 nor amd64 have hardware-supported 128 bit floating point >>> type. long double is defined by both i386 and amd64 Unix ABI as 80 bits >>> (10 bytes) representation as defined by IEEEE FP standard and supported >>> by x87 FPU (not-SSE). The difference in size is due to the different >>> natural alignment between 32 and 64 bit ISA. >> >> >> So it looks like there is no true quad-precision float available. >> >> >> Based on this conversation https://github.com/bluescarni/mppp/issues/186 >> FreeBSD used to support __float128. Why was it removed? > No idea, it seems to be clang-specific. gcc 8.3 does accept the type. Gcc appears to support __float128 since ~2007, roughly from gcc 4.3 onwards: https://gcc.gnu.org/onlinedocs/gcc-4.3.6/gcc/Floating-Types.html There it says "__float128 is supported on x86_64 and ia64 targets", but in the most recent version: https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html it says "__float128 is available on i386, x86_64, IA-64, and hppa HP-UX, as well as on PowerPC GNU/Linux targets that enable the vector scalar (VSX) instruction set". Of course it is also dependent on libgcc, if the hardware does not have native support for this float width. Clang modeled its support on gcc's example, and similarly the library support is in compiler-rt, at least for x86_64 and some other architectures. But from clang's OSTargets.h file, it looks like 128 bit float support is never set to enabled for FreeBSD. > On the other hand, I have no idea if any support is required from > libgcc (probably it is), and we almost certainly do not have it in > the base library. In libcompiler_rt, it's only enabled for aarch64 and riscv: # # 128-bit quad precision long double support, # only used on some architectures. # .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "riscv" SRCF+= addtf3 SRCF+= comparetf2 SRCF+= divtf3 SRCF+= extenddftf2 SRCF+= extendsftf2 SRCF+= fixtfdi SRCF+= fixtfsi SRCF+= fixtfti SRCF+= fixunstfdi SRCF+= fixunstfsi SRCF+= fixunstfti SRCF+= floatunsitf SRCF+= multf3 SRCF+= subtf3 SRCF+= trunctfdf2 SRCF+= trunctfsf2 .endif -Dimitry --Apple-Mail=_76C08A40-D0CB-4F7E-8593-DEE4D48C7C96 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXOm0EgAKCRCwXqMKLiCW o4a1AJ9HVVGYB4jFtcx7dFBQEacl1MEFVACfV2kgGQgBotHOCDHsvhCZEiwBDcs= =zsnN -----END PGP SIGNATURE----- --Apple-Mail=_76C08A40-D0CB-4F7E-8593-DEE4D48C7C96--