Re: [RFC PATCH] Do not cache SLP trees across SLP instances [PR116352]

2024-08-30 Thread Manolis Tsamis
On Fri, Aug 30, 2024 at 2:24 PM Richard Biener wrote: > > On Fri, 30 Aug 2024, Manolis Tsamis wrote: > > > For more context please see > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116352#c11. > > > > I've sent this as an RFC because it's hard to be s

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

2024-08-30 Thread Manolis Tsamis
On Thu, Aug 29, 2024 at 9:16 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > > On Fri, Aug 16, 2024 at 5:33 PM Richard Sandiford > > wrote: > >> Manolis Tsamis writes: > >> > +} > >> > + > >> > + virtual

Re: [RFC PATCH] Do not cache SLP trees across SLP instances [PR116352]

2024-08-30 Thread Manolis Tsamis
h the code, this looked like a general issue to me and hence I'm proposing this fix. Thanks, Manolis On Fri, Aug 30, 2024 at 1:46 PM Manolis Tsamis wrote: > > Currently we do SLP CSE after permute optimization using a single map across > all SLP instances. These SLP instances c

[RFC PATCH] Do not cache SLP trees across SLP instances [PR116352]

2024-08-30 Thread Manolis Tsamis
map per SLP instance. gcc/testsuite/ChangeLog: * gcc.dg/pr116352.c: New test. Signed-off-by: Manolis Tsamis --- gcc/testsuite/gcc.dg/pr116352.c | 18 ++ gcc/tree-vect-slp.cc| 12 +++- 2 files changed, 25 insertions(+), 5 deletions(-) create

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

2024-08-29 Thread Manolis Tsamis
Hi Richard, Thanks a lot for the extensive review and useful suggestions (and sorry for the late reply). I have implemented most of these for a next version, so let me address your individual comments below: On Fri, Aug 16, 2024 at 5:33 PM Richard Sandiford wrote: > > Manolis Tsamis

[PATCH] ifcvt: Disallow emitting call instructions in noce_convert_multiple_sets [PR116358]

