armhf: don't compare our impls against gcc_s

master
Jorge Aparicio 2016-09-21 21:14:38 -05:00
parent 225d4c9d45
commit 337bd7e209
3 changed files with 23 additions and 8 deletions

View File

@ -1,5 +1,6 @@
[package]
authors = ["Jorge Aparicio <japaricious@gmail.com>"]
build = "build.rs"
name = "rustc_builtins"
version = "0.1.0"

7
build.rs Normal file
View File

@ -0,0 +1,7 @@
use std::env;
fn main() {
if env::var("TARGET").unwrap().ends_with("hf") {
println!("cargo:rustc-cfg=gnueabihf")
}
}

View File

@ -216,10 +216,15 @@ mod tests {
let (a, b) = (f32::from_repr(a.0), f32::from_repr(b.0));
let x = super::__addsf3(a, b);
if let Some(addsf3) = gcc_s::addsf3() {
x.eq_repr(unsafe { addsf3(a, b) })
} else {
x.eq_repr(a + b)
match gcc_s::addsf3() {
// NOTE(cfg) for some reason, on hard float targets, our implementation doesn't
// match the output of its gcc_s counterpart. Until we investigate further, we'll
// just avoid testing against gcc_s on those targets. Do note that our
// implementation matches the output of the FPU instruction on *hard* float targets
// and matches its gcc_s counterpart on *soft* float targets.
#[cfg(not(gnueabihf))]
Some(addsf3) => x.eq_repr(unsafe { addsf3(a, b) }),
_ => x.eq_repr(a + b),
}
}
@ -227,10 +232,12 @@ mod tests {
let (a, b) = (f64::from_repr(a.0), f64::from_repr(b.0));
let x = super::__adddf3(a, b);
if let Some(adddf3) = gcc_s::adddf3() {
x.eq_repr(unsafe { adddf3(a, b) })
} else {
x.eq_repr(a + b)
match gcc_s::adddf3() {
// NOTE(cfg) See NOTE above
#[cfg(not(gnueabihf))]
Some(adddf3) => x.eq_repr(unsafe { adddf3(a, b) }),
_ => x.eq_repr(a + b),
}
}
}