Re: [PATCH] asf: Enable pass at O2 or higher

2025-04-22 Thread Konstantinos Eleftheriou
We have sent a new version for this, with updated testcases (https://gcc.gnu.org/pipermail/gcc-patches/2025-April/681606.html). Thanks, Konstantinos On Wed, Jan 29, 2025 at 8:32 PM Richard Sandiford wrote: > > Christoph Müllner writes: > > The avoid-store-forwarding pass is disabled by default

[PATCH v2] asf: Enable pass at O2 or higher

2025-04-22 Thread Konstantinos Eleftheriou
The avoid-store-forwarding pass is disabled by default and therefore in the risk of bit-rotting. This patch addresses this by enabling the pass at O2 or higher. The assembly patterns in `bitfield-bitint-abi-align16.c` and `bitfield-bitint-abi-align8.c` have been updated to account for the asf tra

[PING][PATCH] doc: Clarify REG_EH_REGION note usage

2025-04-10 Thread Konstantinos Eleftheriou
Hi, Just a ping for https://gcc.gnu.org/pipermail/gcc-patches/2025-March/677635.html. Thanks, Konstantinos

[PING][PATCH v3] reassoc: Optimize CMP/XOR expressions [PR116860]

2025-04-10 Thread Konstantinos Eleftheriou
Hi, Just a ping for https://gcc.gnu.org/pipermail/gcc-patches/2025-March/677788.html . Thanks, Konstantinos

[PATCH] avoid-store-forwarding: Fix reg init on load-elimination [PR119160]

2025-03-28 Thread Konstantinos Eleftheriou
In the case that we are eliminating the load instruction, we use zero_extend for the initialization of the base register for the zero-offset store. This causes issues when the store and the load use the same mode, as we are trying to generate a zero_extend with the same inner and outer modes. This

Re: [PATCH v2] reassoc: Optimize CMP/XOR expressions [PR116860]

2025-03-17 Thread Konstantinos Eleftheriou
On Sun, Mar 16, 2025 at 8:42 PM Sam James wrote: > > Hans-Peter Nilsson writes: > > > On Thu, 13 Mar 2025, Konstantinos Eleftheriou wrote: > >> Testcases for match.pd patterns > >> `((a ^ b) & c) cmp d | a != b -> (0 cmp d | a != b)` and > >> `(

[PATCH v3] reassoc: Optimize CMP/XOR expressions [PR116860]

2025-03-17 Thread Konstantinos Eleftheriou
Testcases for match.pd patterns `((a ^ b) & c) cmp d | a != b -> (0 cmp d | a != b)` and `(a ^ b) cmp c | a != b -> (0 cmp c | a != b)` were failing on some targets, like PowerPC. This patch adds an implemenetation for the optimization in reassoc. Doing so, we can now handle cases where the relate

[PATCH] Move COMP/XOR optimization from match.pd into reassoc [PR116860]

2025-03-15 Thread Konstantinos Eleftheriou
Testcases for patterns `((a ^ b) & c) cmp d | a != b -> (0 cmp d | a != b)` and `(a ^ b) cmp c | a != b -> (0 cmp c | a != b)` were failing on some targets, like PowerPC. This patch moves the optimization to reassoc. Doing so, we can now handle cases where the related conditions appear in an AND e

[PATCH] doc: Clarify REG_EH_REGION note usage

2025-03-14 Thread Konstantinos Eleftheriou
The documentation for the REG_EH_REGION could easily be read (especially by non-native speakers) to indicate that it should be attached to insn at the destination of an excpetion edge. Despite the original text saying that the note "specifies the destination," it is actually always attached to the

[PATCH v2] reassoc: Optimize CMP/XOR expressions [PR116860]

2025-03-13 Thread Konstantinos Eleftheriou
Testcases for match.pd patterns `((a ^ b) & c) cmp d | a != b -> (0 cmp d | a != b)` and `(a ^ b) cmp c | a != b -> (0 cmp c | a != b)` were failing on some targets, like PowerPC. This patch adds an implemenetation for the optimization in reassoc. Doing so, we can now handle cases where the relate

Re: [PATCH] Move COMP/XOR optimization from match.pd into reassoc [PR116860]

2025-03-13 Thread Konstantinos Eleftheriou
On Mon, Mar 10, 2025 at 7:52 AM Konstantinos Eleftheriou > wrote: > > > > Testcases for patterns `((a ^ b) & c) cmp d | a != b -> (0 cmp d | a != b)` > > and `(a ^ b) cmp c | a != b -> (0 cmp c | a != b)` were failing on some > > targets, like PowerPC. > >

Re: [PATCH] avoid-store-forwarding: Handle REG_EH_REGION notes

2025-02-21 Thread Konstantinos Eleftheriou
Hi Richard, thanks for the feedback. On Tue, Feb 18, 2025 at 9:17 PM Richard Biener wrote: > > > > > Am 18.02.2025 um 17:04 schrieb Konstantinos Eleftheriou > > : > > > > From: kelefth > > > > The pass rejects the transformation when there are inst

[PATCH] avoid-store-forwarding: Handle REG_EH_REGION notes

2025-02-18 Thread Konstantinos Eleftheriou
From: kelefth The pass rejects the transformation when there are instructions in the sequence that might throw an exception. This was added due to having cases that the load instruction contains a REG_EH_REGION note and moving it before the store instructions caused an error, as it was no longer

[PATCH] testsuite: Exclude test in pr109393.c from ilp32 targets [PR116845]

2025-02-04 Thread Konstantinos Eleftheriou
From: kelefth The match.pd canonicalization that this testcase checks for, is not applied on ilp32 targets. This prevents the test from running on ilp32 targets. PR116845 gcc/testsuite/ChangeLog: * gcc.dg/pr109393.c: Exclude ilp32 targets. --- gcc/testsuite/gcc.dg/pr109393.c

[PATCH] match: Change (A + CST0) * CST1 to (A + sign_extend(CST0)) * CST1 [PR116845]

2024-12-31 Thread Konstantinos Eleftheriou
From: kelefth `(A * B) + (-C) to (B - C/A) * A` fails to match on ILP32 targets due to the upper bits of CST0 being zeros in some cases. This patch adds the following pattern in match.pd: (A + CST0) * CST1 -> (A + CST0') * CST1, where CST1 is a power of 2 constant and CST0' is CST0 with the log2

[PATCH] avoid-store-forwarding: Fix base register initialization when eliminating loads [PR117835]

2024-12-17 Thread Konstantinos Eleftheriou
From: kelefth During the initialization of the base register for the zero-offset store, in the case that we are eliminating the load, we used a paradoxical subreg assuming that we don't care about the higher bits of the register. This led to writing wrong values when we were not updating the whol

[PATCH] avoid-store-forwarding: Reject changes when an instruction may throw [PR117816]

2024-12-05 Thread Konstantinos Eleftheriou
From: kelefth Avoid-store-forwarding doesn't handle the case where an instruction in the store-load sequence contains a REG_EH_REGION note, leading to the insertion of instructions after it, while it should be the last instruction in the basic block. This causes an ICE when compiling using `-O -f

Re: [PATCH v7] Target-independent store forwarding avoidance.

2024-11-09 Thread Konstantinos Eleftheriou
.html). Thanks, Konstantinos. On Sat, Oct 26, 2024 at 5:54 PM Jeff Law wrote: > > > > On 10/23/24 8:27 AM, Konstantinos Eleftheriou wrote: > > From: kelefth > > > > This pass detects cases of expensive store forwarding and tries to avoid > > them > >

