Deal with floatdidf on x86_64

Apparently LLVM will lower this down to just an instruction
master
Alex Crichton 2017-06-23 13:28:24 -07:00
parent 5172f8c218
commit a839d53a02
2 changed files with 8 additions and 7 deletions

View File

@ -4132,7 +4132,6 @@ mod c {
if target_arch == "x86_64" {
sources.extend(
&[
"x86_64/floatdidf.c",
"x86_64/floatdisf.c",
"x86_64/floatdixf.c",
],
@ -4148,7 +4147,6 @@ mod c {
&[
"x86_64/chkstk.S",
"x86_64/chkstk2.S",
"x86_64/floatdidf.c",
"x86_64/floatdisf.c",
"x86_64/floatdixf.c",
"x86_64/floatundidf.S",

View File

@ -78,12 +78,15 @@ intrinsics! {
int_to_float!(i, i32, f64)
}
#[use_c_shim_if(any(
all(not(target_env = "msvc"), target_arch = "x86", target_arch = "x86_64"),
all(target_env = "msvc", target_arch = "x86_64"),
))]
#[use_c_shim_if(all(target_arch = "x86", not(target_env = "msvc")))]
pub extern "C" fn __floatdidf(i: i64) -> f64 {
int_to_float!(i, i64, f64)
// On x86_64 LLVM will use native instructions for this conversion, we
// can just do it directly
if cfg!(target_arch = "x86_64") {
i as f64
} else {
int_to_float!(i, i64, f64)
}
}
#[unadjusted_on_win64]