miri: we can use apfloat's mul_add now
This commit is contained in:
parent
30f3725e0d
commit
f5d24e930a
2 changed files with 6 additions and 10 deletions
|
|
@ -272,8 +272,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
let a = this.read_scalar(a)?.to_f32()?;
|
||||
let b = this.read_scalar(b)?.to_f32()?;
|
||||
let c = this.read_scalar(c)?.to_f32()?;
|
||||
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
|
||||
let res = a.to_host().mul_add(b.to_host(), c.to_host()).to_soft();
|
||||
let res = a.mul_add(b, c).value;
|
||||
let res = this.adjust_nan(res, &[a, b, c]);
|
||||
this.write_scalar(res, dest)?;
|
||||
}
|
||||
|
|
@ -282,8 +281,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
let a = this.read_scalar(a)?.to_f64()?;
|
||||
let b = this.read_scalar(b)?.to_f64()?;
|
||||
let c = this.read_scalar(c)?.to_f64()?;
|
||||
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
|
||||
let res = a.to_host().mul_add(b.to_host(), c.to_host()).to_soft();
|
||||
let res = a.mul_add(b, c).value;
|
||||
let res = this.adjust_nan(res, &[a, b, c]);
|
||||
this.write_scalar(res, dest)?;
|
||||
}
|
||||
|
|
@ -295,8 +293,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
let c = this.read_scalar(c)?.to_f32()?;
|
||||
let fuse: bool = this.machine.rng.get_mut().random();
|
||||
let res = if fuse {
|
||||
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
|
||||
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()
|
||||
a.mul_add(b, c).value
|
||||
} else {
|
||||
((a * b).value + c).value
|
||||
};
|
||||
|
|
@ -310,8 +307,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
let c = this.read_scalar(c)?.to_f64()?;
|
||||
let fuse: bool = this.machine.rng.get_mut().random();
|
||||
let res = if fuse {
|
||||
// FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
|
||||
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()
|
||||
a.mul_add(b, c).value
|
||||
} else {
|
||||
((a * b).value + c).value
|
||||
};
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
let b = b.to_f32()?;
|
||||
let c = c.to_f32()?;
|
||||
let res = if fuse {
|
||||
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()
|
||||
a.mul_add(b, c).value
|
||||
} else {
|
||||
((a * b).value + c).value
|
||||
};
|
||||
|
|
@ -332,7 +332,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
let b = b.to_f64()?;
|
||||
let c = c.to_f64()?;
|
||||
let res = if fuse {
|
||||
a.to_host().mul_add(b.to_host(), c.to_host()).to_soft()
|
||||
a.mul_add(b, c).value
|
||||
} else {
|
||||
((a * b).value + c).value
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue