@@ -295,6 +295,39 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
295
295
this. write_scalar ( res, dest) ?;
296
296
}
297
297
298
+ "fmuladdf32" => {
299
+ let [ a, b, c] = check_arg_count ( args) ?;
300
+ let a = this. read_scalar ( a) ?. to_f32 ( ) ?;
301
+ let b = this. read_scalar ( b) ?. to_f32 ( ) ?;
302
+ let c = this. read_scalar ( c) ?. to_f32 ( ) ?;
303
+ let fuse: bool = this. machine . rng . get_mut ( ) . gen ( ) ;
304
+ #[ allow( clippy:: arithmetic_side_effects) ] // float ops don't overflow
305
+ let res = if fuse {
306
+ // FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
307
+ a. to_host ( ) . mul_add ( b. to_host ( ) , c. to_host ( ) ) . to_soft ( )
308
+ } else {
309
+ ( ( a * b) . value + c) . value
310
+ } ;
311
+ let res = this. adjust_nan ( res, & [ a, b, c] ) ;
312
+ this. write_scalar ( res, dest) ?;
313
+ }
314
+ "fmuladdf64" => {
315
+ let [ a, b, c] = check_arg_count ( args) ?;
316
+ let a = this. read_scalar ( a) ?. to_f64 ( ) ?;
317
+ let b = this. read_scalar ( b) ?. to_f64 ( ) ?;
318
+ let c = this. read_scalar ( c) ?. to_f64 ( ) ?;
319
+ let fuse: bool = this. machine . rng . get_mut ( ) . gen ( ) ;
320
+ #[ allow( clippy:: arithmetic_side_effects) ] // float ops don't overflow
321
+ let res = if fuse {
322
+ // FIXME: Using host floats, to work around https://github.com/rust-lang/rustc_apfloat/issues/11
323
+ a. to_host ( ) . mul_add ( b. to_host ( ) , c. to_host ( ) ) . to_soft ( )
324
+ } else {
325
+ ( ( a * b) . value + c) . value
326
+ } ;
327
+ let res = this. adjust_nan ( res, & [ a, b, c] ) ;
328
+ this. write_scalar ( res, dest) ?;
329
+ }
330
+
298
331
"powf32" => {
299
332
let [ f1, f2] = check_arg_count ( args) ?;
300
333
let f1 = this. read_scalar ( f1) ?. to_f32 ( ) ?;
0 commit comments