Skip to main content

nclipu

pub fn nclipu(
    vs2_elem: u64,
    shamt: u32,
    sew: Vsew,
    mode: Vxrm,
    vxsat: &mut bool,
) -> u64
Expand description

Narrowing unsigned clip: read a 2*SEW element from vs2, shift right by shamt with rounding, saturate to unsigned SEW range, set vxsat on clamp.

vs2_elem is the 2SEW-bit element (zero-extended to u64 for SEW <= 32; for SEW = 64 the doubled width would be 128 bits, but Zve64x only supports SEW up to 64 and the narrowing destination is at most 64 bits wide, so 2SEW = 128 - however the spec requires ELEN >= 2*SEW for narrowing instructions. Since ELEN = 64 in Zve64x, narrowing is only valid for SEW <= 32 (2*SEW <= 64). The caller must enforce this constraint by checking vsew before invoking narrowing operations.

vs2_elem is passed as u64; for SEW = 32 it holds a 64-bit (2*SEW) value.