Rollup merge of #137804 - RalfJung:backend-repr-simd-vector, r=workingjubilee

rename BackendRepr::Vector → SimdVector

For many Rustaceans, "vector" does not imply "SIMD", so let's be more clear in this type that is used pervasively in the compiler.

r? `@workingjubilee`
This commit is contained in:
Matthias Krüger
2025-03-01 16:03:10 +01:00
committed by GitHub
3 changed files with 8 additions and 6 deletions
+2 -2
View File
@@ -84,7 +84,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
AbiParam::new(scalar_to_clif_type(tcx, scalar)),
attrs
)],
BackendRepr::Vector { .. } => {
BackendRepr::SimdVector { .. } => {
let vector_ty = crate::intrinsics::clif_vector_type(tcx, self.layout);
smallvec![AbiParam::new(vector_ty)]
}
@@ -135,7 +135,7 @@ fn get_abi_return(&self, tcx: TyCtxt<'tcx>) -> (Option<AbiParam>, Vec<AbiParam>)
BackendRepr::Scalar(scalar) => {
(None, vec![AbiParam::new(scalar_to_clif_type(tcx, scalar))])
}
BackendRepr::Vector { .. } => {
BackendRepr::SimdVector { .. } => {
let vector_ty = crate::intrinsics::clif_vector_type(tcx, self.layout);
(None, vec![AbiParam::new(vector_ty)])
}
+1 -1
View File
@@ -53,7 +53,7 @@ fn report_atomic_type_validation_error<'tcx>(
pub(crate) fn clif_vector_type<'tcx>(tcx: TyCtxt<'tcx>, layout: TyAndLayout<'tcx>) -> Type {
let (element, count) = match layout.backend_repr {
BackendRepr::Vector { element, count } => (element, count),
BackendRepr::SimdVector { element, count } => (element, count),
_ => unreachable!(),
};
+5 -3
View File
@@ -173,9 +173,11 @@ pub(crate) fn load_scalar(self, fx: &mut FunctionCx<'_, '_, 'tcx>) -> Value {
CValueInner::ByRef(ptr, None) => {
let clif_ty = match layout.backend_repr {
BackendRepr::Scalar(scalar) => scalar_to_clif_type(fx.tcx, scalar),
BackendRepr::Vector { element, count } => scalar_to_clif_type(fx.tcx, element)
.by(u32::try_from(count).unwrap())
.unwrap(),
BackendRepr::SimdVector { element, count } => {
scalar_to_clif_type(fx.tcx, element)
.by(u32::try_from(count).unwrap())
.unwrap()
}
_ => unreachable!("{:?}", layout.ty),
};
let mut flags = MemFlags::new();