2024-08-22 Thread Manolis Tsamis
vt.cc (noce_convert_multiple_sets): Disallow call insns. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pr116358.c: New test. Signed-off-by: Manolis Tsamis --- gcc/ifcvt.cc| 2 +- gcc/testsuite/gcc.target/aarch64/pr116358.c | 15 +++ 2 files changed, 16 insertions(

Re: [PATCH] ifcvt: Fix force_operand ICE due to noce_convert_multiple_sets [PR116353]

2024-08-21 Thread Manolis Tsamis
On Tue, Aug 13, 2024 at 10:48 PM Jeff Law wrote: > > > > On 8/13/24 5:57 AM, Manolis Tsamis wrote: > > Now that more operations are allowed for noce_convert_multiple_sets, we > > need to > > check noce_can_force_operand on the sequence before calling > >

[PATCH] ifcvt: Do not overwrite results in noce_convert_multiple_sets [PR116372, PR116405]

2024-08-20 Thread Manolis Tsamis
372.c: New test. * gcc.dg/pr116405.c: New test. Signed-off-by: Manolis Tsamis --- gcc/ifcvt.cc| 22 ++ gcc/testsuite/gcc.dg/pr116372.c | 13 + gcc/testsuite/gcc.dg/pr116405.c | 17 + 3 files changed, 48 insertions(+), 4

[PATCH] ifcvt: Fix force_operand ICE due to noce_convert_multiple_sets [PR116353]

2024-08-13 Thread Manolis Tsamis
: Manolis Tsamis --- gcc/ifcvt.cc | 6 ++- gcc/testsuite/gcc.target/i386/pr116353.c | 55 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr116353.c diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc

[PATCH v5] Target-independent store forwarding avoidance.

2024-08-09 Thread Manolis Tsamis
. * gcc.target/aarch64/avoid-store-forwarding-3.c: New test. * gcc.target/aarch64/avoid-store-forwarding-4.c: New test. * gcc.target/aarch64/avoid-store-forwarding-5.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v5: - Fix bug with BIG_ENDIAN targets

Re: [RESEND PATCH v5 1/3] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2024-08-07 Thread Manolis Tsamis
s no change needed for that comment. > I can't comment on ifcvt changes to say if they're OK or not otherwise, > sorry. > > > > > Thanks, > > Philipp. > > > > > > On Fri, 26 Jul 2024 at 12:50, Sam James wrote: > >> > >> Mano

Re: [PATCH v2] Rearrange SLP nodes with duplicate statements. [PR98138]

2024-08-06 Thread Manolis Tsamis
Pinging this for a review and/or further feedback. Thanks, Manolis On Wed, Jun 26, 2024 at 3:06 PM Manolis Tsamis wrote: > > This change checks when a two_operators SLP node has multiple occurrences of > the same statement (e.g. {A, B, A, B, ...}) and tries to rearrange the > o

[RESEND PATCH v5 3/3] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2024-07-26 Thread Manolis Tsamis
(struct noce_multiple_sets_info): Introduce new struct noce_multiple_sets_info to store info for noce_convert_multiple_sets. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ifcvt_multiple_sets_rewire.c: New test. Signed-off-by: Manolis Tsamis --- (no changes since v1) gcc/ifcvt.cc

[RESEND PATCH v5 2/3] ifcvt: Allow more operations in multiple set if conversion

2024-07-26 Thread Manolis Tsamis
et/aarch64/ifcvt_multiple_sets_arithm.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v5: - Loop over SEQ and check modified_in_p for all instructions. - Fix x86-related bug when SEQ modifies COND. gcc/ifcvt.cc | 34 +++- .../aarch64/ifcvt_multiple_set

[RESEND PATCH v5 1/3] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2024-07-26 Thread Manolis Tsamis
f the if_then_else emitted more robust. gcc/ChangeLog: * ifcvt.cc (check_for_cc_cmp_clobbers): Use modified_in_p instead. (noce_convert_multiple_sets_1): Don't use seq2 if it clobbers cc_cmp. Punt if seq clobbers cond. Refactor the code that sets read_comparison. Signed-off-b

[RESEND PATCH v5 0/3] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets

2024-07-26 Thread Manolis Tsamis
SEQ and check modified_in_p for all instructions. - Fix x86-related bug when SEQ modifies COND. Manolis Tsamis (3): ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets ifcvt: Allow more operations in multiple set if conversion ifcvt: Handle multiple rewired

Re: [PATCH v4 1/3] [RFC] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2024-07-26 Thread Manolis Tsamis
On Wed, Jun 5, 2024 at 2:00 PM Richard Sandiford wrote: > > Sorry for the slow review. > > Manolis Tsamis writes: > > This is an extension of what was done in PR106590. > > > > Currently if a sequence generated in noce_convert_multiple_sets clobbers the > >

Re: [PING] [PATCH v4 1/3] [RFC] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2024-07-26 Thread Manolis Tsamis
On Thu, Jul 11, 2024 at 1:03 AM Jeff Law wrote: > > > > On 6/3/24 5:34 AM, Manolis Tsamis wrote: > > This is an extension of what was done in PR106590. > > > > Currently if a sequence generated in noce_convert_multiple_sets clobbers the > > condition rtx (cc_

[PATCH v5 1/3] [RFC] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2024-07-26 Thread Manolis Tsamis
f the if_then_else emitted more robust. gcc/ChangeLog: * ifcvt.cc (check_for_cc_cmp_clobbers): Use modified_in_p instead. (noce_convert_multiple_sets_1): Don't use seq2 if it clobbers cc_cmp. Punt if seq clobbers cond. Refactor the code that sets read_comparison. Signed-off-b

[PATCH v5 3/3] [RFC] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2024-07-26 Thread Manolis Tsamis
(struct noce_multiple_sets_info): Introduce new struct noce_multiple_sets_info to store info for noce_convert_multiple_sets. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ifcvt_multiple_sets_rewire.c: New test. Signed-off-by: Manolis Tsamis --- (no changes since v1) gcc/ifcvt.cc

[PATCH v5 2/3] [RFC] ifcvt: Allow more operations in multiple set if conversion

2024-07-26 Thread Manolis Tsamis
et/aarch64/ifcvt_multiple_sets_arithm.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v5: - Loop over SEQ and check modified_in_p for all instructions. - Fix x86-related bug when SEQ modifies COND. gcc/ifcvt.cc | 34 +++- .../aarch64/ifcvt_multiple_set

[PATCH v5 0/3] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets

2024-07-26 Thread Manolis Tsamis
-related bug when SEQ modifies COND. Manolis Tsamis (3): [RFC] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets [RFC] ifcvt: Allow more operations in multiple set if conversion [RFC] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets gcc

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

2024-07-09 Thread Manolis Tsamis
On Mon, Jul 8, 2024 at 6:41 PM Andi Kleen wrote: > > > I have added a target hook for this in v4 of this patch. The hook > > receives all the information about the stores, the load, the estimated > > sequence cost and whether we expect to eliminate the load. With this > > information the target sh

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

2024-07-08 Thread Manolis Tsamis
On Thu, Jun 13, 2024 at 7:18 PM Andi Kleen wrote: > > Manolis Tsamis writes: > > > > Assembly like this can appear with bitfields or type punning / unions. > > On stress-ng when running the cpu-union microbenchmark the following > > speedups > > have

[PATCH v4] Target-independent store forwarding avoidance.

2024-07-08 Thread Manolis Tsamis
. * gcc.target/aarch64/avoid-store-forwarding-3.c: New test. * gcc.target/aarch64/avoid-store-forwarding-4.c: New test. * gcc.target/aarch64/avoid-store-forwarding-5.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v4: - Change pass scheduling to run after sched1

Re: [PATCH] Rearrange SLP nodes with duplicate statements. [PR98138]

2024-06-26 Thread Manolis Tsamis
On Wed, Jun 5, 2024 at 11:07 AM Richard Biener wrote: > > On Tue, 4 Jun 2024, Manolis Tsamis wrote: > > > This change adds a function that checks for SLP nodes with multiple > > occurrences > > of the same statement (e.g. {A, B, A, B, ...}) and tries to rearrange the

Re: [PATCH v2] Rearrange SLP nodes with duplicate statements. [PR98138]

2024-06-26 Thread Manolis Tsamis
n 26, 2024 at 3:06 PM Manolis Tsamis wrote: > > This change checks when a two_operators SLP node has multiple occurrences of > the same statement (e.g. {A, B, A, B, ...}) and tries to rearrange the > operands > so that there are no duplicates. Two vec_perm expressions are then introdu

[PATCH v2] Rearrange SLP nodes with duplicate statements. [PR98138]

2024-06-26 Thread Manolis Tsamis
=98138 gcc/ChangeLog: * tree-vect-slp.cc: Avoid duplicates in two_operators nodes. gcc/testsuite/ChangeLog: * gcc.target/aarch64/vect-slp-two-operator.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v2: - Do not use predefined patterns; support rearrangement of

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

2024-06-13 Thread Manolis Tsamis
On Sun, Jun 9, 2024 at 5:29 PM Jeff Law wrote: > > > > On 6/7/24 4:31 PM, Jeff Law wrote: > > > > > I've actually added it to my tester just to see if there's any fallout. > > It'll take a week to churn through the long running targets that > > bootstrap in QEMU, but the crosses should have data M

[PATCH v3] Target-independent store forwarding avoidance.

2024-06-13 Thread Manolis Tsamis
-2.c: New test. * gcc.target/aarch64/avoid-store-forwarding-3.c: New test. * gcc.target/aarch64/avoid-store-forwarding-4.c: New test. * gcc.target/aarch64/avoid-store-forwarding-5.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v3: - Only emit SUBREG

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

2024-06-12 Thread Manolis Tsamis
On Mon, Jun 10, 2024 at 9:27 PM Philipp Tomsich wrote: > > On Mon, 10 Jun 2024 at 20:03, Jeff Law wrote: > > > > > > > > On 6/10/24 1:55 AM, Manolis Tsamis wrote: > > > > >> > > > There was an older submission of a load-pair specific pass

Re: [PATCH] Rearrange SLP nodes with duplicate statements. [PR98138]

2024-06-10 Thread Manolis Tsamis
On Wed, Jun 5, 2024 at 11:07 AM Richard Biener wrote: > > On Tue, 4 Jun 2024, Manolis Tsamis wrote: > > > This change adds a function that checks for SLP nodes with multiple > > occurrences > > of the same statement (e.g. {A, B, A, B, ...}) and tries to rearrange the

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

2024-06-10 Thread Manolis Tsamis
On Sun, Jun 9, 2024 at 5:29 PM Jeff Law wrote: > > > > On 6/7/24 4:31 PM, Jeff Law wrote: > > > > > I've actually added it to my tester just to see if there's any fallout. > > It'll take a week to churn through the long running targets that > > bootstrap in QEMU, but the crosses should have data M

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

2024-06-10 Thread Manolis Tsamis
On Sat, Jun 8, 2024 at 1:31 AM Jeff Law wrote: > > > > On 6/6/24 4:10 AM, Manolis Tsamis wrote: > > This pass detects cases of expensive store forwarding and tries to avoid > > them > > by reordering the stores and using suitable bit insertion sequences. > &g

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

2024-06-06 Thread Manolis Tsamis
On Fri, May 24, 2024 at 9:27 AM Richard Biener wrote: > > On Thu, 23 May 2024, Manolis Tsamis wrote: > > > This pass detects cases of expensive store forwarding and tries to avoid > > them > > by reordering the stores and using suitable bit insertion sequences. >

[PATCH v2] Target-independent store forwarding avoidance.

2024-06-06 Thread Manolis Tsamis
-2.c: New test. * gcc.target/aarch64/avoid-store-forwarding-3.c: New test. * gcc.target/aarch64/avoid-store-forwarding-4.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v2: - Allow modes that are not scalar_int_mode. - Introduce simple costing to avoid

Re: [PATCH v4 1/3] [RFC] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2024-06-05 Thread Manolis Tsamis
On Wed, Jun 5, 2024 at 2:00 PM Richard Sandiford wrote: > > Sorry for the slow review. > > Manolis Tsamis writes: > > This is an extension of what was done in PR106590. > > > > Currently if a sequence generated in noce_convert_multiple_sets clobbers the > >

[PATCH] Rearrange SLP nodes with duplicate statements. [PR98138]

2024-06-04 Thread Manolis Tsamis
-off-by: Manolis Tsamis --- .../aarch64/vect-slp-two-operator.c | 42 gcc/tree-vect-slp.cc | 234 ++ 2 files changed, 276 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/vect-slp-two-operator.c diff --git a/gcc/testsuite

[PING] [PATCH v4 3/3] [RFC] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2024-06-03 Thread Manolis Tsamis
(struct noce_multiple_sets_info): Introduce new struct noce_multiple_sets_info to store info for noce_convert_multiple_sets. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ifcvt_multiple_sets_rewire.c: New test. Signed-off-by: Manolis Tsamis --- (no changes since v1) gcc/ifcvt.cc

[PING] [PATCH v4 1/3] [RFC] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2024-06-03 Thread Manolis Tsamis
bbers): Use modified_in_p instead. (noce_convert_multiple_sets_1): Don't use seq2 if it clobbers cc_cmp. Refactor the code that sets read_comparison. Signed-off-by: Manolis Tsamis --- (no changes since v1) gcc/ifcvt.cc | 106 -

[PING] [PATCH v4 0/3] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets

2024-06-03 Thread Manolis Tsamis
unnecessary hardcoded list of allowed ops in bb_ok_for_noce_convert_multiple_sets. - Set need_cmov based on BB live_out instead of REG_DEAD notes. - Fix preexisting issues and improve the code that sets read_comparison. Manolis Tsamis (3): [RFC] ifcvt: handle sequences that

[PING] [PATCH v4 2/3] [RFC] ifcvt: Allow more operations in multiple set if conversion

2024-06-03 Thread Manolis Tsamis
et/aarch64/ifcvt_multiple_sets_arithm.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v4: - Remove unnecessary hardcoded list of allowed ops in bb_ok_for_noce_convert_multiple_sets. - Set need_cmov based on BB live_out instead of REG_DEAD notes. - Fix preexisting issues and i

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

2024-05-30 Thread Manolis Tsamis
On Fri, May 24, 2024 at 9:27 AM Richard Biener wrote: > > On Thu, 23 May 2024, Manolis Tsamis wrote: > > > This pass detects cases of expensive store forwarding and tries to avoid > > them > > by reordering the stores and using suitable bit insertion sequences. >

[PATCH v2] MATCH: Look through VIEW_CONVERT when folding VEC_PERM_EXPRs.

2024-05-24 Thread Manolis Tsamis
: * gcc.dg/fold-perm-2.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v2: Use TYPE_SIZE (TREE_TYPE (TREE_TYPE (@))) instead of element_precision (@). gcc/match.pd | 14 -- gcc/testsuite/gcc.dg/fold-perm-2.c | 16 2 files changed, 24

Re: [PATCH] MATCH: Look through VIEW_CONVERT when folding VEC_PERM_EXPRs.

2024-05-24 Thread Manolis Tsamis
vector (r3, veci); +} + +/* { dg-final { scan-tree-dump "VEC_PERM_EXPR.*{ 2, 7, 5, 0 }" "fre1" } } */ +/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 1 "fre1" } } */ -- 2.44.0 On Fri, May 24, 2024 at 11:30 AM Richard Biener wrote: > > On Fri,

