interpret: simplify SIMD type handling
This commit is contained in:
parent
a5efa01895
commit
e2bc16c101
15 changed files with 190 additions and 199 deletions
|
@ -681,30 +681,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
|
|||
Ok(str)
|
||||
}
|
||||
|
||||
/// Converts a repr(simd) operand into an operand where `place_index` accesses the SIMD elements.
|
||||
/// Also returns the number of elements.
|
||||
///
|
||||
/// Can (but does not always) trigger UB if `op` is uninitialized.
|
||||
pub fn operand_to_simd(
|
||||
&self,
|
||||
op: &OpTy<'tcx, M::Provenance>,
|
||||
) -> InterpResult<'tcx, (MPlaceTy<'tcx, M::Provenance>, u64)> {
|
||||
// Basically we just transmute this place into an array following simd_size_and_type.
|
||||
// This only works in memory, but repr(simd) types should never be immediates anyway.
|
||||
assert!(op.layout.ty.is_simd());
|
||||
match op.as_mplace_or_imm() {
|
||||
Left(mplace) => self.mplace_to_simd(&mplace),
|
||||
Right(imm) => match *imm {
|
||||
Immediate::Uninit => {
|
||||
throw_ub!(InvalidUninitBytes(None))
|
||||
}
|
||||
Immediate::Scalar(..) | Immediate::ScalarPair(..) => {
|
||||
bug!("arrays/slices can never have Scalar/ScalarPair layout")
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Read from a local of the current frame.
|
||||
/// Will not access memory, instead an indirect `Operand` is returned.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue