[PATCH] D99037: [Matrix] Implement explicit type conversions for matrix types

Saurabh Jha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 30 00:50:13 PDT 2021


SaurabhJha added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:7315
+/// is not a scalar type.
+bool Sema::areCompatibleMatrixTypes(QualType srcTy, QualType destTy) {
+  assert(destTy->isMatrixType() && srcTy->isMatrixType());
----------------
rjmccall wrote:
> "Compatible" has a specific meaning in the C standard, so if you aren't intending to invoke that concept of compatibility, you should find a new word.
> 
> It looks like this kind of cast is supposed to be doing an elementwise conversion.  I guess all the types you can have matrices of are interconvertible, so there are no restrictions on the element types.  But you definitely need this to produce a new `CastKind` for elementwise conversion instead of using `CK_BitCast`, which does a bitwise reinterpretation, which is not what you want.
> 
> Matrix element types already have to be scalar types, so those checks aren't doing anything.
I see, so we need a new `CK_MatrixCast`, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99037



More information about the cfe-commits mailing list