@@ -76,6 +76,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7676 }
7777
7878 fn generate_nan < F1 : Float + FloatConvert < F2 > , F2 : Float > ( & self , inputs : & [ F1 ] ) -> F2 {
79+ let this = self . eval_context_ref ( ) ;
80+ if !this. machine . float_nondet {
81+ return F2 :: NAN ;
82+ }
83+
7984 /// Make the given NaN a signaling NaN.
8085 /// Returns `None` if this would not result in a NaN.
8186 fn make_signaling < F : Float > ( f : F ) -> Option < F > {
@@ -89,7 +94,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8994 if f. is_nan ( ) { Some ( f) } else { None }
9095 }
9196
92- let this = self . eval_context_ref ( ) ;
9397 let mut rand = this. machine . rng . borrow_mut ( ) ;
9498 // Assemble an iterator of possible NaNs: preferred, quieting propagation, unchanged propagation.
9599 // On some targets there are more possibilities; for now we just generate those options that
@@ -118,6 +122,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
118122
119123 fn equal_float_min_max < F : Float > ( & self , a : F , b : F ) -> F {
120124 let this = self . eval_context_ref ( ) ;
125+ if !this. machine . float_nondet {
126+ return a;
127+ }
121128 // Return one side non-deterministically.
122129 let mut rand = this. machine . rng . borrow_mut ( ) ;
123130 if rand. random ( ) { a } else { b }
0 commit comments