On 12.03.2025 13:45, Martin Storsjö wrote:
On Wed, 12 Mar 2025, Jacek Caban wrote:
These files are already in a target-specific directory, and it's the
build
system's job to include them only for applicable targets.
This also allows their use for ARM64EC.
---
mingw-w64-crt/math/arm-common/acoshl.c | 4 ----
mingw-w64-crt/math/arm-common/asinhl.c | 4 ----
mingw-w64-crt/math/arm-common/atanhl.c | 4 ----
mingw-w64-crt/math/arm-common/expm1l.c | 4 ----
mingw-w64-crt/math/arm-common/ilogbl.c | 4 ----
mingw-w64-crt/math/arm-common/ldexpl.c | 4 ----
mingw-w64-crt/math/arm-common/log1pl.c | 4 ----
mingw-w64-crt/math/arm-common/log2.c | 4 ----
mingw-w64-crt/math/arm-common/logbl.c | 4 ----
mingw-w64-crt/math/arm-common/powl.c | 4 ----
mingw-w64-crt/math/arm-common/remainderl.c | 4 ----
mingw-w64-crt/math/arm-common/remquol.c | 4 ----
mingw-w64-crt/math/arm-common/scalbn.c | 8 --------
13 files changed, 56 deletions(-)
diff --git a/mingw-w64-crt/math/arm-common/acoshl.c
b/mingw-w64-crt/math/arm-common/acoshl.c
index c2157bebc..451926e3b 100644
--- a/mingw-w64-crt/math/arm-common/acoshl.c
+++ b/mingw-w64-crt/math/arm-common/acoshl.c
@@ -8,9 +8,5 @@
long double acoshl(long double x)
{
-#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) ||
defined(_ARM64_)
return acosh(x);
-#else
-#error Not supported on your platform yet
-#endif
}
While we are in an architecture specific directory, this kind of
#error is somewhat nice to make sure one doesn't accidentally use this
kind of code if we're building it in an unexpected configuration. (To
be honest, there's a huge number of various scattered math functions,
and if building in various test configuratons it's not very easy to
make sure that all functions really are covered.)
But for arm64ec, we could change these ifdefs into "#if
__SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__" then we should pick the
same existing codepath for now. (And if the arm64ec environment gets
80 bit long doubles in the future, it should make it clear that these
codepaths no longer are suitable as such.)
What do you think?
Sorry, but I don’t agree. This approach complicates things for
questionable reasons. In general, it’s better to keep things simple and
avoid duplicating logic. In this case, the logic is already in
Makefile.am, where it’s easy to adjust and maintain. The #if checks just
duplicate that logic and obscure the code. Instead of having everything
in one place, the logic gets scattered across multiple files.
It’s also inconsistent. Some files in arm-common have these checks,
while others don’t. Should we add them to every single file? Should we
then add similar checks to every .c file in the tree to verify the
architecture, forcing anyone porting to a new architecture to go through
them all?
ARM64EC is a good example of why these checks are counterproductive. The
code is already clean, simple, and portable. It doesn’t require any
functional changes. Yet, these unnecessary checks force revisiting every
affected file.
The hypothetical ARM64EC 80-bit long double support is another
counterexample. If someone adds support for it to the compiler, the
existing mingw-w64-crt could still work out of the box using implicit
casts. Of course, for full support one would need to improve the
precision, but for that `git grep "long double" -- math/arm-common/`
seems easy enough.
Thanks,
Jacek
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public