File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -348,6 +348,31 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
348348 ret. write_cvalue ( fx, ret_lane) ;
349349 }
350350
351+ sym:: simd_splat => {
352+ intrinsic_args ! ( fx, args => ( value) ; intrinsic) ;
353+
354+ if !ret. layout ( ) . ty . is_simd ( ) {
355+ report_simd_type_validation_error ( fx, intrinsic, span, ret. layout ( ) . ty ) ;
356+ return ;
357+ }
358+ let ( lane_count, lane_ty) = ret. layout ( ) . ty . simd_size_and_type ( fx. tcx ) ;
359+
360+ if value. layout ( ) . ty != lane_ty {
361+ fx. tcx . dcx ( ) . span_fatal (
362+ span,
363+ format ! (
364+ "[simd_splat] expected element type {lane_ty:?}, got {got:?}" ,
365+ got = value. layout( ) . ty
366+ ) ,
367+ ) ;
368+ }
369+
370+ for i in 0 ..lane_count {
371+ let ret_lane = ret. place_lane ( fx, i. into ( ) ) ;
372+ ret_lane. write_cvalue ( fx, value) ;
373+ }
374+ }
375+
351376 sym:: simd_neg
352377 | sym:: simd_bswap
353378 | sym:: simd_bitreverse
You can’t perform that action at this time.
0 commit comments