[PATCH 8/8] middle-end: Extend compiler infrastructure for atomic min/max builtins

2025-09-03 Thread soumyaa
From: Soumya AR This patch extends various compiler components to handle the newly added atomic fetch min/max builtins: 1. Address Sanitizer (asan): Extended to recognize atomic min/max builtins and detect invalid memory accesses/overflows when these operations are used. 2. gimple-ssa-warn-a

[PATCH 7/8] libstdc++: Use new atomic fetch min/max builtins in std::atomic

2025-09-02 Thread soumyaa
From: Soumya AR This patch enables libstdc++ to implement C++26's atomic min/max operations through the newly added compiler builtins. Similar to the __atomic_fetch_addable and __atomic_fetch_subtractable concepts, we implement the following concepts for min/max operations: __atomic_fetch_minab

[PATCH 5/8] libatomic: Add support for atomic fetch min/max builtins

2025-09-02 Thread soumyaa
From: Soumya AR This patch implements __atomic_fetch_{min,max} and __atomic_{min,max}_fetch builtins in libatomic for both signed and unsigned integer types. --- We introduce a new signed type (STYPE) for casting signed operands in fop_n.c. Since all current libatomic operates on unsigned types

[PATCH 6/8] aarch64: Add backend support for atomic fetch min/max operations

