@@ -5,7 +5,6 @@ use rustc_apfloat::{
5
5
use rustc_middle:: ty:: layout:: LayoutOf as _;
6
6
use rustc_middle:: ty:: Ty ;
7
7
use rustc_span:: Symbol ;
8
- use rustc_target:: abi:: Size ;
9
8
use rustc_target:: spec:: abi:: Abi ;
10
9
11
10
use super :: FloatCmpOp ;
@@ -112,7 +111,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
112
111
113
112
// Values are expanded from i16 to i32, so multiplication cannot overflow.
114
113
let res = i32:: from ( left) . checked_mul ( i32:: from ( right) ) . unwrap ( ) >> 16 ;
115
- this. write_scalar ( Scalar :: from_int ( res, Size :: from_bits ( 16 ) ) , & dest) ?;
114
+ this. write_scalar ( Scalar :: from_i16 ( res. try_into ( ) . unwrap ( ) ) , & dest) ?;
116
115
}
117
116
}
118
117
// Used to implement the _mm_mulhi_epu16 function.
@@ -431,11 +430,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
431
430
let right_res =
432
431
i8:: try_from ( right) . unwrap_or ( if right < 0 { i8:: MIN } else { i8:: MAX } ) ;
433
432
434
- this. write_scalar ( Scalar :: from_int ( left_res, Size :: from_bits ( 8 ) ) , & left_dest) ?;
435
- this. write_scalar (
436
- Scalar :: from_int ( right_res, Size :: from_bits ( 8 ) ) ,
437
- & right_dest,
438
- ) ?;
433
+ this. write_scalar ( Scalar :: from_i8 ( left_res. try_into ( ) . unwrap ( ) ) , & left_dest) ?;
434
+ this. write_scalar ( Scalar :: from_i8 ( right_res. try_into ( ) . unwrap ( ) ) , & right_dest) ?;
439
435
}
440
436
}
441
437
// Used to implement the _mm_packus_epi16 function.
@@ -495,9 +491,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
495
491
let right_res =
496
492
i16:: try_from ( right) . unwrap_or ( if right < 0 { i16:: MIN } else { i16:: MAX } ) ;
497
493
498
- this. write_scalar ( Scalar :: from_int ( left_res, Size :: from_bits ( 16 ) ) , & left_dest) ?;
494
+ this. write_scalar ( Scalar :: from_i16 ( left_res. try_into ( ) . unwrap ( ) ) , & left_dest) ?;
499
495
this. write_scalar (
500
- Scalar :: from_int ( right_res, Size :: from_bits ( 16 ) ) ,
496
+ Scalar :: from_i16 ( right_res. try_into ( ) . unwrap ( ) ) ,
501
497
& right_dest,
502
498
) ?;
503
499
}
0 commit comments