[PATCH 1/8] [RFC] Define new floating point builtin fetch_add functions

2024-09-19 Thread mmalcomson
From: Matthew Malcomson This commit just defines the new names -- as yet don't implement them. Saving this commit because this is one decision, and recording what the decision was and why: Adding new floating point builtins for each floating point type that is defined in the general code *except

[PATCH 0/8] [RFC] Introduce floating point fetch_add builtins

2024-09-19 Thread mmalcomson
From: Matthew Malcomson Hello, this is an RFC for adding an atomic floating point fetch_add builtin (and variants) to GCC. The atomic fetch_add operation is defined to work on the base floating point types in the C++20 standard chapter 31.7.3, and extended to work for all cv-unqualified floating

[PATCH 7/8] [RFC] Mention floating point atomic fetch_add etc in docs

2024-09-19 Thread mmalcomson
From: Matthew Malcomson Signed-off-by: Matthew Malcomson --- gcc/doc/extend.texi | 12 1 file changed, 12 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 66c99ef7a66..a3e3e7da5d6 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -13501,6 +135

[PATCH 3/8] [RFC] Tie the new atomic builtins to the backend

2024-09-19 Thread mmalcomson
From: Matthew Malcomson Need to implement something in the Things implemented in this patch: 1) Update the optabs definitions to include floating point versions of atomic fetch_add variants. 2) When expanding into a CAS loop in RTL because the floating point optab is not implemented, there

[PATCH 8/8] [RFC] Add demo implementation of one of the operations

2024-09-19 Thread mmalcomson
From: Matthew Malcomson Do demo implementation in AArch64 since that's the backend I'm most familiar with. Nothing much else to say -- nice to see that the demo implementation seems to work as expected (being used for fetch_add, add_fetch and sub_fetch even though it's only defined for fetch_sub

[PATCH 2/8] [RFC] Add FP types for atomic builtin overload resolution

2024-09-19 Thread mmalcomson
From: Matthew Malcomson Have a bit of an ugly mapping from floating point type to the builtin using that type. Would like to find some code-sharing between this, the function (in a later patch in this series) that finds the relevant mode from a given builtin, and the general sync-builtins.def fi

[PATCH 5/8] [RFC] Use new builtins in libstdc++

2024-09-19 Thread mmalcomson
From: Matthew Malcomson Points to question here are: 1) Whether checking for this particular internal builtin is OK (this one happens to be the one implementing the operation for a `double`, we would have to rely on the approach that if anyone implements this operation for a `double` the

[PATCH 4/8] [RFC] Have libatomic working as first draft

2024-09-19 Thread mmalcomson
From: Matthew Malcomson As it stands there are still a few things to look at whether they could be improved: 1) Need to find the exact version of automake to use. I'm using automake 1.15.1 from https://ftp.gnu.org/gnu/automake/ but the header is claiming I'm using automake 1.15. 2) The int

[PATCH 04/11] builtins: Add FP types for atomic builtin overload resolution

2024-11-14 Thread mmalcomson
From: Matthew Malcomson N.b. we match which function to use based on the MODE of the type for two reasons: 1) Can't match directly on type as otherwise `typedef float x` would mean that `x` could no longer be used with that intrinsic. 2) MODE (i.e. the types ABI) is the thing that we need to d

[PATCH 00/11] Add FP overloads for __atomic_fetch_add etc

2024-11-14 Thread mmalcomson
From: Matthew Malcomson Hello, This is the revision of the RFC posted here: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/663355.html This patchset introduces floating point versions of atomic fetch_add, fetch_sub, add_fetch and sub_fetch. Instructions for performing these operation

[PATCH 08/11] c: c++: flag to disable fetch_op handling fenv exceptions

2024-11-14 Thread mmalcomson
From: Matthew Malcomson N.b. including docs maintainers to ask about whether this flag should be documented in invoke.texi -- I suspect that would be determined partly based on the feedback I get on this patch about whether it should be something mostly for the testsuite and otherwise internally

[PATCH 06/11] builtins: optab: Tie the new atomic builtins to the backend

2024-11-14 Thread mmalcomson
From: Matthew Malcomson Not sure who to Cc for this. Honestly just guessing a bit here. Please do redirect me if anyone knows of a better set of people to ask. -- >8 --- 8< --- Update the optabs definitions to include floating point versions of atomic fetch_add variants

[PATCH 01/11] libatomic: Split concept of SUFFIX and SIZE in libatomic

