[clang] [Clang][ABI] Classify floating-point matrix types as homogeneous aggregates (PR #222429)

Peter Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 07:19:46 PDT 2026


================
@@ -0,0 +1,72 @@
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -fenable-matrix -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,AAPCS
+// RUN: %clang_cc1 -triple arm64-apple-ios -target-abi darwinpcs -fenable-matrix -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,DARWIN
+
+typedef float __attribute__((matrix_type(2, 2))) f2x2;
+typedef float __attribute__((matrix_type(3, 3))) f3x3;
+typedef double __attribute__((matrix_type(2, 2))) d2x2;
+typedef int __attribute__((matrix_type(2, 2))) i2x2;
+
----------------
smithp35 wrote:

Would be useful to put a comment on what is expected so that the test output can be checked against it.

>From an AArch64 AAPCS perspective LargeMatrixStruct would not qualify as a homogeneous floating point aggregate (HFA) due to it being more than 4 * base member. The IntMatrixStruct is a homogeneous aggregate, but there's only special handling in the aapcs for HFA and HVA (homogeneous vector aggregates), it would get passed as a composite type with size <= 16 bytes.

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


More information about the cfe-commits mailing list