[PATCH v8] Target-independent store forwarding avoidance.

2024-11-09 Thread Konstantinos Eleftheriou
Signed-off-by: Konstantinos Eleftheriou Series-version: 8 Series-changes: 8 - Fix store_bit_field call for big-endian targets, where BITS_BIG_ENDIAN is false. - Handle store_forwarding_max_distance = 0 as a special case that disables cost checks for avoid-store

Re: [PATCH v6] Target-independent store forwarding avoidance.

2024-10-23 Thread Konstantinos Eleftheriou
0/18/24 3:57 AM, Konstantinos Eleftheriou wrote: > > From: kelefth > > > > This pass detects cases of expensive store forwarding and tries to avoid > > them > > by reordering the stores and using suitable bit insertion sequences. > > For example it can

[PATCH v7] Target-independent store forwarding avoidance.

2024-10-23 Thread Konstantinos Eleftheriou
-store-forwarding-3.c: New test. * gcc.target/aarch64/avoid-store-forwarding-4.c: New test (XFAIL). * gcc.target/aarch64/avoid-store-forwarding-5.c: New test (XFAIL). Signed-off-by: Philipp Tomsich Signed-off-by: Konstantinos Eleftheriou Series-version: 7 Series-changes: 7

[PATCH v6] Target-independent store forwarding avoidance.

2024-10-18 Thread Konstantinos Eleftheriou
-store-forwarding-3.c: New test. * gcc.target/aarch64/avoid-store-forwarding-4.c: New test (XFAIL). * gcc.target/aarch64/avoid-store-forwarding-5.c: New test (XFAIL). Signed-off-by: Philipp Tomsich Signed-off-by: Konstantinos Eleftheriou Series-version: 6 Series-changes: 6

Re: [PATCH v5] Target-independent store forwarding avoidance.

2024-10-18 Thread Konstantinos Eleftheriou
Sent a new version for this in https://gcc.gnu.org/pipermail/gcc-patches/2024-October/665794.html. Thanks, Konstantinos. On Fri, Aug 30, 2024 at 4:32 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > >> > I could have some help with that, because after the new changes a > >> > subreg rel

[PATCH v4] match: Fix A || B not optimized to true when !B implies A [PR114326]

2024-09-19 Thread Konstantinos Eleftheriou
-xor-and-or.c: New test. * gcc.dg/tree-ssa/fold-xor-or.c: New test. Tested-by: Christoph Müllner Signed-off-by: Philipp Tomsich Signed-off-by: Konstantinos Eleftheriou --- gcc/match.pd | 32 ++- .../gcc.dg/tree-ssa/fold-xor-and

