simd intrinsics with mask: accept unsigned integer masks

This commit is contained in:
Ralf Jung 2025-03-03 18:18:33 +01:00
parent a7fc463dd8
commit 566dfd1a0d
18 changed files with 119 additions and 148 deletions

View file

@ -1295,6 +1295,11 @@ pub(crate) fn bool_to_simd_element(b: bool, size: Size) -> Scalar {
}
pub(crate) fn simd_element_to_bool(elem: ImmTy<'_>) -> InterpResult<'_, bool> {
assert!(
matches!(elem.layout.ty.kind(), ty::Int(_) | ty::Uint(_)),
"SIMD mask element type must be an integer, but this is `{}`",
elem.layout.ty
);
let val = elem.to_scalar().to_int(elem.layout.size)?;
interp_ok(match val {
0 => false,