llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-codegen

Author: Andy Kaylor (andykaylor)

<details>
<summary>Changes</summary>

This adds support for handling homogeneous aggregate arguments in the AArch64 
implementation of the LLVM ABI library.

This required adding a new field to the llvm::abi::Type class to track the 
unadjusted alignment of the field. This meant I needed to make updates to the 
CIR calling convention lowering pass, but AArch64 isn't supported in the CIR 
pass yet, so that part of the change is strictly NFC at this point.

I'm removing the aarch64-pc-windows-msvc run lines from the 
abi-classify-arg-types.cpp test because the new test cases added would land in 
NYI diagnostic in isPermittedToBeHomogeneousAggregate(), and they weren't 
adding any unique coverage.

Assisted-by: Cursor / various models

---

Patch is 61.38 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/224138.diff


16 Files Affected:

- (modified) clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp (+7-2) 
- (modified) clang/lib/CodeGen/CGCall.cpp (+6-1) 
- (modified) clang/lib/CodeGen/QualTypeMapper.cpp (+11-4) 
- (modified) clang/test/CodeGen/AArch64/abi-classify-arg-types.c (+134-12) 
- (modified) clang/test/CodeGen/AArch64/abi-classify-arg-types.cpp (+65-10) 
- (modified) clang/test/CodeGen/AArch64/args-hfa.c (+13) 
- (modified) clang/test/CodeGen/AArch64/arguments-hfa-v3.c (+1) 
- (modified) llvm/include/llvm/ABI/Types.h (+24-12) 
- (modified) llvm/lib/ABI/Targets/AArch64.cpp (+31) 
- (modified) llvm/lib/ABI/Targets/X86.cpp (+3-2) 
- (modified) llvm/lib/ABI/Types.cpp (+13) 
- (modified) llvm/unittests/ABI/AArch64TargetInfoTest.cpp (+260-61) 
- (modified) llvm/unittests/ABI/FunctionInfoTest.cpp (+1) 
- (modified) llvm/unittests/ABI/IRTypeMapperTest.cpp (+2-1) 
- (modified) llvm/unittests/ABI/TypesTest.cpp (+28) 
- (modified) llvm/unittests/ABI/X86TargetInfoTest.cpp (+14-10) 


``````````diff
diff --git a/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp 
b/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
index f51ee6f9169a3..ae5f016fc3083 100644
--- a/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
+++ b/clang/lib/CIR/Dialect/Transforms/CallConvLoweringPass.cpp
@@ -408,9 +408,12 @@ static const llvm::abi::Type *mapCIRType(mlir::Type type,
         // Mapped with no fields, an empty record reaches Ignore on its own.
         // The size still matters: past two eightbytes SysV says memory 
whatever
         // the content.
+        // TODO: AArch64 needs the unadjusted alignment. We'll need to add that
+        // to RecordLayoutAttr.
         if (recTy.isEmptyForABI())
           return tb.getRecordType(
-              /*Fields=*/{}, sizeBits, align, 
llvm::abi::StructPacking::Default,
+              /*Fields=*/{}, sizeBits, align, /*UnadjustedAlign=*/align,
+              llvm::abi::StructPacking::Default,
               /*BaseClasses=*/{}, /*VirtualBaseClasses=*/{}, flags);
 
         SmallVector<llvm::abi::FieldInfo> fields;
@@ -487,6 +490,7 @@ static const llvm::abi::Type *mapCIRType(mlir::Type type,
                 mapCIRType(variantTy, typeMapper, dl, modOp)));
           }
           return tb.getUnionType(fields, sizeBits, align,
+                                 /*UnadjustedAlign=*/align,
                                  llvm::abi::StructPacking::Default, flags);
         }
 
