This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][builtins][RISCV] Set COMPILER_RT_HAS_FLOAT16 for RISC-V compiler-rt tests, fixes test__extendhfsf2
ClosedPublic

Authored by luismarques on Jul 9 2022, 5:31 PM.

Details

Summary

Since D92241, compiler-rt/cmake/builtin-config-ix.cmake automatically tests the host compiler for support of _Float16 and conditionally defines COMPILER_RT_HAS_FLOAT16. That defines the macro while the compiler-rt builtins are being built. To also define it during the compiler-rt test runs requires whitelisting the architecture in compiler-rt/test/builtins/CMakeLists.txt, as done in this patch. That seems brittle. Ideally, we'd move to a solution where the target compiler was automatically tested as well, but I'm not sure how feasible that is with the current CMake setup.

For now, this patch whitelists RISC-V, fixing errors in test__extendhfsf2. Alternate solutions that fix the root issue are welcome, though.

Diff Detail

Event Timeline

luismarques created this revision.Jul 9 2022, 5:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2022, 5:31 PM
luismarques requested review of this revision.Jul 9 2022, 5:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2022, 5:31 PM
Herald added subscribers: Restricted Project, pcwang-thead, eopXD. · View Herald Transcript

Why does this fix compiler-rt/test/builtins/Unit/extendhftf2_test.c? The test is skipped when COMPILER_RT_HAS_FLOAT16 is undefined.

Why does this fix compiler-rt/test/builtins/Unit/extendhftf2_test.c? The test is skipped when COMPILER_RT_HAS_FLOAT16 is undefined.

This is not a fix for extendhftf2_test.c, it's a fix for extendhfsf2_test.c.

MaskRay accepted this revision.Jul 10 2022, 3:40 PM

Why does this fix compiler-rt/test/builtins/Unit/extendhftf2_test.c? The test is skipped when COMPILER_RT_HAS_FLOAT16 is undefined.

This is not a fix for extendhftf2_test.c, it's a fix for extendhfsf2_test.c.

"Since D92241, we have a CMake test to automatically define COMPILER_RT_HAS_FLOAT16 when the host compiler supports _Float16." "a CMake test" isn't clear. Clarify it.

This revision is now accepted and ready to land.Jul 10 2022, 3:40 PM
luismarques retitled this revision from [compiler-rt][builtins][RISCV] Enable _Float16 for RISC-V in the compiler-rt tests, fixes test__extendhfsf2 to [compiler-rt][builtins][RISCV] Set COMPILER_RT_HAS_FLOAT16 for RISC-V compiler-rt tests, fixes test__extendhfsf2.Jul 10 2022, 4:00 PM
luismarques edited the summary of this revision. (Show Details)