[PATCH] D145088: [RISCV] Add attribute(riscv_rvv_vector_bits(N)) based on AArch64 arm_sve_vector_bits.

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 12 09:09:01 PDT 2023


erichkeane added inline comments.


================
Comment at: clang/include/clang/AST/ASTContext.h:2263
+  /// types as defined by -flax-vector-conversions=, which permits implicit
+  /// conversions between vectors wit different number of elemnts and/or
+  /// incompatible element types, false otherwise.
----------------



================
Comment at: clang/test/SemaCXX/attr-riscv-rvv-vector-bits.cpp:12
+
+template<typename T> struct S { T var; };
+
----------------
craig.topper wrote:
> @erichkeane does this cover the dependent case or were you looking for something else?
> 
> Here are on the only mentions of template I see in SVE tests that use this attribute.
> 
> ```
> clang/test$ ack template `ack arm_sve_vector -l`
> CodeGenCXX/aarch64-mangle-sve-fixed-vectors.cpp
> 37:template <typename T> struct S {};
> 
> SemaCXX/attr-arm-sve-vector-bits.cpp
> 16:template<typename T> struct S { T var; };
> ```
> 
> Here is the result for this patch
> 
> ```
> clang/test$ ack template `ack riscv_rvv_vector -l`
> CodeGenCXX/riscv-mangle-rvv-fixed-vectors.cpp
> 48:template <typename T> struct S {};
> 
> SemaCXX/attr-riscv-rvv-vector-bits.cpp
> 12:template<typename T> struct S { T var; };
> ```
Thats unfortunate, and I wish I'd thought of it at the time/been more active reviewing the SVE stuff then.  Really what I'm looking for is:

```
template<int N> 
struct Whatever {
  using Something = char __attribute((riscv_rvv_vector_bits(N)));
};

void Func(Whatever<5>::Something MyVar){}

```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145088



More information about the cfe-commits mailing list