2025-09-02 Thread soumyaa
From: Soumya AR This patch adds support for atomic min/max instructions offered by aarch64 under LSE. The implementation provides three execution paths: 1. When LSE is available at compile time (-march=armv8.1-a or later): Emits LSE atomic min/max instructions (ldsmin, ldsmax, ldumin, ldumax

[PATCH 4/8] middle-end + aarch64: Sanity tests for atomic min/max operations

2025-09-02 Thread soumyaa
From: Soumya AR This patch adds tests to verify the correctness of atomic min/max builtins at runtime and confirms CAS assembly on an actual target (in this case, aarch64). - atomic-minmax.c: Checks that we emit the correct libgcc calls that get resolved at runtime to determine if the syst

[PATCH 1/8] builtin: Add builtin types and function declarations for integer atomic fetch min/max

2025-09-01 Thread soumyaa
From: Soumya AR This patch adds builtin types and function declarations for integer atomic fetch min/max operations. --- At RTL level, we distinguish between signed and unsigned min/max operations based on the optab: SMIN/SMAX or UMIN/UMAX (rather than just using min/max) as signedness is not e

[PATCH 3/8] c,c++: Expand atomic min/max builtins to CAS loops

2025-09-01 Thread soumyaa
From: Soumya AR This patch adds support for expanding the following atomic min/max builtins: __atomic_fetch_min __atomic_fetch_max __atomic_min_fetch __atomic_max_fetch into compare-and-swap loops. --- expand_binop() is extended to handle min/max operations, either via a conditional move or a

[PATCH 2/8] optabs: Add sync optabs for atomic min/max operations

2025-09-01 Thread soumyaa
From: Soumya AR Add optab definitions for both legacy __sync and __atomic min/max operations. The legacy sync optabs are not expected to be implemented by backends. They're included to minimize branching in expand_atomic_fetch_op_no_fallback in gcc/optabs.cc, since this function attempts to emit

[PATCH 0/8] Implement integer atomic fetch min/max in GCC

2025-09-01 Thread soumyaa
From: Soumya AR Hi, This patch series implements support for integer atomic fetch min/max operations in GCC, backing the C++26 std::atomic::fetch_max and std::atomic::fetch_min operations. CC'ed in: The following maintainers according to parts of the compiler modified - middle-end maintainers:

[v3 PATCH 5/6] aarch64: Regression tests for parsing of user-provided AArch64 CPU tuning parameters

2025-08-25 Thread soumyaa
From: Soumya AR Signed-off-by: Soumya AR gcc/testsuite/ChangeLog: * gcc.target/aarch64/aarch64-json-tunings/aarch64-json-tunings.exp: New test. * gcc.target/aarch64/aarch64-json-tunings/boolean-1.c: New test. * gcc.target/aarch64/aarch64-json-tunings/boolean-1.json: Ne

[v3 PATCH 6/6] aarch64: Script to auto generate JSON tuning routines

2025-08-25 Thread soumyaa
From: Soumya AR This commit introduces a Python maintenance script that generates C++ code for parsing and serializing AArch64 JSON tuning parameters based on the schema defined in aarch64-json-schema.h. The script generates two include files: - aarch64-json-tunings-parser-generated.inc - aa

[v3 PATCH 2/6] aarch64: Enable dumping of AArch64 CPU tuning parameters to JSON

2025-08-25 Thread soumyaa
From: Soumya AR This patch adds functionality to dump AArch64 CPU tuning parameters to a JSON file. The new '-fdump-tuning-model=' flag allows users to export the current tuning model configuration to a JSON file. This patch was bootstrapped and regtested on aarch64-linux-gnu, no regression. Si

[v3 PATCH 4/6] aarch64: Enable parsing of user-provided AArch64 CPU tuning parameters

2025-08-25 Thread soumyaa
From: Soumya AR This patch adds support for loading custom CPU tuning parameters from a JSON file for AArch64 targets. The '-muser-provided-CPU=' flag accepts a user provided JSON file and overrides the internal tuning parameters at GCC runtime. This patch was bootstrapped and regtested on aarch

[v3 PATCH 1/6] aarch64 + arm: Remove const keyword from tune_params members and nested members

2025-08-25 Thread soumyaa
From: Soumya AR To allow runtime updates to tuning parameters, the const keyword is removed from the members of the tune_params structure and the members of its nested structures. Since this patch also touches tuning structures in the arm backend, it was bootstrapped on aarch64-linux-gnu as well

[PATCH 3/6] json: Add get_map() method to JSON object class

2025-08-25 Thread soumyaa
From: Soumya AR This patch adds a get_map () method to the JSON object class to provide access to the underlying hash map that stores the JSON key-value pairs. To do this, we expose the map_t typedef, the return type of get_map(). This change is needed to allow traversal of key-value pairs when

[v3 PATCH 0/6] aarch64: Support for user-defined aarch64 tuning

2025-08-25 Thread soumyaa
From: Soumya AR Hi, This is a follow-up to suggestions given on v2 of the aarch64 user-defined tunings. https://gcc.gnu.org/pipermail/gcc-patches/2025-July/689893.html Attaching an updated patch series here. Regarding some questions on this thread: I've made the changes suggested by Andrew

[RFC PATCH v2 3/6] json: Add get_map() method to JSON object class

2025-07-17 Thread soumyaa
From: Soumya AR This patch adds a get_map () method to the JSON object class to provide access to the underlying hash map that stores the JSON key-value pairs. It also reorganizes the private and public sections of the class to expose the map_t typedef, which is the return type of get_map(). Th

[RFC PATCH v2 1/6] aarch64 + arm: Remove const keyword from tune_params members and nested members

2025-07-17 Thread soumyaa
From: Soumya AR To allow runtime updates to tuning parameters, the const keyword is removed from the members of the tune_params structure and the members of its nested structures. Since this patch also touches tuning structures in the arm backend, it was bootstrapped on aarch64-linux-gnu as well

[RFC PATCH v2 4/6] aarch64: Enable parsing of user-provided AArch64 CPU tuning parameters

2025-07-17 Thread soumyaa
From: Soumya AR This patch adds support for loading custom CPU tuning parameters from a JSON file for AArch64 targets. The '-muser-provided-CPU=' flag accepts a user provided JSON file and overrides the internal tuning parameters at GCC runtime. This patch was bootstrapped and regtested on aarch

[RFC PATCH v2 2/6] aarch64: Enable dumping of AArch64 CPU tuning parameters to JSON

2025-07-17 Thread soumyaa
From: Soumya AR This patch adds functionality to dump AArch64 CPU tuning parameters to a JSON file. The new '-fdump-tuning-model=' flag allows users to export the current tuning model configuration to a JSON file. This patch was bootstrapped and regtested on aarch64-linux-gnu, no regression. Si

[RFC PATCH v2 6/6] aarch64: Script to auto generate JSON tuning routines

2025-07-17 Thread soumyaa
From: Soumya AR This commit introduces a Python maintenance script that generates C++ code for parsing and serializing AArch64 JSON tuning parameters based on the schema defined in aarch64-json-schema.h. The script generates two include files: - aarch64-json-tunings-parser-generated.inc - aa

[RFC PATCH v2 5/6] aarch64: Regression tests for parsing of user-provided AArch64 CPU tuning parameters

2025-07-17 Thread soumyaa
From: Soumya AR Signed-off-by: Soumya AR gcc/testsuite/ChangeLog: * gcc.target/aarch64/aarch64-json-tunings/aarch64-json-tunings.exp: New test. * gcc.target/aarch64/aarch64-json-tunings/boolean-1.c: New test. * gcc.target/aarch64/aarch64-json-tunings/boolean-1.json: Ne

[RFC PATCH v2 0/6] aarch64: Support for user-defined aarch64 tuning parameters in JSON

2025-07-17 Thread soumyaa
From: Soumya AR Hi, This RFC is a continuation of previous patches sent here: https://gcc.gnu.org/pipermail/gcc-patches/2025-May/682702.html As suggested in the earlier thread, I've now added a python script to generete the printing and parsing routines for the JSON tuning parameters from the

[RFC PATCH 1/5] aarch64 + arm: Remove const keyword from tune_params members and nested members

2025-05-06 Thread soumyaa
From: Soumya AR To allow runtime updates to tuning parameters, the const keyword is removed from aarch64 tune_params and all its nested structures and structure members. Since this patch also touches tuning structures in the arm backend, it was bootstrapped on aarch64-linux-gnu as well as arm-li

[RFC PATCH 5/5] aarch64: Regression tests for parsing of user-provided AArch64 CPU tuning parameters

2025-05-06 Thread soumyaa
From: Soumya AR This patch was bootstrapped and regtested on aarch64-linux-gnu, no regression. Signed-off-by: Soumya AR gcc/testsuite/ChangeLog: * gcc.target/aarch64/aarch64-json-tunings/aarch64-json-tunings.exp: New test. * gcc.target/aarch64/aarch64-json-tunings/boolean-1.c

[RFC PATCH 4/5] aarch64: Enable parsing of user-provided AArch64 CPU tuning parameters

2025-05-06 Thread soumyaa
From: Soumya AR This patch adds support for loading custom CPU tuning parameters from a JSON file for AArch64 targets. The '-muser-provided-CPU=' flag accepts a user provided JSON file and overrides the internal tuning parameters at GCC runtime. This patch was bootstrapped and regtested on aarch

[RFC PATCH 2/5] aarch64: Enable dumping of AArch64 CPU tuning parameters to JSON

2025-05-06 Thread soumyaa
From: Soumya AR This patch adds functionality to dump AArch64 CPU tuning parameters to a JSON file. The new '-fdump-tuning-model=' flag allows users to export the current tuning model configuration to a JSON file. This patch was bootstrapped and regtested on aarch64-linux-gnu, no regression. Si

[RFC PATCH 3/5] json: Add get_map() method to JSON object class

2025-05-06 Thread soumyaa
From: Soumya AR This patch adds a get_map () method to the JSON object class to provide access to the underlying hash map that stores the JSON key-value pairs. It also reorganizes the private and public sections of the class to expose the map_t typedef, which is the return type of get_map(). Th

[RFC PATCH 0/5] aarch64: Support for user-defined aarch64 tuning parameters in JSON

2025-05-06 Thread soumyaa
From: Soumya AR Hi, This RFC and subsequent patch series introduces support for printing and parsing of aarch64 tuning parameters in the form of JSON. It is important to note that this mechanism is specifically intended for power users to experiment with tuning parameters. This proposal does no