@@ -87,11 +87,11 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
8787
8888 _ if intrinsic_name. starts_with ( "atomic_cxchg" ) => {
8989 let ptr = self . ref_to_mplace ( self . read_immediate ( args[ 0 ] ) ?) ?;
90- let expect_old = self . read_immediate ( args[ 1 ] ) ?; // read as value for the sake of `binary_op_val ()`
90+ let expect_old = self . read_immediate ( args[ 1 ] ) ?; // read as value for the sake of `binary_op_imm ()`
9191 let new = self . read_scalar ( args[ 2 ] ) ?;
92- let old = self . read_immediate ( ptr. into ( ) ) ?; // read as value for the sake of `binary_op_val ()`
93- // binary_op_val will bail if either of them is not a scalar
94- let ( eq, _) = self . binary_op_val ( mir:: BinOp :: Eq , old, expect_old) ?;
92+ let old = self . read_immediate ( ptr. into ( ) ) ?; // read as value for the sake of `binary_op_imm ()`
93+ // binary_op_imm will bail if either of them is not a scalar
94+ let ( eq, _) = self . binary_op_imm ( mir:: BinOp :: Eq , old, expect_old) ?;
9595 let res = Immediate :: ScalarPair ( old. to_scalar_or_undef ( ) , eq. into ( ) ) ;
9696 self . write_immediate ( res, dest) ?; // old value is returned
9797 // update ptr depending on comparison
@@ -234,7 +234,7 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
234234 let a = self . read_immediate ( args[ 0 ] ) ?;
235235 let b = self . read_immediate ( args[ 1 ] ) ?;
236236 // check x % y != 0
237- if self . binary_op_val ( mir:: BinOp :: Rem , a, b) ?. 0 . to_bytes ( ) ? != 0 {
237+ if self . binary_op_imm ( mir:: BinOp :: Rem , a, b) ?. 0 . to_bytes ( ) ? != 0 {
238238 return err ! ( ValidationFailure ( format!( "exact_div: {:?} cannot be divided by {:?}" , a, b) ) ) ;
239239 }
240240 self . binop_ignore_overflow ( mir:: BinOp :: Div , a, b, dest) ?;
0 commit comments