>> How does encoding work for SVE's small mask modes? I suppose >> >> unsigned int elt_bits = vector_element_size (GET_MODE_PRECISION (mode), >> GET_MODE_NUNITS (mode)); >> >> is != 1 but rather adjusted so a byte is filled? > > It's 1 for VNx16BI, 2 for VNx8BI, and 4 for VNx4BI. There are then > respectively 8, 4, and 2 elements per byte.
For us elt_bits = 1 because e.g. GET_MODE_PRECISION (V4BI) == GET_MODE_NUNITS (V4BI). And, to be sure, I believe the problem I'm trying to address only concerns V1BI, V2BI, and V4BI modes because they are smaller than a byte. Not the actually VLA modes. > >> For our mask modes anything else but zero padding makes no sense, so how >> could we clarify this? > > Generally, we don't try to maintain the value of padding bits. E.g. > if we have a single-byte V4BI mode with 4 bits of padding, doing: > > (set (reg:QI R1) (subreg:QI (reg:V4BI R2) 0)) > > would not necessarily leave the upper 4 bits of R2 as zero, and so > it would not be valid to optimise: > > (set (reg:QI R1) (and:QI (subreg:QI (reg:V4BI R2) 0) (const_int 15))) > > to the move above. Similarly, on SVE: > > (set (reg:VNx8BI R1) (subreg:VNx8BI (reg:VNx4BI R2) 0)) > > sets Nx4 of the R1 elements to undefined values. The even elements are > defined, the odd elements are not. > > That's why it seems like forcing the padding is masking a bug elsewhere. > In general, things should work whatever value the padding bits have. For RVV hardware we also don't care about the padding bytes. As they are packed at the beginning of a register and the vector length must be correct we only access the bits corresponding to the vector length. Everything beyond that is subject to a tail-policy and can be "anything". But here I intended to just change the encoded value in memory and to prevent it from aliasing with other encoded values. In an actual instruction the values we "padded" (or that are beyond the vector length) are ignored. For the purpose of hashing a mask of "1010" and "10101010" should be distinct which they are not right now because we don't stop at the length so to say. -- Regards Robin