@@ -5,7 +5,7 @@ use rustc::ty;
5
5
use rustc:: mir:: interpret:: { EvalResult , PointerArithmetic } ;
6
6
7
7
use crate :: {
8
- PlaceTy , OpTy , Immediate , Scalar , ScalarMaybeUndef , Borrow ,
8
+ PlaceTy , OpTy , ImmTy , Immediate , Scalar , ScalarMaybeUndef , Borrow ,
9
9
OperatorEvalContextExt
10
10
} ;
11
11
@@ -80,11 +80,11 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
80
80
81
81
_ if intrinsic_name. starts_with ( "atomic_cxchg" ) => {
82
82
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 ()`
84
84
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) ?;
88
88
let res = Immediate :: ScalarPair ( old. to_scalar_or_undef ( ) , eq. into ( ) ) ;
89
89
this. write_immediate ( res, dest) ?; // old value is returned
90
90
// update ptr depending on comparison
@@ -140,9 +140,9 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
140
140
_ => bug ! ( ) ,
141
141
} ;
142
142
// 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) ?;
144
144
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 ) ) ?
146
146
} else {
147
147
val
148
148
} ;
@@ -239,7 +239,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
239
239
let a = this. read_immediate ( args[ 0 ] ) ?;
240
240
let b = this. read_immediate ( args[ 1 ] ) ?;
241
241
// 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 {
243
243
return err ! ( ValidationFailure ( format!( "exact_div: {:?} cannot be divided by {:?}" , a, b) ) ) ;
244
244
}
245
245
this. binop_ignore_overflow ( mir:: BinOp :: Div , a, b, dest) ?;
0 commit comments