[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, 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-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

[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-11 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard created https://github.com/llvm/llvm-project/pull/126774 This fixes two bugs in the ABI for over-sized bitfields for ARM and AArch64: The container type picked for an over-sized bitfield already contributes to the alignment of the structure, but it should also cont

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

2025-01-31 Thread Oliver Stannard via cfe-commits
ostannard wrote: /cherry-pick 97b066f4e92a0df46b9d10721e988210f0d1afb6 https://github.com/llvm/llvm-project/pull/124762 ___ 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-31 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard milestoned https://github.com/llvm/llvm-project/pull/124762 ___ 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-31 Thread Oliver Stannard via cfe-commits
ostannard wrote: /cherry-pick 97b066f4e92a0df46b9d10721e988210f0d1afb6 https://github.com/llvm/llvm-project/pull/124762 ___ 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-31 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard closed https://github.com/llvm/llvm-project/pull/124762 ___ 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-31 Thread Oliver Stannard via cfe-commits
ostannard wrote: The release notes have now been cleared on main, so I'll re-add them in the llvm-20 cherry pick. https://github.com/llvm/llvm-project/pull/124762 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

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

2025-01-31 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/7] [ARM] Empty structs are 1-byte for C++ ABI For C++ (but

[clang] [llvm] [ARM] Ensure FPU Selection can select mode correctly (PR #124935)

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

[clang] [llvm] [ARM] Ensure FPU Selection can select mode correctly (PR #124935)

2025-01-30 Thread Oliver Stannard via cfe-commits
@@ -1013,3 +1013,41 @@ // CHECK-MVE1_2: #define __ARM_FEATURE_MVE 1 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E -dM %s -o - | FileCheck -check-prefix=CHECK-MVE3 %s // CHECK-MVE3: #define __ARM_FEATURE_MVE 3 + +// Cortex-R52 and Cortex-R52Plus

[clang] [llvm] [ARM] Ensure FPU Selection can select mode correctly (PR #124935)

2025-01-30 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard approved this pull request. LGTM with one change to the tests, no need for re-review. https://github.com/llvm/llvm-project/pull/124935 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [llvm] [ARM] Ensure FPU Selection can select mode correctly (PR #124935)

2025-01-30 Thread Oliver Stannard via cfe-commits
@@ -1013,3 +1013,19 @@ // CHECK-MVE1_2: #define __ARM_FEATURE_MVE 1 // RUN: %clang -target arm-arm-none-eabi -march=armv8.1-m.main+mve.fp -x c -E -dM %s -o - | FileCheck -check-prefix=CHECK-MVE3 %s // CHECK-MVE3: #define __ARM_FEATURE_MVE 3 + +// Cortex-R52 and Cortex-R52Plus

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

2025-01-30 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/7] [ARM] Empty structs are 1-byte for C++ ABI For C++ (but

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

2025-01-29 Thread Oliver Stannard via cfe-commits
ostannard wrote: That last commit message should have been "llvm-20", not 19. https://github.com/llvm/llvm-project/pull/124762 ___ 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/6] [ARM] Empty structs are 1-byte for C++ ABI For C++ (but

[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] [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] [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
@@ -366,9 +387,15 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, bool isVariadic, return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory); } - // Ignore empty records. - if (isEmptyRecord(getContext(), Ty, true)) -return ABIArgInfo::ge

[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] [AArch64] Match GCC behaviour for zero-size structs (PR #124760)

2025-01-29 Thread Oliver Stannard via cfe-commits
ostannard wrote: I agree with @efriedma-quic that this is a very artificial test case, and I wouldn't expect anyone to hit this in reality (I only noticed it while copying the test for #124762), so it's not worth release-noting or adding a compatibility option. https://github.com/llvm/llvm-pr

[clang] [ARM] Forbid use of TLS with execute-only (PR #124806)

2025-01-29 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard updated https://github.com/llvm/llvm-project/pull/124806 >From 2a1fb2ed2a91cf0a3da2c24b7e4c68fd5fc81751 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Tue, 28 Jan 2025 17:49:42 + Subject: [PATCH] [ARM] Forbid use of TLS with execute-only Thread-local code

[clang] [ARM] Forbid use of TLS with execute-only (PR #124806)

2025-01-28 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard created https://github.com/llvm/llvm-project/pull/124806 Thread-local code generation requires constant pools because most of the relocations needed for it operate on data, so it cannot be used with -mexecute-only (or -mpure-code, which is aliased in the driver).

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

2025-01-28 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard created https://github.com/llvm/llvm-project/pull/124762 For C++ (but not C), empty structs should be passed to functions as if they are a 1 byte object with 1 byte alignment. This is defined in Arm's CPPABI32: https://github.com/ARM-software/abi-aa/blob/main/cpp

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

2025-01-28 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard created https://github.com/llvm/llvm-project/pull/124760 We had a test claiming that this empty struct type consumes a register slot when passing it to a function with GCC, but that does not appear to be the case, at least with GCC versions going back to 4.8. This

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

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

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

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

[clang] [llvm] [llvm][AArch64] apple-m4 does not have FEAT_{SPEv1p2,SEL2,MPAM} (PR #123827)

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

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

2025-01-21 Thread Oliver Stannard via cfe-commits
@@ -7858,20 +7858,19 @@ bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { Optionality); return true; } -if (HasActiveSubsection && -(SubsectionName == ActiveSubsection->VendorName)) { - if (IsOptional != ActiveSubs

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

2025-01-21 Thread Oliver Stannard via cfe-commits
@@ -7846,6 +7839,13 @@ bool AArch64AsmParser::parseDirectiveAeabiSubSectionHeader(SMLoc L) { return true; } + bool SubsectionExists = true; ostannard wrote: You don't need this extra `bool`, you can just check `if (ExistingSubsection)` below. https:

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

2025-01-21 Thread Oliver Stannard via cfe-commits
@@ -182,6 +182,16 @@ AArch64TargetStreamer::getActiveAtributesSubsection() { return nullptr; } +std::unique_ptr +AArch64TargetStreamer::getActiveSubsectionByName(StringRef name) { ostannard wrote: This name is misleading, because this function doesn't check

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

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

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

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

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

2025-01-20 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/5] [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
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
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] [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] [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
@@ -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
@@ -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
@@ -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] [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
@@ -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] [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
@@ -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] [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] [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,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
@@ -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
@@ -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
@@ -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
@@ -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,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,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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] [Clang] Re-write codegen for atomic_test_and_set and atomic_clear (PR #120449)

2025-01-07 Thread Oliver Stannard via cfe-commits
ostannard wrote: Updated version: #121943 https://github.com/llvm/llvm-project/pull/120449 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-01-07 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard created https://github.com/llvm/llvm-project/pull/121943 Re-write the sema and codegen for the atomic_test_and_set and atomic_clear builtin functions to go via AtomicExpr, like the other atomic builtins do. This simplifies the code, because AtomicExpr already handl

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

2025-01-07 Thread Oliver Stannard via cfe-commits
ostannard wrote: > Not added: Tests for attributes with NTBS values - currently all attributes > takes only ULEB128 as values. In order to have attributes that takes NTBS > values, new headers need to be defined. The `.aeabi_subsection` directive should accept any subsection name, only checki

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

2024-12-20 Thread Oliver Stannard via cfe-commits
ostannard wrote: Thanks for the revert, I'm on holiday now so I'll have another go at fixing this in the new year. https://github.com/llvm/llvm-project/pull/120449 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

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

2024-12-19 Thread Oliver Stannard via cfe-commits
@@ -793,20 +793,23 @@ void ARMTargetELFStreamer::switchVendor(StringRef Vendor) { void ARMTargetELFStreamer::emitAttribute(unsigned Attribute, unsigned Value) { getStreamer().setAttributeItem(Attribute, Value, - /* OverwriteExisting= */ true)

[clang] [clang-tools-extra] [Clang] Fix crash in __builtin_assume_aligned (PR #114217)

2024-12-19 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard closed https://github.com/llvm/llvm-project/pull/114217 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-12-19 Thread Oliver Stannard via cfe-commits
@@ -105,27 +107,55 @@ class MCELFStreamer : public MCObjectStreamer { unsigned Tag; unsigned IntValue; std::string StringValue; +AttributeItem(Types Ty, unsigned Tg, unsigned IV, std::string SV) +: Type(Ty), Tag(Tg), IntValue(IV), StringValue(SV) {} + }

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

2024-12-19 Thread Oliver Stannard via cfe-commits
@@ -151,3 +151,81 @@ llvm::createAArch64ObjectTargetStreamer(MCStreamer &S, MCTargetStreamer *llvm::createAArch64NullTargetStreamer(MCStreamer &S) { return new AArch64TargetStreamer(S); } + +void AArch64TargetStreamer::emitSubsection( ostannard wrote: The te

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

2024-12-19 Thread Oliver Stannard via cfe-commits
@@ -148,13 +151,133 @@ class AArch64TargetAsmStreamer : public AArch64TargetStreamer { OS << "\t.seh_save_any_reg_px\tq" << Reg << ", " << Offset << "\n"; } + void emitAttribute(unsigned VendorID, unsigned Tag, unsigned Value, + bool Override) overr

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

2024-12-19 Thread Oliver Stannard via cfe-commits
@@ -19,9 +19,74 @@ #define LLVM_SUPPORT_ARMBUILDATTRIBUTES_H #include "llvm/Support/ELFAttributes.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/TableGen/Record.h" namespace llvm { +class StringRef; + namespace ARMBuildAttrs { +// AArch64 build attributes --

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

2024-12-19 Thread Oliver Stannard via cfe-commits
@@ -783,6 +786,67 @@ void MCELFStreamer::createAttributesSection( AttrsVec.clear(); } +void MCELFStreamer::createAArch64AttributesSection( ostannard wrote: If this is AArch64 specific, it should be moved to one of the AArch64 classes, probably `AArch64Targ

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

2024-12-19 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard edited https://github.com/llvm/llvm-project/pull/118771 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-12-19 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard commented: It looks like this is still missing the ability to emit build attributes by number, for future attributes the assembler does not know about. There is also still a lot of new code here not covered by tests: * Tests for pauthabi platform/version in codegen

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

2024-12-19 Thread Oliver Stannard via cfe-commits
@@ -0,0 +1,30 @@ +// Test AArch64 build attributes to assmebly: 'aeabi_feature_and_bits' ostannard wrote: These clang tests should be removed. https://github.com/llvm/llvm-project/pull/118771 ___ cfe-commits mailing li

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

2024-12-19 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard closed https://github.com/llvm/llvm-project/pull/120449 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-12-19 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard updated https://github.com/llvm/llvm-project/pull/120449 >From 28174b0b54d36b070200d630bdeae64232264841 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Wed, 18 Dec 2024 15:46:02 + Subject: [PATCH 1/5] Add test for current behaviour --- clang/test/CodeGen/

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

2024-12-18 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard updated https://github.com/llvm/llvm-project/pull/120449 >From 28174b0b54d36b070200d630bdeae64232264841 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Wed, 18 Dec 2024 15:46:02 + Subject: [PATCH 1/4] Add test for current behaviour --- clang/test/CodeGen/

[clang] [Clang] Fix crash with implicit int-to-pointer conversion (PR #114218)

2024-12-18 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard closed https://github.com/llvm/llvm-project/pull/114218 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix crash with implicit int-to-pointer conversion (PR #114218)

2024-12-18 Thread Oliver Stannard via cfe-commits
ostannard wrote: > If __atomic_test_and_set is overloaded to have both a volatile and > non-volatile variant, it should be using custom type-checking in Sema. Looking at the code again, there's a separate system used to codegen most of the atomic builtins, so I've switched to using that. That

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

2024-12-18 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard created https://github.com/llvm/llvm-project/pull/120449 Re-write the sema and codegen for the atomic_test_and_set and atomic_clear builtin functions to go via AtomicExpr, like the other atomic builtins do. This simplifies the code, because AtomicExpr already handl

[clang] [llvm] [AArch64] Add soft-float ABI (PR #84146)

2024-12-18 Thread Oliver Stannard via cfe-commits
@@ -180,7 +180,7 @@ namespace { bool HandleTopLevelDecl(DeclGroupRef DG) override { // FIXME: Why not return false and abort parsing? - if (Diags.hasErrorOccurred()) + if (Diags.hasUnrecoverableErrorOccurred()) ostannard wrote: I think thi

[clang] [Clang] Fix crash in __builtin_assume_aligned (PR #114217)

2024-12-18 Thread Oliver Stannard via cfe-commits
@@ -74,7 +74,7 @@ int test13(int *a) { } int test14(int *a, int b) { - a = (int *)__builtin_assume_aligned(b, 32); // expected-error {{incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *}} + a = (int *)__builtin_assume_aligned(b, 32);

[clang] [Clang] Fix crash in __builtin_assume_aligned (PR #114217)

2024-12-18 Thread Oliver Stannard via cfe-commits
@@ -5272,8 +5272,11 @@ bool Sema::BuiltinAssumeAligned(CallExpr *TheCall) { { ExprResult FirstArgResult = DefaultFunctionArrayLvalueConversion(FirstArg); -if (checkBuiltinArgument(*this, TheCall, 0)) ostannard wrote: Done https://github.com/

[clang] [Clang] Fix crash in __builtin_assume_aligned (PR #114217)

2024-12-18 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard updated https://github.com/llvm/llvm-project/pull/114217 >From a657d11051c95473727ca5e9f6a8e8ab195fe590 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Wed, 30 Oct 2024 12:01:56 + Subject: [PATCH 1/3] [Clang] Fix crash in __builtin_assume_aligned The CodeG

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

2024-12-09 Thread Oliver Stannard via cfe-commits
ostannard wrote: The code changes are all in llvm (not clang), so the tests need to be there too, using `llvm-mc` and `llc` instead of `clang`. I'd prefer to see the code for the assembly parser before reviewing this, because that will probably affect the API design of the streamer, since it w

[clang] [llvm] [ARM] Add Cortex-A510 CPU for AArch32 (PR #118811)

2024-12-06 Thread Oliver Stannard via cfe-commits
https://github.com/ostannard closed https://github.com/llvm/llvm-project/pull/118811 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   >