Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic unorddf2vfp() and unordsf2vfp() #626

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ rely on CI.
- [ ] arm/udivmodsi4.S (generic version is done)
- [ ] arm/udivsi3.S (generic version is done)
- [ ] arm/umodsi3.S (generic version is done)
- [ ] arm/unorddf2vfp.S
- [ ] arm/unordsf2vfp.S
- [x] arm/unorddf2vfp.S (generic version is done)
- [x] arm/unordsf2vfp.S (generic version is done)
- [x] ashldi3.c
- [x] ashrdi3.c
- [x] comparedf2.c
Expand Down
10 changes: 10 additions & 0 deletions src/float/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ intrinsics! {
unord(a, b) as i32
}

#[avr_skip]
pub extern "C" fn __unordsf2vfp(a: f32, b: f32) -> i32 {
unord(a, b) as i32
}

#[avr_skip]
pub extern "C" fn __eqsf2(a: f32, b: f32) -> i32 {
cmp(a, b).to_le_abi()
Expand Down Expand Up @@ -151,6 +156,11 @@ intrinsics! {
unord(a, b) as i32
}

#[avr_skip]
pub extern "C" fn __unorddf2vfp(a: f64, b: f64) -> i32 {
unord(a, b) as i32
}

#[avr_skip]
pub extern "C" fn __eqdf2(a: f64, b: f64) -> i32 {
cmp(a, b).to_le_abi()
Expand Down
6 changes: 4 additions & 2 deletions testcrate/tests/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ mod float_comparisons {
#[test]
fn cmp_f32() {
use compiler_builtins::float::cmp::{
__eqsf2, __gesf2, __gtsf2, __lesf2, __ltsf2, __nesf2, __unordsf2,
__eqsf2, __gesf2, __gtsf2, __lesf2, __ltsf2, __nesf2, __unordsf2, __unordsf2vfp,
};

fuzz_float_2(N, |x: f32, y: f32| {
assert_eq!(__unordsf2(x, y) != 0, x.is_nan() || y.is_nan());
assert_eq!(__unordsf2vfp(x, y) != 0, x.is_nan() || y.is_nan());
cmp!(f32, x, y, Single, all(),
1, __ltsf2;
1, __lesf2;
Expand All @@ -77,11 +78,12 @@ mod float_comparisons {
#[test]
fn cmp_f64() {
use compiler_builtins::float::cmp::{
__eqdf2, __gedf2, __gtdf2, __ledf2, __ltdf2, __nedf2, __unorddf2,
__eqdf2, __gedf2, __gtdf2, __ledf2, __ltdf2, __nedf2, __unorddf2, __unorddf2vfp,
};

fuzz_float_2(N, |x: f64, y: f64| {
assert_eq!(__unorddf2(x, y) != 0, x.is_nan() || y.is_nan());
assert_eq!(__unorddf2vfp(x, y) != 0, x.is_nan() || y.is_nan());
cmp!(f64, x, y, Double, all(),
1, __ltdf2;
1, __ledf2;
Expand Down
Loading