[PATCH] D101696: [Matrix] Implement C-style explicit type conversions in CXX for matrix types

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 3 02:11:44 PDT 2021


fhahn added a comment.

Thanks for the update! Technically the fix in `clang/lib/CodeGen/CGExprScalar.cpp` is unrelated to C++ support. It would be great if you could put up a separate patch, so we can land this independently.

The whole patch basically LGTM. It would be great if you could add a test casting from unsigned to float/double (looks like no test generates `uitofp`) and a test for casting between signed & unsigned integers of the same size (unless there are already tests for that I missed)



================
Comment at: clang/lib/CodeGen/CGExprScalar.cpp:1209
-    // Allow bitcast between matrixes of the same size.
-    if (SrcTy->getPrimitiveSizeInBits() == DstTy->getPrimitiveSizeInBits())
-      return Builder.CreateBitCast(Src, DstTy, "conv");
----------------
Could you s


================
Comment at: clang/test/CodeGenCXX/matrix-casts.cpp:4
+template <typename X>
+
+using matrix_4_4 = X __attribute__((matrix_type(4, 4)));
----------------
nit: drop the newline here and before `using matrix_5_5...`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101696



More information about the cfe-commits mailing list