This is a followup of D128571, which enables the new ABI for Darwin runtimes.
The change should be covered by extendhfsf2_test.c, truncdfhf2_test.c and truncsfhf2_test.c. No new tests needed.
Differential D128872
[compiler-rt] Enable the new ABI of `_Float16` for Darwin on X86 pengfei on Jun 29 2022, 8:20 PM. Authored by
Details This is a followup of D128571, which enables the new ABI for Darwin runtimes. The change should be covered by extendhfsf2_test.c, truncdfhf2_test.c and truncsfhf2_test.c. No new tests needed.
Diff Detail
Event Timeline
Comment Actions Sink the enablement into darwin_add_builtin_libraries.
Comment Actions An Apple reviewer shall review this. I can only confirm that the reduced complexity in CMake makes me happy:) Comment Actions I checked this on my arm64 mac:
Comment Actions Can someone describe what the actual problem is? I don't know what the "new ABI" is supposed to be and why Darwin is apparently incompatible with it, and nothing in the linked commit suggests it has OS dependencies. I hope we're not doing something in the _Float16 ABI that would cause incompatibilities between a translation unit compiled with SSE2 only and one compiled with AVX512-FP16. If so, we need to disable SSE2 _Float16 support immediately and fix that, because that is not acceptable. Comment Actions Okay, I've had this explained to me elsewhere. Darwin relies on having the soft FP16 promotion/truncation support available in compiler-rt to support __fp16, which we support on a broader set of targets than _Float16 is enabled for. So I believe Darwin should continue to use the soft ABI for those functions. __fp16 is a storage-only format, and so we do not need to support arithmetic operations on it. That is important because we presumably do need compiler-rt support for certain kinds of arithmetic on _Complex _Float16, and that support should presumably use the hard ABI. I don't know if compiler-rt is set up to configure those functions differently from the promotion/truncation functions. Comment Actions Agree that the problem is very unclear. I just know that GCC made a change on 2021-09-01 that -msse2 enables using _Float16 in C/C++. Neither D128571 nor D128872 clearly states the motivation and the problem and how compatibility issues are addressed. I accepted D128571 with some discomfort that the problem was not well explained (I clicked accept more because others accepted). Comment Actions Thanks @benlangmuir for checking it!
Yes. The series of patches are used to be compatible with GCC. GCC12 has enable _Float16 for -msse2 and up. Before these patches, Clang only enables _Float16 on -mavx512fp16.
Hope I addressed all your questions. Thanks! Comment Actions Ping. Just found I didn't post my reply to @benlangmuir
Comment Actions Ping. Feel free to add Apple reviewer if you happen to know :)
|
${arch} isn't defined here. If we want this for all architectures on Darwin, we could remove the if. If we still want to restrict it to specific arches, this check can move to darwin_add_builtin_library and it can match against ${LIB_ARCH}.