Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2026 10:22:30 +0200
From:      Piotr Kubaj <pkubaj@freebsd.org>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        freebsd-ppc@freebsd.org
Subject:   Re: Proposal to switch powerpc64le to IEEE-754 binary128
Message-ID:  <aipwRlW1k4QBiDtp@talos-powerpc64le>
In-Reply-To: <CAJ-VmonbXXpq4TBZ38idRPVHM1h%2BSFChvyr3DhVjHkVeaw9KjA@mail.gmail.com>
References:  <ah8sFn_mmGrJp9Ru@talos-powerpc64le> <CAJ-VmonbXXpq4TBZ38idRPVHM1h%2BSFChvyr3DhVjHkVeaw9KjA@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On 26-06-10 18:53:11, Adrian Chadd wrote:
> So, a few of us chatted in IRC about it.
> 
> * The minimum for PPC64LE was POWER7 anyway, right?
POWER8. Last I heard, POWER7 has issues with unaligned access, which is
vital on LE. All the toolchains assume POWER8 as given on ppc64le.
> * There's no easy way to deal with this in library versioning and
> such, so we should just rip the bandaid off
> * We can fix the ports as they come up.
Yes, and there's not much to fix. The good news is that reinstallation
won't be necessary, upgrade is just the usual buildworld + installworld.
> * people wishing to run stuff built on -15 or earlier should just run
> a userland jail.
> 
> so given that!
> 
> * Please include something to propose to put in UPDATING
The review at https://reviews.freebsd.org/D57388 includes UPDATING
entry.
> * Please explain what will happen with all the toolchains in -HEAD (eg
> all the gcc versions will use the right base type, we won't have gcc
> compiling a different ABI to llvm21, etc)
Compilers explicitly using C's long double will need updating.
Everything else will work as it is. I have tested bootstraps for Rust,
GHC, OpenJDK and SBCL - all of them work. GCC and LLVM will need to be
updated though to emit correct long double, otherwise code built with
them that also uses long double type will misbehave. I'm also currently
playing with ldc and it will also need to be updated.
> * Let's figure out when the flag day should be.
Since it's CURRENT, people should expect breakages, we can't provide
stability there. IMO it's better to do it sooner than later so that more
people can test it. If someone doesn't want to upgrade yet, we're not
Microsoft, we don't force upgrades.
> 
> 
> 
> -adrian
> 
> On Tue, 2 Jun 2026 at 13:04, Piotr Kubaj <pkubaj@freebsd.org> wrote:
> >
> > Hello,
> >
> > as you may know, FreeBSD currently uses 64-bit long double. Since plain
> > double is also 64-bit, long double actually gives no advantage over
> > double and is actually the same type.
> >
> > However, we can do better, at least on powerpc64le. On Linux with glibc,
> > many distros have already switched to IEEE-754 binary128, which is
> > 128-bit long double. On FreeBSD, aarch64 and riscv64 already use 128-bit
> > long double.
> > Apart from the arguments "others do it", 128-bit long double provides
> > obviously better precision - it's analogous to float vs double.
> > Operations on long doubles are also slower and variables take twice as
> > much memory, but that's expected of bigger types.
> >
> > Upgrades are another issue: LLVM uses different functions for operations
> > on 64-bit long doubles and on binary128. This means that after upgrades,
> > software using long doubles will need to be rebuilt. Otherwise, there's
> > a risk of strange issues. I have verified that bootstraps for all the
> > major languages work fine (rust, ghc, sbcl, openjdk), but I assume that
> > some scientific software may have issues.
> >
> > The current patchset is at: https://reviews.freebsd.org/D57388
> >
> > Some ports will probably also need to be patched, but that's another
> > issue.
> >
> > If you have some spare system for testing, I recommend a try and a
> > report, straight "make buildworld installworld" is expected to work.
> >
> > I have a powerpc64le VM where it works:
> > root@ieeeldbl:~ # echo | cc -dM -E - | grep LDBL
> > #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
> > #define __LDBL_DECIMAL_DIG__ 36
> > #define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L
> > #define __LDBL_DIG__ 33
> > #define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L
> > #define __LDBL_HAS_DENORM__ 1
> > #define __LDBL_HAS_INFINITY__ 1
> > #define __LDBL_HAS_QUIET_NAN__ 1
> > #define __LDBL_MANT_DIG__ 113
> > #define __LDBL_MAX_10_EXP__ 4932
> > #define __LDBL_MAX_EXP__ 16384
> > #define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L
> > #define __LDBL_MIN_10_EXP__ (-4931)
> > #define __LDBL_MIN_EXP__ (-16381)
> > #define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
> > #define __LDBL_NORM_MAX__ 1.18973149535723176508575932662800702e+4932L
> >
> > On a system with the current default, 64-bit long double, the following
> > will be reported:
> > root@blackbird:~ # echo | cc -dM -E - | grep LDBL
> > #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
> > #define __LDBL_DECIMAL_DIG__ 17
> > #define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
> > #define __LDBL_DIG__ 15
> > #define __LDBL_EPSILON__ 2.2204460492503131e-16L
> > #define __LDBL_HAS_DENORM__ 1
> > #define __LDBL_HAS_INFINITY__ 1
> > #define __LDBL_HAS_QUIET_NAN__ 1
> > #define __LDBL_MANT_DIG__ 53
> > #define __LDBL_MAX_10_EXP__ 308
> > #define __LDBL_MAX_EXP__ 1024
> > #define __LDBL_MAX__ 1.7976931348623157e+308L
> > #define __LDBL_MIN_10_EXP__ (-307)
> > #define __LDBL_MIN_EXP__ (-1021)
> > #define __LDBL_MIN__ 2.2250738585072014e-308L
> > #define __LDBL_NORM_MAX__ 1.7976931348623157e+308L

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----