Re: [PATCH] MATCH: Look through VIEW_CONVERT when folding VEC_PERM_EXPRs.

2024-05-24 Thread Manolis Tsamis
On Fri, May 24, 2024 at 10:46 AM Richard Biener wrote: > > On Fri, 24 May 2024, Manolis Tsamis wrote: > > > On Fri, May 24, 2024 at 9:31 AM Richard Biener wrote: > > > > > > On Wed, 22 May 2024, Manolis Tsamis wrote: > > > > > > > The match.

Re: [PATCH] MATCH: Look through VIEW_CONVERT when folding VEC_PERM_EXPRs.

2024-05-24 Thread Manolis Tsamis
On Fri, May 24, 2024 at 9:31 AM Richard Biener wrote: > > On Wed, 22 May 2024, Manolis Tsamis wrote: > > > The match.pd patterns to merge two vector permutes into one fail when a > > potentially no-op view convert expressions is between the two permutes. > > This ch

[PATCH] [RFC] Target-independent store forwarding avoidance. [PR48696] Target-independent store forwarding avoidance.

2024-05-23 Thread Manolis Tsamis
-off-by: Manolis Tsamis --- gcc/Makefile.in | 1 + gcc/avoid-store-forwarding.cc | 554 ++ gcc/common.opt| 4 + gcc/params.opt| 4 + gcc/passes.def

