[clang] [CIR] Upstream initial support for fixed size VectorType (PR #136488)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 21 11:17:37 PDT 2025
================
@@ -637,6 +637,41 @@ ArrayType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
return dataLayout.getTypeABIAlignment(getEltType());
}
+//===----------------------------------------------------------------------===//
+// VectorType Definitions
+//===----------------------------------------------------------------------===//
+
+llvm::TypeSize cir::VectorType::getTypeSizeInBits(
+ const ::mlir::DataLayout &dataLayout,
+ ::mlir::DataLayoutEntryListRef params) const {
+ return llvm::TypeSize::getFixed(getSize() *
+ dataLayout.getTypeSizeInBits(getEltType()));
+}
+
+uint64_t
+cir::VectorType::getABIAlignment(const ::mlir::DataLayout &dataLayout,
+ ::mlir::DataLayoutEntryListRef params) const {
+ return llvm::NextPowerOf2(dataLayout.getTypeSizeInBits(*this));
+}
+
+mlir::LogicalResult cir::VectorType::verify(
+ llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
+ mlir::Type eltType, uint64_t size) {
----------------
bcardosolopes wrote:
Thanks for adding this, note you also need to add tests for the invalid inputs!
https://github.com/llvm/llvm-project/pull/136488
More information about the cfe-commits
mailing list