[llvm] [VFABI] Add support for vector functions that return struct types (PR #119000)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 12 05:17:20 PST 2024
================
@@ -0,0 +1,73 @@
+//===----------- VectorUtils.cpp - Vector type utility functions ----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/CallWideningUtils.h"
+#include "llvm/ADT/SmallVectorExtras.h"
+#include "llvm/IR/VectorUtils.h"
+
+using namespace llvm;
+
+/// A helper for converting to wider (vector) types. For scalar types, this is
+/// equivalent to calling `ToVectorTy`. For struct types, this returns a new
+/// struct where each element type has been widened to a vector type. Note: Only
+/// unpacked literal struct types are supported.
+Type *llvm::ToWideTy(Type *Ty, ElementCount EC) {
----------------
david-arm wrote:
It might be worth adding a note that for now the only strategy we support is one where we widen the individual struct members, but in theory it could be extended to other strategies, for example a `struct { i32, i32 }` with a given VF could return a vector of VF x 2 elements.
https://github.com/llvm/llvm-project/pull/119000
More information about the llvm-commits
mailing list