@@ -5,7 +5,6 @@ use rustc_apfloat::{
55use rustc_middle:: ty:: layout:: LayoutOf as _;
66use rustc_middle:: ty:: Ty ;
77use rustc_span:: Symbol ;
8- use rustc_target:: abi:: Size ;
98use rustc_target:: spec:: abi:: Abi ;
109
1110use super :: FloatCmpOp ;
@@ -112,7 +111,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
112111
113112 // Values are expanded from i16 to i32, so multiplication cannot overflow.
114113 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) ?;
116115 }
117116 }
118117 // Used to implement the _mm_mulhi_epu16 function.
@@ -431,11 +430,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
431430 let right_res =
432431 i8:: try_from ( right) . unwrap_or ( if right < 0 { i8:: MIN } else { i8:: MAX } ) ;
433432
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) ?;
439435 }
440436 }
441437 // Used to implement the _mm_packus_epi16 function.
@@ -495,9 +491,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
495491 let right_res =
496492 i16:: try_from ( right) . unwrap_or ( if right < 0 { i16:: MIN } else { i16:: MAX } ) ;
497493
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) ?;
499495 this. write_scalar (
500- Scalar :: from_int ( right_res, Size :: from_bits ( 16 ) ) ,
496+ Scalar :: from_i16 ( right_res. try_into ( ) . unwrap ( ) ) ,
501497 & right_dest,
502498 ) ?;
503499 }
0 commit comments