@@ -5,7 +5,7 @@ use rustc::ty;
55use rustc:: mir:: interpret:: { EvalResult , PointerArithmetic } ;
66
77use crate :: {
8- PlaceTy , OpTy , Immediate , Scalar , ScalarMaybeUndef , Borrow ,
8+ PlaceTy , OpTy , ImmTy , Immediate , Scalar , ScalarMaybeUndef , Borrow ,
99 OperatorEvalContextExt
1010} ;
1111
@@ -80,11 +80,11 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
8080
8181 _ if intrinsic_name. starts_with ( "atomic_cxchg" ) => {
8282 let ptr = this. deref_operand ( args[ 0 ] ) ?;
83- let expect_old = this. read_immediate ( args[ 1 ] ) ?; // read as immediate for the sake of `binary_op_imm ()`
83+ let expect_old = this. read_immediate ( args[ 1 ] ) ?; // read as immediate for the sake of `binary_op ()`
8484 let new = this. read_scalar ( args[ 2 ] ) ?;
85- let old = this. read_immediate ( ptr. into ( ) ) ?; // read as immediate for the sake of `binary_op_imm ()`
86- // binary_op_imm will bail if either of them is not a scalar
87- let ( eq, _) = this. binary_op_imm ( mir:: BinOp :: Eq , old, expect_old) ?;
85+ let old = this. read_immediate ( ptr. into ( ) ) ?; // read as immediate for the sake of `binary_op ()`
86+ // binary_op will bail if either of them is not a scalar
87+ let ( eq, _) = this. binary_op ( mir:: BinOp :: Eq , old, expect_old) ?;
8888 let res = Immediate :: ScalarPair ( old. to_scalar_or_undef ( ) , eq. into ( ) ) ;
8989 this. write_immediate ( res, dest) ?; // old value is returned
9090 // update ptr depending on comparison
@@ -140,9 +140,9 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
140140 _ => bug ! ( ) ,
141141 } ;
142142 // Atomics wrap around on overflow.
143- let ( val, _overflowed) = this. binary_op_imm ( op, old, rhs) ?;
143+ let ( val, _overflowed) = this. binary_op ( op, old, rhs) ?;
144144 let val = if neg {
145- this. unary_op ( mir:: UnOp :: Not , val, old. layout ) ?
145+ this. unary_op ( mir:: UnOp :: Not , ImmTy :: from_scalar ( val, old. layout ) ) ?
146146 } else {
147147 val
148148 } ;
@@ -239,7 +239,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
239239 let a = this. read_immediate ( args[ 0 ] ) ?;
240240 let b = this. read_immediate ( args[ 1 ] ) ?;
241241 // check x % y != 0
242- if this. binary_op_imm ( mir:: BinOp :: Rem , a, b) ?. 0 . to_bits ( dest. layout . size ) ? != 0 {
242+ if this. binary_op ( mir:: BinOp :: Rem , a, b) ?. 0 . to_bits ( dest. layout . size ) ? != 0 {
243243 return err ! ( ValidationFailure ( format!( "exact_div: {:?} cannot be divided by {:?}" , a, b) ) ) ;
244244 }
245245 this. binop_ignore_overflow ( mir:: BinOp :: Div , a, b, dest) ?;
0 commit comments