Make float division generic

Float division currently has a separate `div32` and `div64` for `f32`
and `f64`, respectively. Combine these to make use of generics. This
will make it easier to support `f128` division, and reduces a lot of
redundant code.

This includes a simplification of division tests.
This commit is contained in:
Trevor Gross 2024-08-19 15:40:43 -05:00
parent 23af8ca763
commit 4f8afbabdc
2 changed files with 364 additions and 682 deletions

File diff suppressed because it is too large Load diff

View file

@ -115,7 +115,13 @@ macro_rules! float {
fuzz_float_2(N, |x: $f, y: $f| {
let quo0: $f = apfloat_fallback!($f, $apfloat_ty, $sys_available, Div::div, x, y);
let quo1: $f = $fn(x, y);
#[cfg(not(target_arch = "arm"))]
// ARM SIMD instructions always flush subnormals to zero
if cfg!(target_arch = "arm") &&
((Float::is_subnormal(quo0)) || Float::is_subnormal(quo1)) {
return;
}
if !Float::eq_repr(quo0, quo1) {
panic!(
"{}({:?}, {:?}): std: {:?}, builtins: {:?}",
@ -126,21 +132,6 @@ macro_rules! float {
quo1
);
}
// ARM SIMD instructions always flush subnormals to zero
#[cfg(target_arch = "arm")]
if !(Float::is_subnormal(quo0) || Float::is_subnormal(quo1)) {
if !Float::eq_repr(quo0, quo1) {
panic!(
"{}({:?}, {:?}): std: {:?}, builtins: {:?}",
stringify!($fn),
x,
y,
quo0,
quo1
);
}
}
});
}
)*