Skip to content

Commit a379537

Browse files
committed
use apfloat's FMA primitive
1 parent 5e07ac3 commit a379537

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/intrinsic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,9 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
368368
let a = this.read_scalar(args[0])?.to_f32()?;
369369
let b = this.read_scalar(args[1])?.to_f32()?;
370370
let c = this.read_scalar(args[2])?.to_f32()?;
371-
let res = (a*b).value + c;
371+
let res = a.mul_add(b, c).value;
372372
this.write_scalar(
373-
Scalar::from_f32(res.value),
373+
Scalar::from_f32(res),
374374
dest,
375375
)?;
376376
}
@@ -379,9 +379,9 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
379379
let a = this.read_scalar(args[0])?.to_f64()?;
380380
let b = this.read_scalar(args[1])?.to_f64()?;
381381
let c = this.read_scalar(args[2])?.to_f64()?;
382-
let res = (a*b).value + c;
382+
let res = a.mul_add(b, c).value;
383383
this.write_scalar(
384-
Scalar::from_f64(res.value),
384+
Scalar::from_f64(res),
385385
dest,
386386
)?;
387387
}

0 commit comments

Comments
 (0)