https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122762

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #12)
> (In reply to Jakub Jelinek from comment #9)
> > I believe there should be always at most one SIMD_CLONE_ARG_TYPE_MASK
> > argument, so no idea why the num_mask_args code has been added.
> > At least simd_clone_adjust_argument_types adds it either 0 times or once
> > (for ->inbranch case).
> > Based on ncopied it can (and often does) be turned into multiple arguments
> > in various ABIs, at least for larger vectorization factors.
> > Regarding SVE, I'm afraid I have no idea what the actual vector ABI is in
> > that case (and I think OpenMP standard support for the variable length ABIs
> > has only landed very recently).
> 
> Hm, seems I added this in r14-4629-g3179ad72f67f31.  For some reason I
> thought that there might be multiple mask arguments.  Like when simdlen is
> very large,
> 256 for example, and so we'd have multiple args as you say.

In the end there can be many mask arguments, but I believe there should be just
one SIMD_CLONE_ARG_TYPE_MASK, that is basically a made up scalar argument which
can then map to multiple vectorized arguments, like a simple int etc. can as
well, say for AVX512F versions for simdlen 16 int can be passed in a single
V16SImode argument,
but for simdlen 32 it needs 2 V16SImode arguments.  Similarly in the same case
mask
would be for simdlen 16 a single integer with 16 bits in it, etc.

"For masked vector functions, the additional “mask” parameters are required.
For XMM, YMM1, and YMM2 ISA, each element of “mask” parameters has the data
type of the characteristic data type.
The number of mask parameters is the same as number of parameters required to
pass the vector of characteristic data type for the given vector length. For
example, with XMM targets, if characteristic data type is int and VLEN is 8,
two MI128 mask parameters are passed (see table 2). The value of a mask
parameter must be either bit patterns of all ones or all zeros for each
element.
For the MIC and ZMM ISA, mask arguments are passed in scalar (GPR) registers.
The mask parameters are collection of 1-bit masks in unsigned integers. The
total number of mask bits is equal to VLEN. The number of mask parameters is
equal to the number of parameters for the vector of characteristic data type.
The mask bits occupy the least significant bits of unsigned integer. For
example, if the characteristic data type is double and VLEN is 16, there are 16
mask bits stored in two unsigned integers. For ZMM ISA, if the characteristic
data type is char and VL is 64, there is one 64-bit unsigned integer parameter
for mask.
Mask parameters are passed after all other parameters in the same order of
parameters that they apply to.
For each element of the vector, if the corresponding mask value is zero, the
return value associated to that element is zero."

Reply via email to