A crate compiled on x86_64 with -Ctarget-feature=+soft-float will use floating point conversions from compiler-builtins. However, some of the floating point conversions in compiler-builtins are implemented using floating point instructions. This breaks when enabling the +soft-float target-feature. Should +soft-float be supported? Or should this have given an error? Right now, it silently gives wrong results:
fn main() {
println!("1234 = {:e}", a(1234));
}
#[inline(never)]
fn a(x: u64) -> f64 {
x as f64
}
$ rustc main.rs -Ctarget-feature=+soft-float && ./main
1234 = 4.66101421257866e-310
https://godbolt.org/z/9zvecP
A crate compiled on
x86_64with-Ctarget-feature=+soft-floatwill use floating point conversions fromcompiler-builtins. However, some of the floating point conversions incompiler-builtinsare implemented using floating point instructions. This breaks when enabling the+soft-floattarget-feature. Should+soft-floatbe supported? Or should this have given an error? Right now, it silently gives wrong results:https://godbolt.org/z/9zvecP