This patch adds support for implicit casting between GNU vectors and SVE
vectors when __ARM_FEATURE_SVE_BITS==N, as defined by the Arm C
Language Extensions (ACLE, version 00bet5, section 3.7.3.3) for SVE [1].
This behavior makes it possible to use GNU vectors with ACLE functions
that operate on VLAT. For example:
typedef int8_t vec __attribute__((vector_size(32))); vec f(vec x) { return svasrd_x(svptrue_b8(), x, 1); }
Tests are also added for implicit casting between GNU and fixed-length
SVE vectors created by the 'arm_sve_vector_bits' attribute. This
behavior makes it possible to use VLST with existing interfaces that
operate on GNUT. For example:
typedef int8_t vec1 __attribute__((vector_size(32))); void f(vec1); #if __ARM_FEATURE_SVE_BITS==256 && __ARM_FEATURE_SVE_VECTOR_OPERATORS typedef svint8_t vec2 __attribute__((arm_sve_vector_bits(256))); void g(vec2 x) { f(x); } // OK #endif
The __ARM_FEATURE_SVE_VECTOR_OPERATORS feature macro indicates
interoperability with the GNU vector extension. This is the first patch
providing support for this feature, which once complete will be enabled
by the -msve-vector-bits flag, as the __ARM_FEATURE_SVE_BITS feature
currently is.
We allow casting SVE fixed-width vectors only if the element type is identical, but we allow casting to GNU fixed-width vectors if the vector width is the same? That seems sort of loose; could allow weird casts, particularly when bool vectors are involved.