iQJPBAABCAA5FiEEycyIeNkkgohzsoorelmbhSCDnJ0FAmoqcEYbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMCwyAAoJEHpZm4Ugg5ydkMoP/R695APRsIYELdbywEA3
6xAdY0BfIxzG+iFDRoKlvuNUWaRqX/riujTTmdZbyYIWtLi9OZmKivU+HscAEO6D
GLjjJ8mKYeFX36s+oiCddgTKsN+4Xl7ptcx7DodAhwZXEhzApGBromV4CqVg14kP
aFxXpO5f+g1+aR79YHFRjdZf68ie95VG82p10AH48drOWjVt4drLSJa/qLuCsYCz
u/3feZvxqVShlt5i/xGZcWYKyrQgtEa/8ntzqmmKWJNKoxwUl02vsIVOQz8tiCXU
dj0K4u0/9vqzKtnfRwPFjRLPh4bIjNQk8C9giLY/SNF9J825dreO1fKuTK8LvWDf
J5JHDXzRhrIsJdTSr+SoogUgNDfvnllqwdJzc7YGPta79tNf4YvS40NFD3VtP/SI
GQ7BWFhwOWXxlKrmRXkFNlZ+JrMU0EJLPHq18VsgSjwagwcAZNO1wIvkPNgoPcXy
khn2vE4YI+T8gmi9WyHaAPD4qMKWpOfEzdxmVMNIoKq3WjrUEg6bKR4tAPyqRtRI
loQOr8nhn3LuwNK+5ZMhQ8Y4ROcoOdAcbx6k9nzI86X1vZ9QwqTd+5vcCZVzunmB
iemid57PW2Qzm5hHDvuv0LD3VcA+L/i22dHENLaDW0PgxKAjQZYuWRBPw8wWFNcR
bI2M+n/7z5zr2yxxQWYtW2fZ
=1PSa
-----END PGP SIGNATURE-----
home | help

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