[PATCH] MATCH: Look through VIEW_CONVERT when folding VEC_PERM_EXPRs.

2024-05-22 Thread Manolis Tsamis
: * gcc.dg/fold-perm-2.c: New test. Signed-off-by: Manolis Tsamis --- gcc/match.pd | 14 -- gcc/testsuite/gcc.dg/fold-perm-2.c | 16 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/fold-perm-2.c diff --git

Re: [PATCH] MATCH: Maybe expand (T)(A + C1) * C2 and (T)(A + C1) * C2 + C3 [PR109393]

2024-05-17 Thread Manolis Tsamis
On Fri, May 17, 2024 at 12:22 PM Richard Biener wrote: > > On Fri, 17 May 2024, Manolis Tsamis wrote: > > > Hi Richard, > > > > While I was re-testing the latest version of this patch I noticed that > > it FAILs an AArch64 test, gcc.target/aarch64/subsp.c. W

Re: [PATCH] MATCH: Maybe expand (T)(A + C1) * C2 and (T)(A + C1) * C2 + C3 [PR109393]

2024-05-17 Thread Manolis Tsamis
lly find a way to solve the regression. Any thoughts on this? Thanks, Manolis On Thu, May 16, 2024 at 11:15 AM Richard Biener wrote: > > On Tue, May 14, 2024 at 10:58 AM Manolis Tsamis > wrote: > > > > New patch with the requested changes can be found below. > > &

Re: [PATCH v4 0/3] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets

