[PATCH] D77735: [SveEmitter] Implement builtins for gathers/scatters

Sander de Smalen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 20 08:37:45 PDT 2020


sdesmalen added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:7601
+  llvm::Type *SrcDataTy = getSVEType(TypeFlags);
+  llvm::Type *OverloadedTy = llvm::VectorType::get(
+      SVEBuiltinMemEltTy(TypeFlags), SrcDataTy->getVectorElementCount());
----------------
nit: This can use `auto`, which would make OverloadedTy a `llvm::VectorType`


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:7602
+  llvm::Type *OverloadedTy = llvm::VectorType::get(
+      SVEBuiltinMemEltTy(TypeFlags), SrcDataTy->getVectorElementCount());
+
----------------
Just be aware that `getVectorElementCount` has been removed from Type in D77278, so you'll need to cast to `VectorType` and use `getElementCount` instead.
(fyi - in D77596 I've made `getSVEType` actually return a VectorType so that cast wouldn't be needed)


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:7635
+  // the actual type being stored. Cast accordingly.
+  Ops[1] = EmitSVEPredicateCast(Ops[1], cast<llvm::VectorType>(OverloadedTy));
+
----------------
You can remove the `cast<llvm::VectorType>` if you make the variable use `auto`.
(these comments apply equally to EmitSVEGatherLoad)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77735





More information about the cfe-commits mailing list