@@ -696,6 +696,40 @@ where
696696 Ok ( ( ) )
697697 }
698698
699+ /// Writes the `scalar` to the `index`-th element of the `vector`.
700+ pub fn write_scalar_to_vector (
701+ & mut self ,
702+ scalar : ImmTy < ' tcx , M :: PointerTag > ,
703+ vector : PlaceTy < ' tcx , M :: PointerTag > ,
704+ index : usize ,
705+ ) -> InterpResult < ' tcx > {
706+ let index = index as u64 ;
707+ let place = self . place_field ( vector, index) ?;
708+ self . write_immediate ( * scalar, place) ?;
709+ Ok ( ( ) )
710+ }
711+
712+ /// Writes the `scalars` to the `vector`.
713+ pub fn write_vector (
714+ & mut self ,
715+ scalars : Vec < ImmTy < ' tcx , M :: PointerTag > > ,
716+ vector : PlaceTy < ' tcx , M :: PointerTag > ,
717+ ) -> InterpResult < ' tcx > {
718+ assert_ne ! ( scalars. len( ) , 0 ) ;
719+ match vector. layout . ty . sty {
720+ ty:: Adt ( def, ..) if def. repr . simd ( ) => {
721+ let tcx = & * self . tcx ;
722+ let count = vector. layout . ty . simd_size ( * tcx) ;
723+ assert_eq ! ( count, scalars. len( ) ) ;
724+ for index in 0 ..scalars. len ( ) {
725+ self . write_scalar_to_vector ( scalars[ index] , vector, index) ?;
726+ }
727+ }
728+ _ => bug ! ( "not a vector" ) ,
729+ }
730+ Ok ( ( ) )
731+ }
732+
699733 /// Write an `Immediate` to memory.
700734 #[ inline( always) ]
701735 pub fn write_immediate_to_mplace (
0 commit comments