[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-29 Thread Oliver Stannard via cfe-commits
@@ -588,7 +615,8 @@ ABIArgInfo ARMABIInfo::classifyReturnType(QualType RetTy, bool isVariadic, // Otherwise this is an AAPCS variant. - if (isEmptyRecord(getContext(), RetTy, true)) + if (isEmptyRecord(getContext(), RetTy, true) || + getContext().getTypeSize(RetTy)

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-29 Thread Oliver Stannard via cfe-commits
@@ -752,10 +780,13 @@ RValue ARMABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, CharUnits SlotSize = CharUnits::fromQuantity(4); // Empty records are ignored for parameter passing purposes. - if (isEmptyRecord(getContext(), Ty, true)) + uint64_t Size = getC

[clang] [AArch64] Match GCC behaviour for zero-size structs (PR #124760)

2025-01-29 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard closed https://github.com/llvm/llvm-project/pull/124760 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

2025-01-29 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard updated https://github.com/llvm/llvm-project/pull/124762 >From 4d883f068c5061e60e90e51d149a361920b431d2 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Thu, 12 Dec 2024 15:29:31 + Subject: [PATCH 1/5] [ARM] Empty structs are 1-byte for C++ ABI For C++ (but

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,50 @@ +// RUN: llvm-mc -triple=aarch64 %s -o - | FileCheck %s --check-prefix=ASM +// RUN: llvm-mc -triple=aarch64 -filetype=obj %s -o - | llvm-readelf --hex-dump=.ARM.attributes - | FileCheck %s --check-prefix=ELF + +// ASM: .aeabi_subsection private_subsection_1,

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -148,13 +150,177 @@ class AArch64TargetAsmStreamer : public AArch64TargetStreamer { OS << "\t.seh_save_any_reg_px\tq" << Reg << ", " << Offset << "\n"; } + void emitAttribute(StringRef VendorName, unsigned Tag, unsigned Value, + std::string Strin

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -7806,6 +7815,261 @@ bool AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired, return false; } +bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { + // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2 + // param

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -7806,6 +7815,261 @@ bool AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired, return false; } +bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { + // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2 + // param

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,80 @@ +// RUN: not llvm-mc -triple=aarch64 %s -o %t > %t.out 2>&1 +// RUN: FileCheck --input-file=%t.out --check-prefix=ERR %s + +.aeabi_subsection aeabi_pauthabi, optional, uleb128 +// ERR: error: aeabi_pauthabi must be marked as required +// ERR-NEXT: .aeabi_subsecti

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,140 @@ +//===-- AArch64BuildAttributes.cpp - AArch64 Build Attributes -===// +// +// 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: Ap

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,88 @@ +//===-- AArch64BuildAttributes.h - AARch64 Build Attributes -*- C++ -*-===// +// +// 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: Apa

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,140 @@ +//===-- AArch64BuildAttributes.cpp - AArch64 Build Attributes -===// +// +// 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: Ap

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,80 @@ +// RUN: not llvm-mc -triple=aarch64 %s -o %t > %t.out 2>&1 +// RUN: FileCheck --input-file=%t.out --check-prefix=ERR %s + +.aeabi_subsection aeabi_pauthabi, optional, uleb128 +// ERR: error: aeabi_pauthabi must be marked as required +// ERR-NEXT: .aeabi_subsecti

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,62 @@ +// RUN: not llvm-mc -triple=aarch64 %s -o %t > %t.out 2>&1 +// RUN: FileCheck --input-file=%t.out --check-prefix=ERR %s + +.aeabi_subsection aeabi_pauthabi, required, uleb128 +.aeabi_attribute Tag_Feature_BTI, 1 +// ERR: error: Unknown AArch64 build attribute 'T

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -7806,6 +7815,261 @@ bool AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired, return false; } +bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { + // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2 + // param

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -148,13 +150,177 @@ class AArch64TargetAsmStreamer : public AArch64TargetStreamer { OS << "\t.seh_save_any_reg_px\tq" << Reg << ", " << Offset << "\n"; } + void emitAttribute(StringRef VendorName, unsigned Tag, unsigned Value, + std::string Strin

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -7806,6 +7815,261 @@ bool AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired, return false; } +bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { + // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2 + // param

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -7806,6 +7815,261 @@ bool AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired, return false; } +bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { + // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2 + // param

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -54,6 +54,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/TargetRegistry.h" +#include "llvm/Support/ARMBuildAttributes.h" ostannard wrote: What are we using from `ARMBuildAttributes.h` in this file, and can it be moved

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -151,3 +151,97 @@ llvm::createAArch64ObjectTargetStreamer(MCStreamer &S, MCTargetStreamer *llvm::createAArch64NullTargetStreamer(MCStreamer &S) { return new AArch64TargetStreamer(S); } + +void AArch64TargetStreamer::emitAtributesSubsection( +StringRef VendorName, AArch

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,140 @@ +//===-- AArch64BuildAttributes.cpp - AArch64 Build Attributes -===// +// +// 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: Ap

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-13 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,62 @@ +// RUN: not llvm-mc -triple=aarch64 %s -o %t > %t.out 2>&1 ostannard wrote: The `not` only applies to the first command, so the `FileCheck` will run and report errors as normal. There are plenty of existing tests which do this, for example `te

[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #121943)

2025-01-15 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard updated https://github.com/llvm/llvm-project/pull/121943 >From 2a69ca9ba3b67967e0f88a9b96ac8bea44220842 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Thu, 19 Dec 2024 09:12:19 + Subject: [PATCH 1/3] [Clang] Re-write codegen for atomic_test_and_set and at

[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #121943)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -3686,12 +3687,18 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, C11CmpXchg, // bool __atomic_compare_exchange(A *, C *, CP, bool, int, int) -GNUCmpXchg +GNUCmpXchg, + +// bool __atomic_test_and_set(A *, int) +Test

[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #121943)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -3911,14 +3926,31 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, } } - // Pointer to object of size zero is not allowed. - if (RequireCompleteType(Ptr->getBeginLoc(), AtomTy, - diag::err_incomplete_type))

[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #121943)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -3963,8 +3995,8 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, return ExprError(); } - if (!IsC11 && !AtomTy.isTriviallyCopyableType(Context) && - !AtomTy->isScalarType()) { + if (!IsC11 && Form != TestAndSet && Form != Clear

[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #121943)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -284,11 +284,26 @@ void f(_Atomic(int) *i, const _Atomic(int) *ci, const volatile int flag_k = 0; volatile int flag = 0; - (void)(int)__atomic_test_and_set(&flag_k, memory_order_seq_cst); // expected-warning {{passing 'const volatile int *' to parameter of type 'vola

[clang] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #121943)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -1977,16 +1977,16 @@ def AtomicNandFetch : AtomicBuiltin { let Prototype = "void(...)"; } -def AtomicTestAndSet : Builtin { +def AtomicTestAndSet : AtomicBuiltin { let Spellings = ["__atomic_test_and_set"]; - let Attributes = [NoThrow]; - let Prototype = "bool(void v

[clang] [llvm] [AArch64] FEAT_SPEv1p2 is optional in v8.7-A and v9.2-A (PR #123336)

2025-01-17 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard created https://github.com/llvm/llvm-project/pull/123336 The FEAT_SPEv1p2 feature (known to LLVM as FeatureSPE_EEF and +spe-eef) was incorrectly marked as a required feature of Armv8.7-A (and later), which is incorrect because it is optional, and some CPUs do not i

[clang] [llvm] [AArch64] FEAT_SPEv1p2 is optional in v8.7-A and v9.2-A (PR #123336)

2025-01-17 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard updated https://github.com/llvm/llvm-project/pull/123336 >From 8f958b7099d9c6999731b7ce0305fcfbe4705940 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Fri, 17 Jan 2025 12:08:38 + Subject: [PATCH 1/3] [AArch64] refactor optional v9.x features inherited from

[clang] [llvm] [AArch64] FEAT_SPEv1p2 is optional in v8.7-A and v9.2-A (PR #123336)

2025-01-17 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard updated https://github.com/llvm/llvm-project/pull/123336 >From 8f958b7099d9c6999731b7ce0305fcfbe4705940 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Fri, 17 Jan 2025 12:08:38 + Subject: [PATCH 1/4] [AArch64] refactor optional v9.x features inherited from

[clang] [llvm] [AArch64] FEAT_SPEv1p2 is optional in v8.7-A and v9.2-A (PR #123336)

2025-01-17 Thread Oliver Stannard via cfe-commits
ostannard wrote: This is a system register only feature, but not one which we have enabled unconditionally. If we're going to turn it on only for architectures/CPUs which (can) have it, then I think it's better to be precise, which is what this patch does. Since it's only a system register we

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -7806,6 +7815,267 @@ bool AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired, return false; } +bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { + // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2 + // param

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -7806,6 +7815,267 @@ bool AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired, return false; } +bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { + // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2 + // param

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,123 @@ +//===-- AArch64BuildAttributes.cpp - AArch64 Build Attributes -===// +// +// 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: Ap

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -148,13 +150,151 @@ class AArch64TargetAsmStreamer : public AArch64TargetStreamer { OS << "\t.seh_save_any_reg_px\tq" << Reg << ", " << Offset << "\n"; } + void emitAttribute(StringRef VendorName, unsigned Tag, unsigned Value, + std::string Strin

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -148,13 +150,151 @@ class AArch64TargetAsmStreamer : public AArch64TargetStreamer { OS << "\t.seh_save_any_reg_px\tq" << Reg << ", " << Offset << "\n"; } + void emitAttribute(StringRef VendorName, unsigned Tag, unsigned Value, + std::string Strin

[clang] [llvm] [LLVM][Clang][AArch64] Implement AArch64 build attributes (PR #118771)

2025-01-15 Thread Oliver Stannard via cfe-commits
@@ -7806,6 +7815,267 @@ bool AArch64AsmParser::parseDirectiveSEHSaveAnyReg(SMLoc L, bool Paired, return false; } +bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { + // Expecting 3 AsmToken::Identifier after '.aeabi_subsection', a name and 2 + // param

[clang] [ARM, AArch64] Fix ABI bugs with over-sized bitfields (PR #126774)

2025-04-30 Thread Oliver Stannard via cfe-commits
ostannard wrote: That looks like the expected consequence of this change: * Previously, the anonymous bitfield was erroneously given a 64-bit container, so it occupied 7 copies of the container type, starting at byte 8 of the struct and ending at 64. * Now, it is given a 128-bit container, as r

[clang] [ARM][Driver] Fix i8mm feature string (PR #137771)

2025-04-29 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/137771 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix ABI bugs with over-sized bitfields (PR #126774)

2025-05-02 Thread Oliver Stannard via cfe-commits
ostannard wrote: I'd assumed that this was a sufficiently uncommon edge-case that it wasn't worth a release note, but I'll keep that in mind in future and add release notes for things like this. https://github.com/llvm/llvm-project/pull/126774 ___ cf

[clang] [ARM] Fix lane ordering for AdvSIMD intrinsics on big-endian targets (PR #127068)

2025-02-20 Thread Oliver Stannard via cfe-commits
ostannard wrote: Ping https://github.com/llvm/llvm-project/pull/127068 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix ABI bugs with over-sized bitfields (PR #126774)

2025-02-20 Thread Oliver Stannard via cfe-commits
ostannard wrote: Ping https://github.com/llvm/llvm-project/pull/126774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix ABI bugs with over-sized bitfields (PR #126774)

2025-02-20 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard closed https://github.com/llvm/llvm-project/pull/126774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ARM, AArch64] Fix ABI bugs with over-sized bitfields (PR #126774)

2025-02-20 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard updated https://github.com/llvm/llvm-project/pull/126774 >From 223eb6f3153bce087306f54c398034ff7a64c1d1 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Tue, 11 Feb 2025 17:40:55 + Subject: [PATCH 1/4] Add tests showing bugs --- clang/test/CodeGen/aapcs-al

<    1   2   3