[llvm] [VFABI] Add support for vector functions that return struct types (PR #119000)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 01:59:42 PST 2024


================
@@ -753,6 +753,73 @@ TEST_F(VFABIParserTest, ParseVoidReturnTypeSVE) {
   EXPECT_EQ(VectorName, "vector_foo");
 }
 
+TEST_F(VFABIParserTest, ParseWideStructReturnTypeSVE) {
+  EXPECT_TRUE(
+      invokeParser("_ZGVsMxv_foo(vector_foo)", "{double, double}(float)"));
+  EXPECT_EQ(ISA, VFISAKind::SVE);
+  EXPECT_TRUE(isMasked());
+  FunctionType *FTy = FunctionType::get(
+      StructType::get(
+          VectorType::get(Type::getDoubleTy(Ctx), ElementCount::getScalable(2)),
----------------
david-arm wrote:

Perhaps you can reduce total code size by declaring a local variable for `ElementCount::getScalable(2)`? For example,

```
  ElementCount EC2 = ElementCount::getScalable(2);
...
      StructType::get(
          VectorType::get(Type::getDoubleTy(Ctx), EC),
...
```

I think you can do something similar for the other tests below as well.

https://github.com/llvm/llvm-project/pull/119000


More information about the llvm-commits mailing list