tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

float128 in Clang/x86

float128 is these days needed in Clang/LLVM and it is enabled in
virtually every relevant target (even e.g. Cygwin).

The change to enable it in Clang is tiny:

--- lib/Basic/Targets/OSTargets.h.orig	2019-08-01 08:49:35.000000000 +0000
+++ lib/Basic/Targets/OSTargets.h
@@ -436,12 +436,22 @@ protected:
     if (Opts.POSIXThreads)
+    if (this->HasFloat128)
+      Builder.defineMacro("__FLOAT128__");

   NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
       : OSTargetInfo<Target>(Triple, Opts) {
     this->MCountName = "__mcount";
+    switch (Triple.getArch()) {
+    default:
+      break;
+    case llvm::Triple::x86:
+    case llvm::Triple::x86_64:
+      this->HasFloat128 = true;
+      break;
+    }

We enabled the float128 option in Clang from pkgsrc back 2018:

 clang: enable __float128 on netbsd/x86

While it is debatable whether we want to have this definition upstream,
this is very necessary in the package for the purpose of building
www/firefox once it is updated to 63.0.

This is because netbsd's base libstdc++ has some __float128 in headers
and otherwise we get fatal errors in clang builds, or in firefox's case,
when generating bindings for Rust via clang.

PR toolchain/53679

There were claims from Joerg that __float128 is unsupported in compiler-rt.

I don't understand what is exactly problematic here. Insisting on lack
of float128  causes mismatch in features between LLVM platforms for
unknown to me reasons. If there is need to pick __float128 functions,
why not to pick float128 support just as-is from  Berkeley SoftFLoat 3 ( )? We already import
softfloat code in our distribution.

What is the proper procedure to enable float128 by default in Clang and
finally sort out this shortage?

Personally, I want to enable float128 for x86 in Clang-10.x that will be
branched in ~10 days.

Attachment: signature.asc
Description: OpenPGP digital signature

Home | Main Index | Thread Index | Old Index