JojoR via Gcc <gcc@gcc.gnu.org> writes:
> Hi,
>
>       I have a little know about for 'Sizes and offsets as runtime 
> invariants’,
>
>       and need to add vector types like V2SImode as compile-time constants
>       with enabled vector types of runtime invariants.
>
>       Could I enable two vector types at same time ?
>       I guess it’s not allow :(
>
>       Could anyone give me some hints ?

Vector modes like V2SI always represent fixed-length vectors.
Variable-length vector modes have to be defined explicitly in the
.def file.

A target can have both variable-length and fixed-length vectors.

Probably the best place to look for examples is the aarch64 backend.
There we have:

- V2SI (64-bit Advanced SIMD)
- V4SI (128-bit Advanced SIMD)
- VNx2SI (variable-length SVE vector with 2 32-bit elements per
  128-bit granule)
- VNx4SI (variable-length SVE vector with 4 32-bit elements per
  128-bit granule)
etc.

In target-independent code, things like GET_MODE_NUNITS are always
poly_ints.  In other words, the number of elements might be constant
(is_constant()) or might vary at runtime (!is_constant()).

On targets like x86 that don't define variable-length vectors,
things like GET_MODE_NUNITS are always compile-time constants
*within config/i386*.  This removes the need to use is_constant()
everywhere.

On targets like aarch64 that do define variable-length vectors,
things like GET_MODE_NUNITS are poly_ints even in config/aarch64.
However, GET_MODE_NUNITS is still constant for V2SI and V4SI.
We just have to use to_constant() to get the constant 2 or 4.

Thanks,
Richard

Reply via email to