2024-05-14 Thread Manolis Tsamis
Pinging this for GCC15. Thanks On Tue, Apr 23, 2024 at 1:47 PM Manolis Tsamis wrote: > > > noce_convert_multiple_sets has been introduced and extended over time to > handle > if conversion for blocks with multiple sets. Currently this is focused on > register moves and r

Re: [PATCH] MATCH: Maybe expand (T)(A + C1) * C2 and (T)(A + C1) * C2 + C3 [PR109393]

2024-05-14 Thread Manolis Tsamis
} */ + +int foo(int *a, int j) +{ + int k = j - 1; + return a[j - 1] == a[k]; +} + +int bar(int *a, int j) +{ + int k = j - 1; + return (&a[j + 1] - 2) == &a[k]; +} -- 2.44.0 On Tue, Apr 23, 2024 at 1:33 PM Manolis Tsamis wrote: > > The original motivation for this pattern

Re: [PATCH] MATCH: Maybe expand (T)(A + C1) * C2 and (T)(A + C1) * C2 + C3 [PR109393]

2024-05-02 Thread Manolis Tsamis
On Thu, May 2, 2024 at 4:00 PM Richard Biener wrote: > > On Tue, 23 Apr 2024, Manolis Tsamis wrote: > > > The original motivation for this pattern was that the following function > > does > > not fold to 'return 1': > > > > int foo(int *a, int j

Re: [PATCH v4 2/3] [RFC] ifcvt: Allow more operations in multiple set if conversion

2024-04-30 Thread Manolis Tsamis
On Thu, Apr 25, 2024 at 2:40 AM Hans-Peter Nilsson wrote: > > On Tue, 23 Apr 2024, Manolis Tsamis wrote: > > diff --git a/gcc/testsuite/gcc.target/aarch64/ifcvt_multiple_sets_arithm.c > > b/gcc/testsuite/gcc.target/aarch64/ifcvt_multiple_sets_arithm.c > ... > > +/*

Re: [PATCH v2] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2024-04-23 Thread Manolis Tsamis
On Thu, Nov 23, 2023 at 11:01 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > > The existing implementation of need_cmov_or_rewire and > > noce_convert_multiple_sets_1 assumes that sets are either REG or SUBREG. > > This commit enchances them so they can han

Re: [PATCH v3 2/4] ifcvt: Allow more operations in multiple set if conversion

2024-04-23 Thread Manolis Tsamis
On Thu, Oct 19, 2023 at 10:46 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > > Currently the operations allowed for if conversion of a basic block with > > multiple sets are few, namely REG, SUBREG and CONST_INT (as controlled by > > bb_ok_for_noce_convert_mult

Re: [PATCH v3 1/4] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2024-04-23 Thread Manolis Tsamis
On Thu, Oct 19, 2023 at 10:41 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > > This is an extension of what was done in PR106590. > > > > Currently if a sequence generated in noce_convert_multiple_sets clobbers the > > condition rtx (cc_cmp or rev_

[PATCH v4 2/3] [RFC] ifcvt: Allow more operations in multiple set if conversion

2024-04-23 Thread Manolis Tsamis
et/aarch64/ifcvt_multiple_sets_arithm.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v4: - Remove unnecessary hardcoded list of allowed ops in bb_ok_for_noce_convert_multiple_sets. - Set need_cmov based on BB live_out instead of REG_DEAD notes. - Fix preexisting issues and i

[PATCH v4 3/3] [RFC] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2024-04-23 Thread Manolis Tsamis
(struct noce_multiple_sets_info): Introduce new struct noce_multiple_sets_info to store info for noce_convert_multiple_sets. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ifcvt_multiple_sets_rewire.c: New test. Signed-off-by: Manolis Tsamis --- (no changes since v1) gcc/ifcvt.cc

[PATCH v4 1/3] [RFC] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2024-04-23 Thread Manolis Tsamis
bbers): Use modified_in_p instead. (noce_convert_multiple_sets_1): Don't use seq2 if it clobbers cc_cmp. Refactor the code that sets read_comparison. Signed-off-by: Manolis Tsamis --- (no changes since v1) gcc/ifcvt.cc | 106 -

[PATCH v4 0/3] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets

2024-04-23 Thread Manolis Tsamis
unnecessary hardcoded list of allowed ops in bb_ok_for_noce_convert_multiple_sets. - Set need_cmov based on BB live_out instead of REG_DEAD notes. - Fix preexisting issues and improve the code that sets read_comparison. Manolis Tsamis (3): [RFC] ifcvt: handle sequences that

[PATCH] MATCH: Maybe expand (T)(A + C1) * C2 and (T)(A + C1) * C2 + C3 [PR109393]

2024-04-23 Thread Manolis Tsamis
ned-off-by: Manolis Tsamis --- gcc/match.pd| 30 ++ gcc/testsuite/gcc.dg/pr109393.c | 16 2 files changed, 46 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr109393.c diff --git a/gcc/match.pd b/gcc/match.pd index d401e7503e6..1

Re: [PATCH] Add extra copy of the ifcombine pass after pre [PR102793]

2024-04-05 Thread Manolis Tsamis
On Fri, Apr 5, 2024 at 3:43 PM Richard Biener wrote: > > On Fri, Apr 5, 2024 at 2:28 PM Manolis Tsamis wrote: > > > > If we consider code like: > > > > if (bar1 == x) > > return foo(); > > if (bar2 != y) > > return foo(); >

[PATCH] Add extra copy of the ifcombine pass after pre [PR102793]

2024-04-05 Thread Manolis Tsamis
: Change flag to -fno-tree-ifcombine. * gcc.dg/uninit-pred-6_c.c: Remove inconsistent check. * gcc.target/aarch64/pr102793.c: New test. Signed-off-by: Manolis Tsamis --- gcc/common.opt | 4 +++ gcc/doc/invoke.texi | 5 gcc

Re: [PATCH v2] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2023-12-07 Thread Manolis Tsamis
On Thu, Nov 23, 2023 at 11:01 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > > The existing implementation of need_cmov_or_rewire and > > noce_convert_multiple_sets_1 assumes that sets are either REG or SUBREG. > > This commit enchances them so they can han

Re: [PATCH v7] Implement new RTL optimizations pass: fold-mem-offsets.

2023-11-28 Thread Manolis Tsamis
On Tue, Nov 28, 2023 at 12:53 PM Jakub Jelinek wrote: > > On Tue, Nov 28, 2023 at 11:45:58AM +0200, Manolis Tsamis wrote: > > > But, while get_single_def_in_bb checks for > > > if (DF_INSN_LUID (def) > DF_INSN_LUID (insn)) > > > return NULL;

Re: [PATCH v2] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2023-11-28 Thread Manolis Tsamis
On Tue, Nov 28, 2023 at 12:12 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > > On Thu, Nov 23, 2023 at 11:01 PM Richard Sandiford > > wrote: > >> > >> Manolis Tsamis writes: > >> > The existing implementation of need_cmov_or_rewire and

Re: [PATCH v7] Implement new RTL optimizations pass: fold-mem-offsets.

2023-11-28 Thread Manolis Tsamis
Hi Jakub, Thanks a lot for tracking this down and providing both testcases and a fix. Some thoughts below. On Mon, Nov 27, 2023 at 10:52 PM Jakub Jelinek wrote: > > On Mon, Oct 16, 2023 at 01:11:01PM -0600, Jeff Law wrote: > > > gcc/ChangeLog: > > > > > > * Makefile.in: Add fold-mem-offsets.

Re: [PATCH v2] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2023-11-28 Thread Manolis Tsamis
On Thu, Nov 23, 2023 at 11:01 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > > The existing implementation of need_cmov_or_rewire and > > noce_convert_multiple_sets_1 assumes that sets are either REG or SUBREG. > > This commit enchances them so they can han

Re: [PATCH v2] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2023-11-21 Thread Manolis Tsamis
I have bootstrapped and checked for no testsuite regressions on x86 and aarch64. Thanks, Manolis On Tue, Nov 21, 2023 at 8:00 PM Manolis Tsamis wrote: > > The existing implementation of need_cmov_or_rewire and > noce_convert_multiple_sets_1 assumes that sets are either REG or SUBRE

Re: [PATCH v3 3/4] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2023-11-21 Thread Manolis Tsamis
I have made this independent from the rest of the series, cleaned up some comments and moved some code to its original position. Re-submitted as https://gcc.gnu.org/pipermail/gcc-patches/2023-November/637660.html. Manolis On Mon, Nov 13, 2023 at 2:40 PM Manolis Tsamis wrote: > > H

Re: [PATCH v3 4/4] ifcvt: Remove obsolete code for subreg handling in noce_convert_multiple_sets

2023-11-21 Thread Manolis Tsamis
Retested, made independent of the rest of the series and submitted as https://gcc.gnu.org/pipermail/gcc-patches/2023-November/637662.html. Manolis On Mon, Nov 13, 2023 at 2:43 PM Manolis Tsamis wrote: > > Yes, my finding back then was that this is leftover code from the > initial imple

Re: [PATCH v2] ifcvt: Remove obsolete code for subreg handling in noce_convert_multiple_sets

2023-11-21 Thread Manolis Tsamis
Bootstrapped and tested on x86 and aarch64. This only assumes that the mode of what simplify_replace_rtx returns is the same with its first argument. Thanks, Manolis On Tue, Nov 21, 2023 at 8:04 PM Manolis Tsamis wrote: > > This code used to handle SUBREG for register replacement when ifc

[PATCH v2] ifcvt: Remove obsolete code for subreg handling in noce_convert_multiple_sets

2023-11-21 Thread Manolis Tsamis
(noce_convert_multiple_sets_1): Remove old code. Signed-off-by: Manolis Tsamis --- Changes in v2: - Made standalone patch. gcc/ifcvt.cc | 38 -- 1 file changed, 38 deletions(-) diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index a0af553b9ff..be42609a848 100644 --- a/gcc

[PATCH v2] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2023-11-21 Thread Manolis Tsamis
(struct noce_multiple_sets_info): Introduce new struct noce_multiple_sets_info to store info for noce_convert_multiple_sets. Signed-off-by: Manolis Tsamis --- Changes in v2: - Made standalone patch. - Better comments, some more checks. gcc/ifcvt.cc | 252

Re: [PATCH v3 2/4] ifcvt: Allow more operations in multiple set if conversion

2023-11-13 Thread Manolis Tsamis
On Thu, Oct 19, 2023 at 10:46 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > > Currently the operations allowed for if conversion of a basic block with > > multiple sets are few, namely REG, SUBREG and CONST_INT (as controlled by > > bb_ok_for_noce_convert_mult

Re: [PATCH v3 4/4] ifcvt: Remove obsolete code for subreg handling in noce_convert_multiple_sets

2023-11-13 Thread Manolis Tsamis
at 12:03 AM Jeff Law wrote: > > > > On 8/30/23 04:14, Manolis Tsamis wrote: > > This code used to handle register replacement issues with SUBREG before > > simplify_replace_rtx was introduced. This should not be needed anymore as > > new_val has the correct m

Re: [PATCH v3 3/4] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2023-11-13 Thread Manolis Tsamis
Hi Jeff, Indeed, that sounds like a good idea. I will make this separate and send it after the required testing. I'll see what can be done about a testcase. Best, Manolis On Sat, Nov 11, 2023 at 1:20 AM Jeff Law wrote: > > > > On 8/30/23 04:13, Manolis Tsamis wrote:

Re: [PATCH v3 0/4] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets

2023-10-18 Thread Manolis Tsamis
Hi all, Pinging once more ( https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628820.html). Manolis On Mon, Sep 18, 2023 at 11:18 AM Manolis Tsamis wrote: > > Kind ping for V3 of these ifcvt changes > https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628820.html > > Th

Re: [PATCH v7] Implement new RTL optimizations pass: fold-mem-offsets.

2023-10-16 Thread Manolis Tsamis
This version has been bootstrapped and tested to cause no regressions in both x86 and Aarch64. Manolis On Mon, Oct 16, 2023 at 9:01 PM Manolis Tsamis wrote: > > This is a new RTL pass that tries to optimize memory offset calculations > by moving them from add immediate instructio

Re: [PATCH v6] Implement new RTL optimizations pass: fold-mem-offsets.

2023-10-16 Thread Manolis Tsamis
On Tue, Oct 10, 2023 at 5:15 PM Jeff Law wrote: > > > > On 10/10/23 05:59, Manolis Tsamis wrote: > > >> It's a code quality issue as long as we don't transform the code into > >> movl $0, -18874240, at which point it would become a correctness issue. >

[PATCH v7] Implement new RTL optimizations pass: fold-mem-offsets.

2023-10-16 Thread Manolis Tsamis
. * fold-mem-offsets.cc: New file. gcc/testsuite/ChangeLog: * gcc.target/riscv/fold-mem-offsets-1.c: New test. * gcc.target/riscv/fold-mem-offsets-2.c: New test. * gcc.target/riscv/fold-mem-offsets-3.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v7

Re: [PATCH v6] Implement new RTL optimizations pass: fold-mem-offsets.

2023-10-10 Thread Manolis Tsamis
On Fri, Oct 6, 2023 at 8:57 PM Jeff Law wrote: > > > > On 10/6/23 08:17, Manolis Tsamis wrote: > SNIP > >> So I was ready to ACK, but realized there weren't any testresults for a > >> primary platform mentioned. So I ran this on x86. > >> &g

Re: [PATCH v6] Implement new RTL optimizations pass: fold-mem-offsets.

2023-10-06 Thread Manolis Tsamis
On Thu, Oct 5, 2023 at 1:05 AM Jeff Law wrote: > > > > On 10/3/23 05:45, Manolis Tsamis wrote: > > This is a new RTL pass that tries to optimize memory offset calculations > > by moving them from add immediate instructions to the memory loads/stores. > > For

Re: [PATCH v6] Implement new RTL optimizations pass: fold-mem-offsets.

2023-10-06 Thread Manolis Tsamis
On Thu, Oct 5, 2023 at 5:54 PM Jeff Law wrote: > > > > On 10/3/23 05:45, Manolis Tsamis wrote: > > This is a new RTL pass that tries to optimize memory offset calculations > > > + > > +/* If INSN is a root memory instruction then compute a potentially new >

Re: [PATCH v5] Implement new RTL optimizations pass: fold-mem-offsets.

2023-10-03 Thread Manolis Tsamis
On Fri, Sep 29, 2023 at 10:22 PM Jeff Law wrote: > > > > On 9/12/23 04:13, Manolis Tsamis wrote: > > >>> + > >>> +/* Get the single reaching definition of an instruction inside a BB. > >>> + The definition is desired for REG used in INSN. >

[PATCH v6] Implement new RTL optimizations pass: fold-mem-offsets.

2023-10-03 Thread Manolis Tsamis
. * fold-mem-offsets.cc: New file. gcc/testsuite/ChangeLog: * gcc.target/riscv/fold-mem-offsets-1.c: New test. * gcc.target/riscv/fold-mem-offsets-2.c: New test. * gcc.target/riscv/fold-mem-offsets-3.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v6

Re: [PATCH v3 0/4] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets

2023-09-18 Thread Manolis Tsamis
Kind ping for V3 of these ifcvt changes https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628820.html Thanks, Manolis On Wed, Aug 30, 2023 at 1:14 PM Manolis Tsamis wrote: > > > noce_convert_multiple_sets has been introduced and extended over time to > handle > if conver

Re: [PATCH v5] Implement new RTL optimizations pass: fold-mem-offsets.

2023-09-12 Thread Manolis Tsamis
On Tue, Sep 12, 2023 at 3:47 AM Jeff Law wrote: > > > > On 9/9/23 02:46, Manolis Tsamis wrote: > > This is a new RTL pass that tries to optimize memory offset calculations > > by moving them from add immediate instructions to the memory loads/stores. > > For

Re: [PATCH v5] Implement new RTL optimizations pass: fold-mem-offsets.

2023-09-09 Thread Manolis Tsamis
541: 97 548: 101 557: 9 AArch64: 500: 71 502: 318 505: 0 520: 23 523: 205 525: 73 531: 7 541: 56 548: 0 557: 2 x86-64: 500: 8 502: 16 505: 0 520: 4 523: 5 525: 2 531: 0 541: 0 548: 0 557: 0 Thanks, Manolis On Sat, Sep 9, 2023 at 11:47 AM Manolis T

[PATCH v5] Implement new RTL optimizations pass: fold-mem-offsets.

2023-09-09 Thread Manolis Tsamis
. * fold-mem-offsets.cc: New file. gcc/testsuite/ChangeLog: * gcc.target/riscv/fold-mem-offsets-1.c: New test. * gcc.target/riscv/fold-mem-offsets-2.c: New test. * gcc.target/riscv/fold-mem-offsets-3.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v5

Re: [x86_64 PATCH] Improve __int128 argument passing (in ix86_expand_move).

2023-09-01 Thread Manolis Tsamis
nvenience. > Best regards, > Roger > -- > > > -Original Message- > > From: Manolis Tsamis > > Sent: 01 September 2023 11:45 > > To: Uros Bizjak > > Cc: Roger Sayle ; gcc-patches@gcc.gnu.org > > Subject: Re: [x86_64 PATCH] Improve __int128 arg

Re: [x86_64 PATCH] Improve __int128 argument passing (in ix86_expand_move).

2023-09-01 Thread Manolis Tsamis
Hi Roger, I've (accidentally) found a codegen regression that I bisected down to this patch. For these two functions: typedef struct { float minx, miny; float maxx, maxy; } AABB; int TestOverlap(AABB a, AABB b) { return a.minx <= b.maxx && a.miny <= b.maxy && a.maxx >= b.minx

Re: [PATCH v2 0/2] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets

2023-08-30 Thread Manolis Tsamis
On Tue, Jul 18, 2023 at 9:38 PM Richard Sandiford wrote: > > Manolis Tsamis writes: > > On Tue, Jul 18, 2023 at 1:12 AM Richard Sandiford > > wrote: > >> > >> Manolis Tsamis writes: > >> > noce_convert_multiple_sets has been introduced an

[PATCH v3 3/4] ifcvt: Handle multiple rewired regs and refactor noce_convert_multiple_sets

2023-08-30 Thread Manolis Tsamis
(struct noce_multiple_sets_info): Introduce new struct noce_multiple_sets_info to store info for noce_convert_multiple_sets. gcc/testsuite/ChangeLog: * gcc.target/aarch64/ifcvt_multiple_sets_rewire.c: New test. Signed-off-by: Manolis Tsamis --- (no changes since v1) gcc/ifcvt.cc

[PATCH v3 4/4] ifcvt: Remove obsolete code for subreg handling in noce_convert_multiple_sets

2023-08-30 Thread Manolis Tsamis
): Remove old code. Signed-off-by: Manolis Tsamis --- (no changes since v1) gcc/ifcvt.cc | 38 -- 1 file changed, 38 deletions(-) diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index ecc0cbabef9..3b4b873612c 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @@ -3449,44

[PATCH v3 2/4] ifcvt: Allow more operations in multiple set if conversion

2023-08-30 Thread Manolis Tsamis
et/aarch64/ifcvt_multiple_sets_arithm.c: New test. Signed-off-by: Manolis Tsamis --- Changes in v3: - Add SCALAR_INT_MODE_P check in bb_ok_for_noce_convert_multiple_sets. - Allow rewiring of multiple regs. - Refactor code with noce_multiple_sets_info. - Remove old code for subregs. gc

[PATCH v3 1/4] ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

2023-08-30 Thread Manolis Tsamis
Signed-off-by: Manolis Tsamis --- (no changes since v1) gcc/ifcvt.cc | 49 +++-- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index a0af553b9ff..3273aeca125 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @

[PATCH v3 0/4] ifcvt: Allow if conversion of arithmetic in basic blocks with multiple sets

2023-08-30 Thread Manolis Tsamis
SCALAR_INT_MODE_P check in bb_ok_for_noce_convert_multiple_sets. - Allow rewiring of multiple regs. - Refactor code with noce_multiple_sets_info. - Remove old code for subregs. Manolis Tsamis (4): ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

  1   2   >