Does that the clang on M1 MacBook support for 128bit long double float? There is a option named “-mlong-double-128” but when using it, it gives such a error report:
clang: error: unsupported option ‘-mlong-double-128’ for target ‘arm64-apple-macosx12.0.0’
Does anyone encounter the same problem? Does anyone know how to solve this problem?
clang/test/Driver/mlong-double-128.c this is not supported for plain aarch64 with upstream clang.
Plus Apple Developer Documentation says that
long double is identical to
double (which it doesn’t say the size of directly but I assume 64 bits).
So it’s likely that even if upstream clang supported it, appleclang would not because it would break the ABI for that platform. Though if you control the whole application it could be made to work I suppose.
Do you have a specific use case? That will tell us whether “solving the problem” is removing a compiler flag, or doing a whole lot of changes to clang.
Thank you David, for replying. Yes it is, the size of long double is the same with that of double float on the new aarch64 MacBooks.
Basically I’m writing and compiling c programs for scientific computing which need 128 bit long double float for the required high precision, and these work well on the my old X86 MacBook. I’m not clear why’s that the new ABI does not allow the 128bit long double float while these old X86 MacBooks support.
Going to require an Apple expert to answer that one I’m afraid. Perhaps you would be better off with one of Apple’s own developer channels?
I did check what Linux does and it follows the Base Architecture ABI (abi-aa/aapcs64.rst at main · ARM-software/abi-aa · GitHub) where long double is 128 bit.
Tried this out on godbolt: Compiler Explorer to confirm.
What’s interesting is that on Linux AArch64 the option is unsupported even though it does use 128 bit long double. Maybe the option means “if the platform has a choice of long double sizes, use 128”, and AArch64 Linux just has the one size.