Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Oct 2022 18:43:10 +0000
From:      Brooks Davis <brooks@freebsd.org>
To:        freebsd-arch@freebsd.org
Subject:   enabling float128 support in clang?
Message-ID:  <20221003184310.GA20951@spindle.one-eyed-alien.net>

next in thread | raw e-mail | index | archive | help

--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

TL;DR: Is there a reason not to enable float128 support in clang for
x86?

Due to a build breakage with the flang runtime, I recently noticed that=20
unlike most other OSes we don't support float128 in clang.  It's enable
in modern GCC and other OSes have it enable in clang:
 - Hakiu 2018: https://reviews.llvm.org/D54901
 - Solaris 2018: https://reviews.llvm.org/D41240
 - WASM 2019: https://reviews.llvm.org/D57154
 - Dragonfly 2021: https://reviews.llvm.org/D111760
 - OpenBSD (history hard to find...)

Is there a known reason not to enable this?

Patch to enable below (I'm a bit skeptical of the __FLOAT128__ part as
GCC doesn't define it...)

-- Brooks

diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/=
OSTargets.h
index c75f7d9fbafe..ea95f40e81a0 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -232,6 +232,9 @@ protected:
     // setting this to 1 is conforming even if all the basic source
     // character literals have the same encoding as char and wchar_t.
     Builder.defineMacro("__STDC_MB_MIGHT_NEQ_WC__", "1");
+
+    if (this->HasFloat128)
+      Builder.defineMacro("__FLOAT128__");
   }
=20
 public:
@@ -241,6 +244,7 @@ public:
     default:
     case llvm::Triple::x86:
     case llvm::Triple::x86_64:
+      this->HasFloat128 =3D true;
       this->MCountName =3D ".mcount";
       break;
     case llvm::Triple::mips:


--k1lZvvs/B4yU6o8G
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQEcBAEBAgAGBQJjOy09AAoJEKzQXbSebgfAntkH/2+tGDC6GKQclxKHY+712v4F
OeSKHWdYh6A5qrQU0E/5pvJx4UoJ3fwffgJF3vdMzy822pN2ti/H1Ohf8W4ywETK
kTNDpgUrhecPFozpBnC9LQYWAXO4tBlBXZ7xL1b2LLFVz3UZSJRGv3v//+fHZ05u
SMv2HvMK2mEOzXZGqqVQ9TWgx8YXlxst5fFjU6K2QZX8vkRqzSHW8F7achI+/ddh
hCp22I1OA/ikTHMjz+s0WCi953LEtRBz+t30jJWP9kMIi+irbYkbwYrLkOHWIpt4
kzpte4AsVJMhTHUb71FTRbTMtbdTsgpuoH6t+Y4IdLYAbnaZ+7G7KSr67k0QVyc=
=kJOs
-----END PGP SIGNATURE-----

--k1lZvvs/B4yU6o8G--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20221003184310.GA20951>