Re: [PATCH v3] match: Fix A || B not optimized to true when !B implies A [PR114326]

2024-09-19 Thread Konstantinos Eleftheriou
I have sent a new version (https://gcc.gnu.org/pipermail/gcc-patches/2024-September/663350.html). I also added :c to the ne operations. Thanks, Konstantinos On Wed, Sep 18, 2024 at 1:52 PM Richard Biener wrote: > > On Wed, Sep 18, 2024 at 10:42 AM Konstantinos Eleftheriou > wrote: &

Re: [PATCH v3] match: Fix A || B not optimized to true when !B implies A [PR114326]

2024-09-18 Thread Konstantinos Eleftheriou
fold-xor-and-or.c: New test. > > * gcc.dg/tree-ssa/fold-xor-or.c: New test. > > > > Reviewed-by: Christoph Müllner > > Signed-off-by: Philipp Tomsich > > Signed-off-by: Konstantinos Eleftheriou > > --- > > gcc/match.pd

Re: [PATCH] match: Change (A * B) + (-C) to (B - C/A) * A, if C multiple of A [PR109393]

2024-09-17 Thread Konstantinos Eleftheriou
regression tested on x86-64 and > aarch64. > > > > PR tree-optimization/109393 > > > > gcc/ChangeLog: > > > > * match.pd: (A * B) + (-C) -> (B - C/A) * A, if C a multiple of > A. > > > > gcc/testsuite/ChangeLog: > >

[PATCH v2] match: Change (A * B) + (-C) to (B - C/A) * A, if C multiple of A [PR109393]

2024-09-17 Thread Konstantinos Eleftheriou
. gcc/testsuite/ChangeLog: * gcc.dg/pr109393.c: New test. Tested-by: Christoph Müllner Signed-off-by: Philipp Tomsich Signed-off-by: Konstantinos Eleftheriou --- gcc/match.pd| 21 - gcc/testsuite/gcc.dg/pr109393.c | 23 +++ 2 files c

[PATCH] match: Change (A * B) + (-C) to (B - C/A) * A, if C multiple of A [PR109393]

2024-09-06 Thread konstantinos . eleftheriou
. gcc/testsuite/ChangeLog: * gcc.dg/pr109393.c: New test. Tested-by: Christoph Müllner Signed-off-by: Philipp Tomsich Signed-off-by: Konstantinos Eleftheriou --- gcc/match.pd| 15 ++- gcc/testsuite/gcc.dg/pr109393.c | 23 +++ 2 files chang

Re: [PATCH v2] match: Fix A || B not optimized to true when !B implies A [PR114326]

2024-08-29 Thread Konstantinos Eleftheriou
024 at 4:24 PM Konstantinos Eleftheriou > wrote: > > > > From: kelefth > > > > In expressions like (a != b || ((a ^ b) & CST0) == CST1) and > > (a != b || (a ^ b) == CST), (a ^ b) is folded to false. > > In the equivalent expressions (((a ^ b) & CST0)

[PATCH v3] match: Fix A || B not optimized to true when !B implies A [PR114326]

2024-08-29 Thread konstantinos . eleftheriou
and-or.c: New test. * gcc.dg/tree-ssa/fold-xor-or.c: New test. Reviewed-by: Christoph Müllner Signed-off-by: Philipp Tomsich Signed-off-by: Konstantinos Eleftheriou --- gcc/match.pd | 30 ++ .../gcc.dg/tree-ssa/fold-xor-and

Re: [PATCH] match: Fix A || B not optimized to true when !B implies A [PR114326]

2024-08-16 Thread Konstantinos Eleftheriou
Thanks, fixed ( https://gcc.gnu.org/pipermail/gcc-patches/2024-August/660631.html). On Thu, Aug 15, 2024 at 3:57 PM Sam James wrote: > Konstantinos Eleftheriou writes: > > > From: kelefth > > > > In expressions like (a != b || ((a ^ b) & CST0) == CST1) and > &

[PATCH v2] match: Fix A || B not optimized to true when !B implies A [PR114326]

2024-08-16 Thread Konstantinos Eleftheriou
estsuite/ChangeLog: * gcc.dg/tree-ssa/fold-xor-and-or-1.c: New test. * gcc.dg/tree-ssa/fold-xor-and-or-2.c: New test. * gcc.dg/tree-ssa/fold-xor-or-1.c: New test. * gcc.dg/tree-ssa/fold-xor-or-2.c: New test. Reviewed-by: Christoph Müllner Signed-off-by: Philipp Tomsich Signed-of

[PATCH] match: Fix A || B not optimized to true when !B implies A [PR114326]

2024-08-14 Thread Konstantinos Eleftheriou
estsuite/ChangeLog: * gcc.dg/tree-ssa/fold-xor-and-or-1.c: New test. * gcc.dg/tree-ssa/fold-xor-and-or-2.c: New test. * gcc.dg/tree-ssa/fold-xor-or-1.c: New test. * gcc.dg/tree-ssa/fold-xor-or-2.c: New test. Reviewed-by: Christoph Müllner Signed-off-by: Philipp Tomsich Signed-of