add simd_splat intrinsic

This commit is contained in:
Folkert de Vries 2026-01-19 00:42:38 +01:00
parent b86553f808
commit ef9002c3d7

View file

@ -348,6 +348,31 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
ret.write_cvalue(fx, ret_lane);
}
sym::simd_splat => {
intrinsic_args!(fx, args => (value); intrinsic);
if !ret.layout().ty.is_simd() {
report_simd_type_validation_error(fx, intrinsic, span, ret.layout().ty);
return;
}
let (lane_count, lane_ty) = ret.layout().ty.simd_size_and_type(fx.tcx);
if value.layout().ty != lane_ty {
fx.tcx.dcx().span_fatal(
span,
format!(
"[simd_splat] expected element type {lane_ty:?}, got {got:?}",
got = value.layout().ty
),
);
}
for i in 0..lane_count {
let ret_lane = ret.place_lane(fx, i.into());
ret_lane.write_cvalue(fx, value);
}
}
sym::simd_neg
| sym::simd_bswap
| sym::simd_bitreverse