@@ -521,7 +525,8 @@ static const llvm::abi::Type *mapCIRType(mlir::Type type,
         }
 
         return tb.getRecordType(
-            fields, sizeBits, align, llvm::abi::StructPacking::Default,
+            fields, sizeBits, align, /*UnadjustedAlign=*/align,
+            llvm::abi::StructPacking::Default,
             /*BaseClasses=*/{}, /*VirtualBaseClasses=*/{}, flags);
       })
       .Default([](mlir::Type) -> const llvm::abi::Type * {
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 13036b4cdd58c..44387bbd31d03 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1027,9 +1027,14 @@ ABIArgInfo CodeGenModule::convertABIArgInfo(const 
llvm::abi::ArgInfo &AbiInfo,
       CoercedType = AbiReverseMapper->convertType(AbiInfo.getCoerceToType());
     if (!CoercedType)
       CoercedType = getTypes().ConvertType(Type);
+    unsigned DirectAlign = 0;
+    if (llvm::MaybeAlign Align = AbiInfo.getDirectAlign())
+      DirectAlign = Align->value();
+    // TODO: Move Padding into the ABIArgInfo struct when we add support for
+    //       targets that need a different setting than we have here.
     return ABIArgInfo::getDirect(CoercedType, AbiInfo.getDirectOffset(),
                                  /*Padding=*/nullptr,
-                                 AbiInfo.getCanBeFlattened());
+                                 AbiInfo.getCanBeFlattened(), DirectAlign);
   }
   case llvm::abi::ArgInfo::Extend: {
     llvm::Type *CoercedType = nullptr;
diff --git a/clang/lib/CodeGen/QualTypeMapper.cpp 
b/clang/lib/CodeGen/QualTypeMapper.cpp
index a6e96c63446f6..5170ffd1ab81c 100644
--- a/clang/lib/CodeGen/QualTypeMapper.cpp
+++ b/clang/lib/CodeGen/QualTypeMapper.cpp
@@ -442,7 +442,8 @@ const llvm::abi::Type 
*QualTypeMapper::convertRecordType(const RecordType *RT) {
   const RecordDecl *RD = RT->getDecl()->getDefinition();
   if (!RD)
     return Builder.getRecordType({}, llvm::TypeSize::getFixed(0),
-                                 llvm::Align(1));
+                                 llvm::Align(1),
+                                 /*UnadjustedAlign=*/llvm::Align(1));
 
   if (RD->isUnion())
     return convertUnionType(RD);
@@ -508,6 +509,8 @@ QualTypeMapper::convertCXXRecordType(const CXXRecordDecl 
*RD) {
   llvm::TypeSize Size =
       llvm::TypeSize::getFixed(Layout.getSize().getQuantity() * 8);
   llvm::Align Alignment = llvm::Align(Layout.getAlignment().getQuantity());
+  llvm::Align UnadjustedAlign =
+      llvm::Align(Layout.getUnadjustedAlignment().getQuantity());
 
   llvm::abi::RecordFlags RecFlags = llvm::abi::RecordFlags::IsCXXRecord;
   if (RD->isPolymorphic())
@@ -517,7 +520,7 @@ QualTypeMapper::convertCXXRecordType(const CXXRecordDecl 
*RD) {
   if (RD->hasFlexibleArrayMember())
     RecFlags |= llvm::abi::RecordFlags::HasFlexibleArrayMember;
 
-  return Builder.getRecordType(Fields, Size, Alignment,
+  return Builder.getRecordType(Fields, Size, Alignment, UnadjustedAlign,
                                llvm::abi::StructPacking::Default, BaseClasses,
                                VirtualBaseClasses, RecFlags);
 }
@@ -556,6 +559,8 @@ QualTypeMapper::convertStructType(const clang::RecordDecl 
*RD) {
   llvm::TypeSize Size =
       llvm::TypeSize::getFixed(Layout.getSize().getQuantity() * 8);
   llvm::Align Alignment = llvm::Align(Layout.getAlignment().getQuantity());
+  llvm::Align UnadjustedAlign =
+      llvm::Align(Layout.getUnadjustedAlignment().getQuantity());
 
   llvm::abi::RecordFlags RecFlags = llvm::abi::RecordFlags::None;
   if (IsCXXRecord)
@@ -565,7 +570,7 @@ QualTypeMapper::convertStructType(const clang::RecordDecl 
*RD) {
   if (RD->hasFlexibleArrayMember())
     RecFlags |= llvm::abi::RecordFlags::HasFlexibleArrayMember;
 
-  return Builder.getRecordType(Fields, Size, Alignment,
+  return Builder.getRecordType(Fields, Size, Alignment, UnadjustedAlign,
                                llvm::abi::StructPacking::Default, {}, {},
                                RecFlags);
 }
@@ -586,6 +591,8 @@ QualTypeMapper::convertUnionType(const clang::RecordDecl 
*RD) {
   llvm::TypeSize Size =
       llvm::TypeSize::getFixed(Layout.getSize().getQuantity() * 8);
   llvm::Align Alignment = llvm::Align(Layout.getAlignment().getQuantity());
+  llvm::Align UnadjustedAlign =
+      llvm::Align(Layout.getUnadjustedAlignment().getQuantity());
 
   llvm::abi::RecordFlags RecFlags = llvm::abi::RecordFlags::None;
   if (RD->hasAttr<TransparentUnionAttr>())
@@ -595,7 +602,7 @@ QualTypeMapper::convertUnionType(const clang::RecordDecl 
*RD) {
   if (isa<CXXRecordDecl>(RD))
     RecFlags |= llvm::abi::RecordFlags::IsCXXRecord;
 
-  return Builder.getUnionType(AllFields, Size, Alignment,
+  return Builder.getUnionType(AllFields, Size, Alignment, UnadjustedAlign,
                               llvm::abi::StructPacking::Default, RecFlags);
 }
 
diff --git a/clang/test/CodeGen/AArch64/abi-classify-arg-types.c 
b/clang/test/CodeGen/AArch64/abi-classify-arg-types.c
index 7f0ba6ce6bfc3..1289e0be4e505 100644
--- a/clang/test/CodeGen/AArch64/abi-classify-arg-types.c
+++ b/clang/test/CodeGen/AArch64/abi-classify-arg-types.c
@@ -1,15 +1,15 @@
-// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-abi darwinpcs 
-fenable-matrix -fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | 
FileCheck %s --check-prefixes=CHECK,DARWIN,LONG64
-// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-abi darwinpcs 
-fenable-matrix -fexperimental-max-bitint-width=1024 
-fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--check-prefixes=CHECK,DARWIN,LONG64 --implicit-check-not="not yet implemented"
-// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -target-abi darwinpcs 
-fenable-matrix -fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | 
FileCheck %s --check-prefixes=CHECK,DARWIN,LONG32
-// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -target-abi darwinpcs 
-fenable-matrix -fexperimental-max-bitint-width=1024 
-fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--check-prefixes=CHECK,DARWIN,LONG32 --implicit-check-not="not yet implemented"
-// RUN: %clang_cc1 -triple aarch64-linux-gnu -fenable-matrix 
-fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,AAPCS,LONG64
-// RUN: %clang_cc1 -triple aarch64-linux-gnu -fenable-matrix 
-fexperimental-max-bitint-width=1024 -fexperimental-abi-lowering -emit-llvm -o 
- %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AAPCS,LONG64 
--implicit-check-not="not yet implemented"
-// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -fenable-matrix 
-fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,AAPCS,LONG64
-// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -fenable-matrix 
-fexperimental-max-bitint-width=1024 -fexperimental-abi-lowering -emit-llvm -o 
- %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AAPCS,LONG64 
--implicit-check-not="not yet implemented"
-// RUN: %clang_cc1 -triple aarch64-pc-windows-msvc -fenable-matrix 
-fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,AAPCS,LONG32
-// RUN: %clang_cc1 -triple aarch64-pc-windows-msvc -fenable-matrix 
-fexperimental-max-bitint-width=1024 -fexperimental-abi-lowering -emit-llvm -o 
- %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AAPCS,LONG32 
--implicit-check-not="not yet implemented"
-// RUN: %clang_cc1 -triple arm64ec-pc-windows-msvc -fenable-matrix 
-fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,AAPCS,LONG32
-// RUN: %clang_cc1 -triple arm64ec-pc-windows-msvc -fenable-matrix 
-fexperimental-max-bitint-width=1024 -fexperimental-abi-lowering -emit-llvm -o 
- %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AAPCS,LONG32 
--implicit-check-not="not yet implemented"
+// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-abi darwinpcs 
-fenable-matrix -fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | 
FileCheck %s --check-prefixes=CHECK,DARWIN,LONG64,NOHFAALIGN
+// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-abi darwinpcs 
-fenable-matrix -fexperimental-max-bitint-width=1024 
-fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--check-prefixes=CHECK,DARWIN,LONG64,NOHFAALIGN --implicit-check-not="not yet 
implemented"
+// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -target-abi darwinpcs 
-fenable-matrix -fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | 
FileCheck %s --check-prefixes=CHECK,DARWIN,LONG32,NOHFAALIGN
+// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -target-abi darwinpcs 
-fenable-matrix -fexperimental-max-bitint-width=1024 
-fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--check-prefixes=CHECK,DARWIN,LONG32,NOHFAALIGN --implicit-check-not="not yet 
implemented"
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -fenable-matrix 
-fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,AAPCS,LONG64,AAPCS64
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -fenable-matrix 
-fexperimental-max-bitint-width=1024 -fexperimental-abi-lowering -emit-llvm -o 
- %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AAPCS,LONG64,AAPCS64 
--implicit-check-not="not yet implemented"
+// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -fenable-matrix 
-fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,AAPCS,LONG64,AAPCS64
+// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -fenable-matrix 
-fexperimental-max-bitint-width=1024 -fexperimental-abi-lowering -emit-llvm -o 
- %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AAPCS,LONG64,AAPCS64 
--implicit-check-not="not yet implemented"
+// RUN: %clang_cc1 -triple aarch64-pc-windows-msvc -fenable-matrix 
-fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,AAPCS,LONG32,NOHFAALIGN
+// RUN: %clang_cc1 -triple aarch64-pc-windows-msvc -fenable-matrix 
-fexperimental-max-bitint-width=1024 -fexperimental-abi-lowering -emit-llvm -o 
- %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AAPCS,LONG32,NOHFAALIGN 
--implicit-check-not="not yet implemented"
+// RUN: %clang_cc1 -triple arm64ec-pc-windows-msvc -fenable-matrix 
-fexperimental-max-bitint-width=1024 -emit-llvm -o - %s | FileCheck %s 
--check-prefixes=CHECK,AAPCS,LONG32,NOHFAALIGN
+// RUN: %clang_cc1 -triple arm64ec-pc-windows-msvc -fenable-matrix 
-fexperimental-max-bitint-width=1024 -fexperimental-abi-lowering -emit-llvm -o 
- %s 2>&1 | FileCheck %s --check-prefixes=CHECK,AAPCS,LONG32,NOHFAALIGN 
--implicit-check-not="not yet implemented"
 
 // This test is verifying that the LLVM ABI library classifies argument types 
in
 // the same way that Clang does without the library.
@@ -110,3 +110,125 @@ void arg_bitint128(_BitInt(128) x) {}
 
 void arg_bitint129(_BitInt(129) x) {}
 // CHECK: define{{.*}} void @arg_bitint129(ptr nofreeobj noundef align 16 
dead_on_return dereferenceable(32) %{{.*}})
+
+// Homogeneous floating-point aggregates are coerced to an array of the base
+// type. AAPCS sets alignstack from unadjusted alignment (8, or 16 if the
+// unadjusted alignment is at least 16). DarwinPCS and Win64 do not.
+
+typedef struct {
+  float a, b;
+} HFA2f;
+void arg_hfa2f(HFA2f h) {}
+// AAPCS64: define{{.*}} void @arg_hfa2f([2 x float] alignstack(8) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_hfa2f([2 x float] %{{.*}})
+
+typedef struct {
+  double a, b, c, d;
+} HFA4d;
+void arg_hfa4d(HFA4d h) {}
+// AAPCS64: define{{.*}} void @arg_hfa4d([4 x double] alignstack(8) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_hfa4d([4 x double] %{{.*}})
+
+typedef struct {
+  float v[3];
+} HFA3arr;
+void arg_hfa3arr(HFA3arr h) {}
+// AAPCS64: define{{.*}} void @arg_hfa3arr([3 x float] alignstack(8) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_hfa3arr([3 x float] %{{.*}})
+
+typedef struct {
+  _Float16 a, b;
+} HFA2h;
+void arg_hfa2h(HFA2h h) {}
+// AAPCS64: define{{.*}} void @arg_hfa2h([2 x half] alignstack(8) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_hfa2h([2 x half] %{{.*}})
+
+typedef struct {
+  HFA2f inner;
+  float c;
+} HFANested;
+void arg_hfa_nested(HFANested h) {}
+// AAPCS64: define{{.*}} void @arg_hfa_nested([3 x float] alignstack(8) 
%{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_hfa_nested([3 x float] %{{.*}})
+
+typedef struct {
+  int : 0;
+  float a, b;
+} HFAZeroBF;
+void arg_hfa_zerobf(HFAZeroBF h) {}
+// AAPCS64: define{{.*}} void @arg_hfa_zerobf([2 x float] alignstack(8) 
%{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_hfa_zerobf([2 x float] %{{.*}})
+
+typedef union {
+  float a;
+  float v[3];
+} HFAUnion;
+void arg_hfa_union(HFAUnion h) {}
+// AAPCS64: define{{.*}} void @arg_hfa_union([3 x float] alignstack(8) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_hfa_union([3 x float] %{{.*}})
+
+void arg_complex_float(_Complex float c) {}
+// AAPCS64: define{{.*}} void @arg_complex_float([2 x float] {{(noundef 
)?}}alignstack(8) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_complex_float([2 x float] {{(noundef 
)?}}%{{.*}})
+
+typedef float f32x2 __attribute__((vector_size(8)));
+typedef float f32x4 __attribute__((vector_size(16)));
+
+typedef struct {
+  f32x2 a, b;
+} HVA2x64;
+void arg_hva2x64(HVA2x64 h) {}
+// AAPCS64: define{{.*}} void @arg_hva2x64([2 x <2 x float>] alignstack(8) 
%{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_hva2x64([2 x <2 x float>] %{{.*}})
+
+typedef struct {
+  f32x4 a, b;
+} HVA2x128;
+void arg_hva2x128(HVA2x128 h) {}
+// AAPCS64: define{{.*}} void @arg_hva2x128([2 x <4 x float>] alignstack(16) 
%{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_hva2x128([2 x <4 x float>] %{{.*}})
+
+// Record-level aligned(16) on a 16-byte HFA raises ABI alignment to 16 without
+// adding padding, so the type is still homogeneous. Unadjusted alignment is
+// still 8, so AAPCS must use alignstack(8), not 16.
+typedef struct __attribute__((aligned(16))) {
+  double a, b;
+} OveralignedHFA;
+void arg_overaligned_hfa(OveralignedHFA h) {}
+// AAPCS64: define{{.*}} void @arg_overaligned_hfa([2 x double] alignstack(8) 
%{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_overaligned_hfa([2 x double] %{{.*}})
+
+// aligned(32) on a 32-byte HFA likewise stays homogeneous. Unadjusted
+// alignment is 8, so AAPCS must not take the 16-byte cap.
+typedef struct __attribute__((aligned(32))) {
+  double a, b, c, d;
+} Overaligned32HFA;
+void arg_overaligned32_hfa(Overaligned32HFA h) {}
+// AAPCS64: define{{.*}} void @arg_overaligned32_hfa([4 x double] 
alignstack(8) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_overaligned32_hfa([4 x double] %{{.*}})
+
+// The unadjusted alignment of a union is tracked the same way. The widest
+// member is already 16 bytes, so aligned(16) adds no padding.
+typedef union __attribute__((aligned(16))) {
+  double a;
+  double v[2];
+} OveralignedUnionHFA;
+void arg_overaligned_union_hfa(OveralignedUnionHFA u) {}
+// AAPCS64: define{{.*}} void @arg_overaligned_union_hfa([2 x double] 
alignstack(8) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_overaligned_union_hfa([2 x double] 
%{{.*}})
+
+// Field alignment is part of unadjusted alignment, so AAPCS uses 16.
+typedef struct {
+  __attribute__((aligned(16))) double v[2];
+} FieldAlignedHFA;
+void arg_field_aligned_hfa(FieldAlignedHFA h) {}
+// AAPCS64: define{{.*}} void @arg_field_aligned_hfa([2 x double] 
alignstack(16) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_field_aligned_hfa([2 x double] %{{.*}})
+
+// Unadjusted alignment of 32 is capped at 16.
+typedef struct {
+  __attribute__((aligned(32))) double v[4];
+} FieldAligned32HFA;
+void arg_field_aligned32_hfa(FieldAligned32HFA h) {}
+// AAPCS64: define{{.*}} void @arg_field_aligned32_hfa([4 x double] 
alignstack(16) %{{.*}})
+// NOHFAALIGN: define{{.*}} void @arg_field_aligned32_hfa([4 x double] %{{.*}})
diff --git a/clang/test/CodeGen/AArch64/abi-classify-arg-types.cpp 
b/clang/test/CodeGen/AArch64/abi-classify-arg-types.cpp
index 3259e08eb65b8..0c883cf404212 100644
--- a/clang/test/CodeGen/AArch64/abi-classify-arg-types.cpp
+++ b/clang/test/CodeGen/AArch64/abi-classify-arg-types.cpp
@@ -1,13 +1,11 @@
-// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-abi darwinpcs -emit-llvm 
-o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-abi darwinpcs 
-fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--implicit-check-not="not yet implemented"
-// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -target-abi darwinpcs 
-emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -target-abi darwinpcs 
-fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--implicit-check-not="not yet implemented"
-// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple aarch64-linux-gnu -fexperimental-abi-lowering 
-emit-llvm -o - %s 2>&1 | FileCheck %s --implicit-check-not="not yet 
implemented"
-// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -emit-llvm -o - %s | FileCheck 
%s
-// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -fexperimental-abi-lowering 
-emit-llvm -o - %s 2>&1 | FileCheck %s --implicit-check-not="not yet 
implemented"
-// RUN: %clang_cc1 -triple aarch64-pc-windows-msvc -emit-llvm -o - %s | 
FileCheck %s
-// RUN: %clang_cc1 -triple aarch64-pc-windows-msvc -fexperimental-abi-lowering 
-emit-llvm -o - %s 2>&1 | FileCheck %s --implicit-check-not="not yet 
implemented"
+// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-abi darwinpcs -std=c++20 
-emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,NOHFAALIGN
+// RUN: %clang_cc1 -triple arm64-apple-ios7.0 -target-abi darwinpcs -std=c++20 
-fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--check-prefixes=CHECK,NOHFAALIGN --implicit-check-not="not yet implemented"
+// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -target-abi darwinpcs 
-std=c++20 -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,NOHFAALIGN
+// RUN: %clang_cc1 -triple arm64_32-apple-ios7.0 -target-abi darwinpcs 
-std=c++20 -fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--check-prefixes=CHECK,NOHFAALIGN --implicit-check-not="not yet implemented"
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++20 -emit-llvm -o - %s | 
FileCheck %s --check-prefixes=CHECK,AAPCS64
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -std=c++20 
-fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--check-prefixes=CHECK,AAPCS64 --implicit-check-not="not yet implemented"
+// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -std=c++20 -emit-llvm -o - %s 
| FileCheck %s --check-prefixes=CHECK,AAPCS64
+// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -std=c++20 
-fexperimental-abi-lowering -emit-llvm -o - %s 2>&1 | FileCheck %s 
--check-prefixes=CHECK,AAPCS64 --implicit-check-not="not yet implemented"
 
 // This test is verifying that the LLVM ABI library classifies C++ record
 // arguments that cannot be passed in registers the same way Clang does without
@@ -44,4 +42,61 @@ void arg_nontrivial_dtor_and_copy(NonTrivialDtorAndCopy a) {}
 void arg_explicit_copy(ExplicitCopy a) {}
 // CHECK: define{{.*}} void...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/224138
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to