Merge pull request #224 from alexcrichton/fix-float-cmp

Fix some typos/bugs with float comparison intrinsics
This commit is contained in:
Alex Crichton 2018-01-24 20:26:10 -06:00 committed by GitHub
commit 0a95675bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 5 deletions

View File

@ -5430,10 +5430,8 @@ mod c {
if target_arch == "arm" && target_os != "ios" { if target_arch == "arm" && target_os != "ios" {
sources.extend( sources.extend(
&[ &[
"arm/aeabi_dcmp.S",
"arm/aeabi_div0.c", "arm/aeabi_div0.c",
"arm/aeabi_drsub.c", "arm/aeabi_drsub.c",
"arm/aeabi_fcmp.S",
"arm/aeabi_frsub.c", "arm/aeabi_frsub.c",
"arm/bswapdi2.S", "arm/bswapdi2.S",
"arm/bswapsi2.S", "arm/bswapsi2.S",

View File

@ -120,7 +120,7 @@ intrinsics! {
cmp(a, b).to_ge_abi() cmp(a, b).to_ge_abi()
} }
#[arm_aeabi_alias = fcmpun] #[arm_aeabi_alias = __aeabi_fcmpun]
pub extern "C" fn __unordsf2(a: f32, b: f32) -> i32 { pub extern "C" fn __unordsf2(a: f32, b: f32) -> i32 {
unord(a, b) as i32 unord(a, b) as i32
} }
@ -149,7 +149,7 @@ intrinsics! {
cmp(a, b).to_ge_abi() cmp(a, b).to_ge_abi()
} }
#[arm_aeabi_alias = dcmpun] #[arm_aeabi_alias = __aeabi_dcmpun]
pub extern "C" fn __unorddf2(a: f64, b: f64) -> i32 { pub extern "C" fn __unorddf2(a: f64, b: f64) -> i32 {
unord(a, b) as i32 unord(a, b) as i32
} }
@ -166,7 +166,50 @@ intrinsics! {
cmp(a, b).to_le_abi() cmp(a, b).to_le_abi()
} }
pub extern "C" fn __gtdf2(a: f32, b: f32) -> i32 { pub extern "C" fn __gtdf2(a: f64, b: f64) -> i32 {
cmp(a, b).to_ge_abi() cmp(a, b).to_ge_abi()
} }
} }
#[cfg(target_arch = "arm")]
intrinsics! {
pub extern "aapcs" fn __aeabi_fcmple(a: f32, b: f32) -> i32 {
(__lesf2(a, b) < 0) as i32
}
pub extern "aapcs" fn __aeabi_fcmpge(a: f32, b: f32) -> i32 {
(__gesf2(a, b) >= 0) as i32
}
pub extern "aapcs" fn __aeabi_fcmpeq(a: f32, b: f32) -> i32 {
(__eqsf2(a, b) == 0) as i32
}
pub extern "aapcs" fn __aeabi_fcmplt(a: f32, b: f32) -> i32 {
(__ltsf2(a, b) < 0) as i32
}
pub extern "aapcs" fn __aeabi_fcmpgt(a: f32, b: f32) -> i32 {
(__gtsf2(a, b) > 0) as i32
}
pub extern "aapcs" fn __aeabi_dcmple(a: f64, b: f64) -> i32 {
(__ledf2(a, b) <= 0) as i32
}
pub extern "aapcs" fn __aeabi_dcmpge(a: f64, b: f64) -> i32 {
(__gedf2(a, b) >= 0) as i32
}
pub extern "aapcs" fn __aeabi_dcmpeq(a: f64, b: f64) -> i32 {
(__eqdf2(a, b) == 0) as i32
}
pub extern "aapcs" fn __aeabi_dcmplt(a: f64, b: f64) -> i32 {
(__ltdf2(a, b) < 0) as i32
}
pub extern "aapcs" fn __aeabi_dcmpgt(a: f64, b: f64) -> i32 {
(__gtdf2(a, b) > 0) as i32
}
}