[PATCH] D87607: [clang][aarch64] Support implicit casts between GNU and SVE vectors

Cullen Rhodes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 15 03:22:48 PDT 2020


c-rhodes added inline comments.


================
Comment at: clang/lib/AST/ASTContext.cpp:8522
+          return VT->getElementType().getCanonicalType() ==
+                 getBuiltinVectorTypeInfo(BT).ElementType;
       }
----------------
efriedma wrote:
> 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.
> 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.

Fixed-length SVE vectors are created with the attribute and the vector width must match `-msve-vector-bits`, which should guarantee consistent vector widths for a given input. This is checking the vector width is the same and the element type matches when casting between GNU and SVE vectors, although since neither of those types are created by the attribute it's necessary to check the vector width to validate `__ARM_FEATURE_SVE_BITS==N`.

Predicates are treated differently in the ACLE and it doesn't mention supporting casts between GNU bool vectors and SVE VLS/VLA predicates. I'm also not sure the GNU vector_size extension is defined for bool elements yet, but I did notice Simon Moll is working on this (D81083).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87607



More information about the cfe-commits mailing list