Description
Currently there seems to be no way to detect at compile time if the target will have hardware floating point support.
Depending on the target arch, this is sometimes expressed in LLVM as a feature named "hard-float", or as a feature named "soft-float", or even as features named "f" and "d". It's entirely possible for there to be hardware f32
support but not f64
support on some platforms. LLVM has (or should have) all of this info already, based on the target profile. We just don't expose it in Rust.
For the record, this is initially needed for libm/compiler-builtins to advance the issue of moving sqrt
and other float support into core
, so if this is added as some sort of Nightly-only and perma-unstable ability then that's probably fine since those crates are always built with Nightly and then shipped with the compiler.
It feels like this could be a simple PR thing by someone who knows about that part of the cargo/LLVM/rustc interaction, but more likely this is some sort of RFC level change. However, it's also possible that I'm totally wrong and that there is already an arcane way to check for floating point support configuration already, so I'm starting with an issue to try and get some visibility for the problem.