2024-11-14 Thread mmalcomson
From: Matthew Malcomson Cc'ing in build machinery maintainers who can hopefully check the validity of those changes. N.b. would appreciate information on who to Cc in for the libatomic parts of this patch. I don't see anyone in the MAINTAINERS file against libatomic. -- >8 ---

[PATCH 07/11] testsuite: Add tests for fp resolutions of __atomic_fetch_add

2024-11-14 Thread mmalcomson
From: Matthew Malcomson N.b. including testsuite maintainers hoping for review of the new effective targets I've added. -- >8 --- 8< --- Tests we include are: - A set of tests checking the observed arithmetic behaviour of the new builtins. - A test ensuring the floating

[PATCH 03/11] c: c++: Define new floating point builtin fetch_add functions

2024-11-14 Thread mmalcomson
From: Matthew Malcomson Not sure who to Cc for this. Honestly just guessing a bit here. Please do redirect me if anyone knows of a better set of people to ask. -- >8 --- 8< --- This commit just defines the new names -- as yet don't implement them. Saving this commit bec

[PATCH 05/11] c: c++: Expand into CAS loop in frontend

2024-11-14 Thread mmalcomson
From: Matthew Malcomson Use wrapper in builtins.cc to check if required. N.b. if there are any floating point types that are available but not as arithmetic types or simply not available, that should be handled by the sync_resolve_size check against available types. We add an assertion in the C

[PATCH 09/11] doc: Mention floating point atomic fetch_add etc in docs

2024-11-14 Thread mmalcomson
From: Matthew Malcomson Do not mention suffixed versions since integral suffixed versions are not mentioned in existing docs. gcc/ChangeLog: * doc/extend.texi: Document ability to use floating point atomic fetch_add/fetch_sub/add_fetch/sub_fetch builtins. Signed-off-by: Matthew

[PATCH 10/11] [Not For Commit] Add demo implementation of one of the operations

2024-11-14 Thread mmalcomson
From: Matthew Malcomson Do demo implementation in AArch64 since that's the backend I'm most familiar with. Nothing much else to say -- nice to see that the demo implementation seems to work as expected (being used for fetch_add, add_fetch and sub_fetch even though it's only defined for fetch_sub

[PATCH 11/11] [Not For Commit] Link libatomic into tests when available

2024-11-14 Thread mmalcomson
From: Matthew Malcomson This is not to go into the upstream. This was used for testing. This patch set is supposed to be upstreamed in combination with a patchset automatically linking in libatomic when compiling. The two patchsets are being worked on in parallel. Some of the tests in this ser

[PATCH] clang-format BraceWrapping.AfterCaseLabel to true

2024-12-04 Thread mmalcomson
From: Matthew Malcomson This setting seems to better match the indentation that is used in GCC. Adds an exra level of indentation after braces in a case statement. Only manual testing done on the switch statements in c-common.cc:resolve_overloaded_builtin and alias.cc:record_component_aliases.

[PATCH] clang-format AlwaysBreakAfterReturnType to TopLevelDefinitions

2024-12-09 Thread mmalcomson
From: Matthew Malcomson The previous value of TopLevel meant that the function name of declarations would also be on a new line. This does not match the current formatting of headers. Manual testing done on c-common.h. Also set BraceWrapping.BeforeWhile to true to match the formatting specifie

[PATCH] gcc: testsuite: Fix builtin-speculation-overloads[14].C testism

2025-02-12 Thread mmalcomson
From: Matthew Malcomson I've posted the patch on the relevant Bugzilla, but also sending to mailing list. If should have only done one please do mention. - 8< --- >8 When making warnings trigger a failure in template substitution I could not find any way

[PATCH] libstdc++: editorconfig: Adjust wildcard patterns

2024-12-06 Thread mmalcomson
From: Matthew Malcomson According to the editorconfig file format description, a match against one of multiple different strings is described with those different strings separated by commas and within curly braces. E.g. [{x,y}.txt] https://editorconfig.org/, under "Wildcard Patterns". The

[PATCH] testsuite: libitm: Adjust how libitm.c++ passes link flags

2025-01-02 Thread mmalcomson
From: Matthew Malcomson For the `gcc` and `g++` tools we often pass -B/path/to/object/dir in via `TEST_ALWAYS_FLAGS` (see e.g. asan.exp where this is set). In libitm.c++/c++.exp we pass that -B flag via the `tool_flags` argument to `dg-runtest`. Passing as the `tool_flags` argument means that th