[PATCH] D91696: [AArch64][SVE] Allow lax conversion between VLATs and GNU vectors

Joe Ellis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 19 02:20:49 PST 2020


joechrisellis added inline comments.


================
Comment at: clang/test/Sema/attr-arm-sve-vector-bits.c:278-283
-// Test implicit conversion between SVE and GNU vector is invalid when
-// __ARM_FEATURE_SVE_BITS != N
-#if defined(__ARM_FEATURE_SVE_BITS) && __ARM_FEATURE_SVE_BITS == 512
-typedef int32_t int4 __attribute__((vector_size(16)));
-svint32_t badcast(int4 x) { return x; } // expected-error {{returning 'int4' (vector of 4 'int32_t' values) from a function with incompatible result type 'svint32_t' (aka '__SVInt32_t')}}
-#endif
----------------
c-rhodes wrote:
> I don't think this can be removed. The ACLE states "Whenever __ARM_FEATURE_SVE_BITS==N, GNUT implicitly converts to VLAT and VLAT implicitly converts to GNUT.".
> 
> AFAIK lax vector conversions only apply to vectors of the same width, with GNU vectors for example the following is invalid regardless of lax vector conversions:
> 
> ```typedef int8_t int8x16_t __attribute__((vector_size(16)));
> typedef int8_t int8x64_t __attribute__((vector_size(64)));
> 
> int8x16_t foo(int8x64_t x) { return x; }```
Great spot, didn't see that in the spec. I've re-added the test and added an extra condition to check if `__ARM_FEATURE_SVE_BITS == N` before allowing the lax conversion for GNU vectors. Not sure if this is the best way to do it, though. :) 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91696/new/

https://reviews.llvm.org/D91696



More information about the cfe-commits mailing list