[PATCH] D72781: [Matrix] Add __builtin_matrix_column_load to Clang.

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 8 08:48:42 PDT 2020


fhahn updated this revision to Diff 269249.
fhahn added a comment.

Ping.

Applied feedback from D72778 <https://reviews.llvm.org/D72778> to this patch, improved tests, support conversions/placeholders.

One thing I am not sure is how to properly handle template substitutions for the pointer expression for code like the one below, where we need to apply substitutions to get the actual pointer type. Currently the patch looks through SubstTemplateTypeParmType types in Sema to construct the result type. Should we look through SubstTemplateTypeParmType in IRGen too to decide whether to call EmitPointerWithAlignment or EmitArrayToPointerDecay? Or is there a place in sema that should get rid of the substitution (perhaps in SemaChecking.cpp)?

  template <typename T> struct remove_pointer {
  typedef T type;
  };
  
  template <typename T> struct remove_pointer<T *>{
  typedef typename remove_pointer<T>::type type;
  };
  
  // Same as column_major_load_with_stride, but with the PtrT argument itself begin a pointer type.
  template <typename PtrT, unsigned R, unsigned C, unsigned S>
  matrix_t<typename remove_pointer<PtrT>::type, R, C> column_major_load_with_stride2(PtrT Ptr) {
  return __builtin_matrix_column_major_load(Ptr, R, C, S);
  }
  
  void call_column_major_load_with_stride2(float *Ptr) {
  matrix_t<float, 2, 2> m = column_major_load_with_stride2<float *, 2, 2, 2>(Ptr);
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72781

Files:
  clang/include/clang/AST/Type.h
  clang/include/clang/Basic/Builtins.def
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CodeGen/matrix-type-builtins.c
  clang/test/CodeGenCXX/matrix-type-builtins.cpp
  clang/test/CodeGenObjC/matrix-type-builtins.m
  clang/test/Sema/matrix-type-builtins.c
  clang/test/SemaCXX/matrix-type-builtins.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72781.269249.patch
Type: text/x-patch
Size: 29945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200608/c20efbbe/attachment-0001.bin>


More information about the cfe-commits mailing list