Re: [PATCH 1/2] xtensa: Remove TARGET_MEMORY_MOVE_COST hook

2023-06-18 Thread Max Filippov via Gcc-patches
nsa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 2/2] xtensa: constantsynth: Add new 2-insns synthesis pattern

2023-06-18 Thread Max Filippov via Gcc-patches
a_constantsynth_2insn): > Add new pattern for the abovementioned case. > --- > gcc/config/xtensa/xtensa.cc | 12 ++-- > 1 file changed, 10 insertions(+), 2 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 2/2] xtensa: The use of CLAMPS instruction also requires TARGET_MINMAX, as well as TARGET_CLAMPS

2023-07-02 Thread Max Filippov via Gcc-patches
inux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 1/2] xtensa: Fix missing mode warning in "*eqne_INT_MIN"

2023-07-02 Thread Max Filippov via Gcc-patches
ed, 1 insertion(+), 1 deletion(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH] xtensa: Use HARD_REG_SET instead of bare integer

2023-07-04 Thread Max Filippov via Gcc-patches
clibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH v6] xtensa: Eliminate the use of callee-saved register that saves and restores only once

2023-02-15 Thread Max Filippov via Gcc-patches
; + int array[1]; /* requires large stack. */ > + foo(); > + asm volatile("" : : "m"(array)); > + return a; > +} > + > +/* register A15 is the reservoir of the stack pointer and cannot be > eliminated if the frame pointer is needed. > + other registers still can be, but through the frame pointer rather the > stack pointer. */ > +int test2(int a) { > + int* p = __builtin_alloca(16); > + foo(); > + asm volatile("" : : "r"(p)); > + return a; > +} > + > +/* in -O0 the composite hard registers may still remain unsplitted at > pro_and_epilogue and must be excluded. */ > +extern double bar(void); > +int __attribute__((optimize(0))) test3(int a) { > + return bar() + a; > +} > + > +/* { dg-final { scan-assembler-times "mov\t|mov.n\t" 21 } } */ This test looks quite fragile as the number of movs would vary when the testsuite is run with additional options. > +/* { dg-final { scan-assembler-times "a15, 8" 2 } } */ > -- > 2.30.2 -- Thanks. -- Max

Re: [PATCH] xtensa: Enforce return address saving when -Og is specified

2023-02-20 Thread Max Filippov via Gcc-patches
clibc, no new regressions. Committed to master. -- Thanks. -- Max

[COMMITTED] gcc: xtensa: fix PR target/108876

2023-02-21 Thread Max Filippov via Gcc-patches
gcc/ PR target/108876 * config/xtensa/xtensa.cc (xtensa_expand_epilogue): Drop emit_use for A0_REG. * config/xtensa/xtensa.md (sibcall, sibcall_internal) (sibcall_value, sibcall_value_internal): Add 'use' expression for A0_REG. --- gcc/config/xtensa/

Re: [PATCH 2/2] xtensa: Fix missing mode warnings in machine description

2023-02-23 Thread Max Filippov via Gcc-patches
xtensa/xtensa.md | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 1/2] xtensa: Fix non-fatal regression introduced by b2ef02e8cbbaf95fee98be255f697f47193960ec

2023-02-23 Thread Max Filippov via Gcc-patches
same place as (return) in the normal call). > * config/xtensa/xtensa.md > (sibcall, sibcall_internal, sibcall_value, sibcall_value_internal): > Revert changes by the previous patch. > --- > gcc/config/xtensa/xtensa.cc | 4 +++- > gcc/config/xtensa/xtensa.md | 20 +++- > 2 files changed, 10 insertions(+), 14 deletions(-) I've reverted my fix and committed this fix minus the revert. -- Thanks. -- Max

[COMMITTED 2/2] xtensa: fix PR target/108876

2023-02-23 Thread Max Filippov via Gcc-patches
In commit b2ef02e8cbbaf95fee98be255f697f47193960ec, the sibling call insn included (use (reg:SI A0_REG)) to fix the problem, which added a USE chain unconditionally to the data flow of register A0 during the sibling call. As a result, df_regs_ever_live_p (A0_REG) returns true, so even if register

[COMMITTED 1/2] Revert "gcc: xtensa: fix PR target/108876"

2023-02-23 Thread Max Filippov via Gcc-patches
This reverts commit b2ef02e8cbbaf95fee98be255f697f47193960ec. --- gcc/config/xtensa/xtensa.cc | 2 ++ gcc/config/xtensa/xtensa.md | 20 +++- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index 5c1c713e122d

Re: [PATCH] xtensa: Fix up fatal_error message strings in xtensa-dynconfig.c [PR108890]

2023-02-23 Thread Max Filippov via Gcc-patches
es of gcc internal > headers rather than "" style which is used everywhere else > in gcc? No real reason for either. I'll fix it. Thanks for your review. -- Max

Re: [PATCH v5] xtensa: Eliminate unnecessary general-purpose reg-reg moves

2023-02-23 Thread Max Filippov via Gcc-patches
+++ > .../gcc.target/xtensa/elim_GP_regmove_0.c | 23 ++ > .../gcc.target/xtensa/elim_GP_regmove_1.c | 10 > 3 files changed, 79 insertions(+) > create mode 100644 gcc/testsuite/gcc.target/xtensa/elim_GP_regmove_0.c > create mode 100644 gcc/testsuite/gcc.target/xtensa/elim_GP_regmove_1.c Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH v7] xtensa: Eliminate the use of callee-saved register that saves and restores only once

2023-02-23 Thread Max Filippov via Gcc-patches
sa/elim_callee_saved.c | 37 + > 2 files changed, 146 insertions(+), 25 deletions(-) > create mode 100644 gcc/testsuite/gcc.target/xtensa/elim_callee_saved.c Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 1/2] xtensa: Fix non-fatal regression introduced by b2ef02e8cbbaf95fee98be255f697f47193960ec

2023-02-23 Thread Max Filippov via Gcc-patches
On Thu, Feb 23, 2023 at 1:35 AM Max Filippov wrote: > > On Wed, Feb 22, 2023 at 7:42 PM Takayuki 'January June' Suwa > wrote: > > > > In commit b2ef02e8cbbaf95fee98be255f697f47193960ec, the sibling call > > insn included (use (reg:SI A0_REG)) to fix the

[COMMITTED 2/2] gcc: xtensa: update include style in xtensa-dynconfig.cc

2023-02-23 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/xtensa-dynconfig.cc (config.h, system.h) (coretypes.h, diagnostic.h, intl.h): Use "..." instead of <...> for the gcc-internal headers. --- gcc/config/xtensa/xtensa-dynconfig.cc | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git

[COMMITTED 1/2] gcc: xtensa: rename xtensa-dynconfig.c and update its build rule

2023-02-23 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/t-xtensa (xtensa-dynconfig.o): Use $(COMPILE) and $(POSTCOMPILE) instead of manual dependency listing. * config/xtensa/xtensa-dynconfig.c: Rename to ... * config/xtensa/xtensa-dynconfig.cc: ... this. --- gcc/config/xtensa/t-xtensa

[PATCH] gcc: xtensa: fix PR target/108919

2023-02-25 Thread Max Filippov via Gcc-patches
gcc/ PR target/108919 * config/xtensa/xtensa-protos.h (xtensa_prepare_expand_call): Rename to xtensa_expand_call. * config/xtensa/xtensa.cc (xtensa_prepare_expand_call): Rename to xtensa_expand_call. (xtensa_expand_call): Emit the call and add a clob

Re: [PATCH] gcc: xtensa: fix PR target/108919

2023-02-25 Thread Max Filippov via Gcc-patches
Hi Suwa-san, On Sat, Feb 25, 2023 at 3:33 AM Takayuki 'January June' Suwa wrote: > On 2023/02/25 19:01, Max Filippov wrote: > > diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc > > index e52fba082550..babe7f0ebd68 100644 > > --- a/gcc/config

[COMMITTED] gcc: xtensa: fix PR target/108919

2023-02-25 Thread Max Filippov via Gcc-patches
gcc/ PR target/108919 * config/xtensa/xtensa-protos.h (xtensa_prepare_expand_call): Rename to xtensa_expand_call. * config/xtensa/xtensa.cc (xtensa_prepare_expand_call): Rename to xtensa_expand_call. (xtensa_expand_call): Emit the call and add a clob

Re: [PATCH] xtensa: Make use of CLAMPS instruction if configured

2023-02-26 Thread Max Filippov via Gcc-patches
's a chapter "Added instructions" at the end of the xtensa ISA book with the list of such opcodes. -- Thanks. -- Max

[PATCH] gcc: xtensa: add XCHAL_HAVE_{CLAMPS, DEPBITS, EXCLUSIVE, XEA3} to dynconfig

2023-02-27 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/xtensa-dynconfig.cc (xtensa_get_config_v2) (xtensa_get_config_v3): New functions. include/ * xtensa-dynconfig.h (xtensa_config_v3): New struct. (xtensa_get_config_v3): New declaration. (XCHAL_HAVE_CLAMPS, XCHAL_HAVE_DEPBITS, XCHAL_HAVE_E

Re: [PATCH] xtensa: Make use of CLAMPS instruction if configured

2023-02-27 Thread Max Filippov via Gcc-patches
sa/xtensa-protos.h | 1 + > gcc/config/xtensa/xtensa.cc | 13 +++ > gcc/config/xtensa/xtensa.h| 1 + > gcc/config/xtensa/xtensa.md | 37 +++ > 4 files changed, 52 insertions(+) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

[PATCH 2/2] gcc: xtensa: adjust STRICT_ALIGNMENT per hardware capabilities

2023-02-28 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/xtensa.h (STRICT_ALIGNMENT): Make it 0 when the hardware supports both unaligned loads and stores. --- gcc/config/xtensa/xtensa.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index

[PATCH 1/2] gcc: xtensa: add data alignment properties to dynconfig

2023-02-28 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/xtensa-dynconfig.cc (xtensa_get_config_v4): New function. include/ * xtensa-dynconfig.h (xtensa_config_v4): New struct. (XCHAL_DATA_WIDTH, XCHAL_UNALIGNED_LOAD_EXCEPTION) (XCHAL_UNALIGNED_STORE_EXCEPTION, XCHAL_UNALIGNED_LOAD_HW)

Re: [PATCH] xtensa: Remove REG_OK_STRICT and its derivatives

2023-03-13 Thread Max Filippov via Gcc-patches
G_OK_STRICT, REG_OK_FOR_INDEX_P, > REG_OK_FOR_BASE_P): Remove. > --- > gcc/config/xtensa/xtensa.h | 11 +-- > 1 file changed, 1 insertion(+), 10 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

[COMMITTED] xtensa: add .note.GNU-stack section on linux

2023-03-13 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/linux.h (TARGET_ASM_FILE_END): New macro. libgcc/ * config/xtensa/crti.S: Add .note.GNU-stack section on linux. * config/xtensa/crtn.S: Likewise. * config/xtensa/lib1funcs.S: Likewise. * config/xtensa/lib2funcs.S: Likewise. --- gcc/conf

Re: [PATCH] xtensa: Fix for enabling LRA

2023-03-13 Thread Max Filippov via Gcc-patches
IL: c-c++-common/torture/builtin-arith-overflow-p-14.c -O2 execution test +FAIL: c-c++-common/torture/builtin-arith-overflow-p-14.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: c-c++-common/torture/builtin-shufflevector-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test -- Thanks. -- Max

Re: [PATCH] xtensa: Make full transition to LRA

2023-05-10 Thread Max Filippov via Gcc-patches
xecution test +FAIL: gcc.dg/torture/pr97812.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test +FAIL: gcc.dg/torture/pr97812.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects execution test +FAIL: gcc.dg/tree-ssa/pr84969.c execution test and some more in the gfortran testsuite. -- Thanks. -- Max

Re: [PATCH 1/2] xtensa: Optimize '(x & CST1_POW2) != 0 ? CST2_POW2 : 0'

2023-05-22 Thread Max Filippov via Gcc-patches
at do not fit into signed 12 bits in the > patterns added above. > --- > gcc/config/xtensa/predicates.md | 3 ++ > gcc/config/xtensa/xtensa.cc | 3 +- > gcc/config/xtensa/xtensa.md | 75 + > 3 files changed, 80 insertions(+), 1 deletion(-) This change introduces a bunch of test failures on big endian configuration. I believe that's because the starting bit position for zero_extract is counted from different ends depending on the endianness. -- Thanks. -- Max

Re: [PATCH v2] xtensa: Optimize '(x & CST1_POW2) != 0 ? CST2_POW2 : 0'

2023-05-23 Thread Max Filippov via Gcc-patches
On Mon, May 22, 2023 at 10:48 PM Takayuki 'January June' Suwa wrote: > > On 2023/05/23 11:27, Max Filippov wrote: > > Hi Suwa-san, > > Hi! > > > This change introduces a bunch of test failures on big endian configuration. > > I believe that's becau

Re: [PATCH 2/2] xtensa: Merge '*addx' and '*subx' insn patterns into one

2023-05-23 Thread Max Filippov via Gcc-patches
ge to also accept '*subx' pattern. > (*subx): Remove. > --- > gcc/config/xtensa/xtensa.md | 31 +-- > 1 file changed, 13 insertions(+), 18 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 2/2] xtensa: Implement new target hook: TARGET_CONSTANT_OK_FOR_CPROP_P

2022-09-13 Thread Max Filippov via Gcc-patches
On Mon, Sep 12, 2022 at 8:00 PM Takayuki 'January June' Suwa wrote: > On 2022/09/13 4:34, Max Filippov wrote: > > On Sun, Sep 11, 2022 at 1:50 PM Takayuki 'January June' Suwa > > wrote: > >> > >> This patch implements new target hook TA

[PATCH] xtensa: gcc: implement MI thunk generation for call0 ABI

2022-09-13 Thread Max Filippov via Gcc-patches
Suwa-san, could you please take a look? This change fixes the fowllowing testsuite failures when building for call0 ABI: g++.dg/ipa/pr60640-4.C g++.dg/ipa/pr83549.C g++.dg/ipa/pr83667.C g++.dg/torture/pr81812.C gcc/ * config/xtensa/xtensa.cc (xtensa_can_output_mi_thunk) (xtensa_o

[COMMITTED] xtensa: gcc: enable section anchors support

2022-09-22 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/xtensa.cc (TARGET_MAX_ANCHOR_OFFSET): New definition. --- gcc/config/xtensa/xtensa.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index e5abd356a745..828c7642b7cb 100644 --- a/gcc/config/xtens

Re: [PATCH] xtensa: gcc: implement MI thunk generation for call0 ABI

2022-09-22 Thread Max Filippov via Gcc-patches
On Tue, Sep 13, 2022 at 2:58 PM Max Filippov wrote: > > Suwa-san, could you please take a look? > > This change fixes the fowllowing testsuite failures when building for > call0 ABI: > > g++.dg/ipa/pr60640-4.C > g++.dg/ipa/pr83549.C > g++.dg/ipa/pr83667.C > g+

Re: [PATCH] xtensa: Prepare the transition from Reload to LRA

2022-10-15 Thread Max Filippov via Gcc-patches
only on call0 configuration: +FAIL: gcc.c-torture/execute/20010122-1.c -O1 execution test +FAIL: gcc.c-torture/execute/20010122-1.c -O2 execution test +FAIL: gcc.c-torture/execute/20010122-1.c -O3 -g execution test +FAIL: gcc.c-torture/execute/20010122-1.c -Os execution test +FAIL: gcc.c-torture/execute/20010122-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test -- Thanks. -- Max

Re: [PATCH v2] xtensa: Prepare the transition from Reload to LRA

2022-10-17 Thread Max Filippov via Gcc-patches
On Mon, Oct 17, 2022 at 7:57 PM Takayuki 'January June' Suwa wrote: > On 2022/10/16 14:03, Max Filippov wrote: > > There's also the following runtime failures, but only on call0 > > configuration: > > > > +FAIL: gcc.c-torture/execute/20010122-1.c -O

Re: [PATCH v2] xtensa: Prepare the transition from Reload to LRA

2022-10-18 Thread Max Filippov via Gcc-patches
Hi Suwa-san, v2 fixes the regressions caused by ICEs, but not the runtime failures. On Mon, Oct 17, 2022 at 8:14 PM Max Filippov wrote: > On Mon, Oct 17, 2022 at 7:57 PM Takayuki 'January June' Suwa > wrote: > > On 2022/10/16 14:03, Max Filippov wrote: > > > The

Re: [PATCH v3] xtensa: Prepare the transition from Reload to LRA

2022-10-19 Thread Max Filippov via Gcc-patches
-- > gcc/config/xtensa/xtensa.h| 8 ++-- > gcc/config/xtensa/xtensa.md | 36 > gcc/config/xtensa/xtensa.opt | 4 ++ > 7 files changed, 99 insertions(+), 24 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master after fixing the changelog. -- Thanks. -- Max

Re: [PATCH] xtensa: Make register A0 allocable for the CALL0 ABI

2022-10-20 Thread Max Filippov via Gcc-patches
ctions execution test FAIL: g++.dg/coroutines/torture/co-yield-04-complex-local-state.C -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test FAIL: g++.dg/coroutines/torture/local-var-05-awaitable.C -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test -- Thanks. -- Max

Re: [PATCH v2] xtensa: Make register A0 allocable for the CALL0 ABI

2022-10-22 Thread Max Filippov via Gcc-patches
g-call functions, in order to prevent misleading that > register A0 is free to use. > --- > gcc/config/xtensa/xtensa.cc | 14 ++ > 1 file changed, 10 insertions(+), 4 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH] xtensa: Fix out-of-bounds array access

2022-10-26 Thread Max Filippov via Gcc-patches
> gcc/ChangeLog: > > * config/xtensa/xtensa.md (movdi): > Copy operands[0...1] to ops[0...3] and then use the latter before > calling xtensa_split_DI_reg_imm() and emitting insns. > --- > gcc/config/xtensa/xtensa.md | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) Committed to master as obvious after cleaning up the commit message. -- Thanks. -- Max

Re: [PATCH] xtensa: Turn on -fsplit-wide-types-early by default

2022-08-15 Thread Max Filippov via Gcc-patches
n/config/xtensa/xtensa-common.cc > (xtensa_option_optimization_table): Add OPT_fsplit_wide_types_early > for OPT_LEVELS_ALL in order to restore pre-GCC10 behavior. > --- > gcc/common/config/xtensa/xtensa-common.cc | 2 ++ > 1 file changed, 2 insertions(+) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH] xtensa: Prevent emitting integer additions of constant zero

2022-08-16 Thread Max Filippov via Gcc-patches
build with the following error: undefined reference to `__addsi3' E.g. gcc.c-torture/execute/2519-1.c or gcc.c-torture/execute/20070919-1.c -- Thanks. -- Max

Re: [PATCH] xtensa: Prevent emitting integer additions of constant zero

2022-08-17 Thread Max Filippov via Gcc-patches
gt; >stack_pointer_rtx, > >GEN_INT (offset)));// offset can > > be zero! > > } Oh, nice catch! I'll post a patch that adds a check for non-zero offset here. -- Thanks. -- Max

Re: [PATCH] xtensa: Optimize stack pointer updates in function pro/epilogue under certain conditions

2022-08-17 Thread Max Filippov via Gcc-patches
iteral value conditions of that instruction > when the CALL0 ABI is used. > (xtensa_expand_epilogue): Ditto. > And also inhibit the stack pointer addition of constant zero. > --- > gcc/config/xtensa/xtensa.cc | 79 +++++ > 1 file changed, 54 insertions(+), 25 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH] xtensa: Improve indirect sibling call handling

2022-08-18 Thread Max Filippov via Gcc-patches
> gcc/config/xtensa/constraints.md | 5 > gcc/config/xtensa/xtensa.h | 3 +++ > gcc/config/xtensa/xtensa.md| 29 ++ > gcc/testsuite/gcc.target/xtensa/sibcalls.c | 5 > 4 files changed, 15 insertions(+), 27 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH v2 1/2] xtensa: Eliminate unused stack frame allocation/freeing

2022-09-05 Thread Max Filippov via Gcc-patches
gt_ggc_mx_die_struct(void*) ./gt-dwarf2out.h:47 0xa470d7 gt_ggc_mx_die_struct(void*) ./gt-dwarf2out.h:27 0xa470d7 gt_ggc_mx_die_struct(void*) ./gt-dwarf2out.h:47 0xa470d7 gt_ggc_mx_die_struct(void*) ./gt-dwarf2out.h:27 -- Thanks. -- Max

[COMMITTED] xtensa: gcc: add static PIE support

2022-09-06 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/linux.h (LINK_SPEC): Add static-pie. --- gcc/config/xtensa/linux.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h index 540e4bf538f8..bc7bee71517d 100644 --- a/gcc/config/xtensa/linux.h +++

Re: [PATCH v3 1/2] xtensa: Eliminate unused stack frame allocation/freeing

2022-09-07 Thread Max Filippov via Gcc-patches
inor issue here: this change introduces a new regression in the following test: g++.dg/opt/pr100469.C AFAICS it generates different code with and without the '-g' option: no stack modification without -g, but adjustment in prologue and epilogue with -g. -- Thanks. -- Max

Re: [PATCH v4 1/2] xtensa: Eliminate unused stack frame allocation/freeing

2022-09-09 Thread Max Filippov via Gcc-patches
t; --- > gcc/config/xtensa/xtensa.cc | 164 ++-- > 1 file changed, 80 insertions(+), 84 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 2/2] xtensa: Make complex hard register clobber elimination more robust and accurate

2022-09-09 Thread Max Filippov via Gcc-patches
d | 67 + > 1 file changed, 45 insertions(+), 22 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH] xtensa: constantsynth: Add new 3-insns synthesis pattern

2022-09-10 Thread Max Filippov via Gcc-patches
> > * gcc.target/xtensa/constsynth_3insns.c (test_4): > Add new test function. > --- > gcc/config/xtensa/xtensa.cc | 31 +++ > .../gcc.target/xtensa/constsynth_3insns.c | 11 +++ > 2 files changed, 42 insertions(+) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

[COMMITTED] xtensa: gcc: fix builtin_apply return value

2022-09-12 Thread Max Filippov via Gcc-patches
xtensa may use up to 4 registers to return a value from a function, but recognition of only one register in the xtensa_function_value_regno_p and missing untyped_call pattern result in that only one register is saved by the __builtin_apply and returned by the __builtin_apply_return. gcc/ *

Re: [PATCH 2/2] xtensa: Implement new target hook: TARGET_CONSTANT_OK_FOR_CPROP_P

2022-09-12 Thread Max Filippov via Gcc-patches
ions(+), 3 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 1/2] xtensa: Rename deprecated extv/extzv insn patterns to extvsi/extzvsi

2022-05-13 Thread Max Filippov via Gcc-patches
extv, extv_internal, extzv and > extzv_internal, respectively. > --- > gcc/config/xtensa/xtensa.md | 16 > 1 file changed, 8 insertions(+), 8 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 2/2] xtensa: Reflect the 32-bit Integer Divide Option

2022-05-13 Thread Max Filippov via Gcc-patches
ut does not. It should be fixed in the kernel. Committed to master. -- Thanks. -- Max

[COMMITTED] gcc: xtensa: fix PR target/102115

2021-09-07 Thread Max Filippov via Gcc-patches
2021-09-07 Takayuki 'January June' Suwa gcc/ PR target/102115 * config/xtensa/xtensa.c (xtensa_emit_move_sequence): Add 'CONST_INT_P (src)' to the condition of the block that tries to eliminate literal when loading integer contant. --- gcc/config/xtensa/xtensa.c

[COMMITTED] gcc: xtensa: fix PR target/102336

2021-09-14 Thread Max Filippov via Gcc-patches
2021-09-14 Max Filippov gcc/ PR target/102336 * config/xtensa/t-xtensa (TM_H): Add include/xtensa-config.h. --- gcc/config/xtensa/t-xtensa | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/config/xtensa/t-xtensa b/gcc/config/xtensa/t-xtensa index 973815c8c2d6

Re: [PATCH] xtensa: Fix 2 warnings during xtensa build [PR100841]

2021-06-03 Thread Max Filippov via Gcc-patches
ive, and thus the warning. > > I think xtensa doesn't have 2G hard registers and so it is ok to just cast > > it to int. > > > > Verified just by making sure the warnings go away in a cross, ok for trunk? > > > > 2021-06-02 Jakub Jelinek > > > > PR target/100841 > > * config/xtensa/xtensa.h (LEAF_REG_REMAP): Cast REGNO to int to avoid > > -Wtype-limits warnings. > > (DWARF_FRAME_REGISTER): Rewrite into ternary operator with addition > > in operands to avoid -Wsign-compare warnings. > OK. > jeff Looks good to me. Thank you! -- Max

Re: [PATCH] xtensa: Apply a few minor fixes

2022-12-27 Thread Max Filippov via Gcc-patches
sa/xtensa.md | 105 ++- > 7 files changed, 133 insertions(+), 127 deletions(-) I've split it into independent parts and applied to master. -- Thanks. -- Max

[COMMITTED 4/4] xtensa: Generate density instructions in set_frame_ptr

2022-12-27 Thread Max Filippov via Gcc-patches
From: Takayuki 'January June' Suwa gcc/ChangeLog: * config/xtensa/xtensa.md (set_frame_ptr): Fix to reflect TARGET_DENSITY. --- gcc/config/xtensa/xtensa.md | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/

[COMMITTED 3/4] xtensa: Change GP_RETURN{, _REG_COUNT} to GP_RETURN_{FIRST, LAST}

2022-12-27 Thread Max Filippov via Gcc-patches
From: Takayuki 'January June' Suwa gcc/ChangeLog: * config/xtensa/xtensa.h (GP_RETURN, GP_RETURN_REG_COUNT): Change to GP_RETURN_FIRST and GP_RETURN_LAST, respectively. * config/xtensa/xtensa.cc (xtensa_function_value, xtensa_libcall_value, xtensa_function_value_r

[COMMITTED 2/4] xtensa: Clean up xtensa_expand_prologue

2022-12-27 Thread Max Filippov via Gcc-patches
From: Takayuki 'January June' Suwa gcc/ChangeLog: * config/xtensa/xtensa.cc (xtensa_expand_prologue): Modify to exit the inspection loops as soon as the necessity of stack pointer is found. --- gcc/config/xtensa/xtensa.cc | 10 -- 1 file changed, 8 insertions(+),

[COMMITTED] gcc: xtensa: use define_c_enums instead of define_constants

2022-12-27 Thread Max Filippov via Gcc-patches
This improves RTL dumps readability. No functional changes. gcc/ * config/xtensa/xtensa.md (unspec): Extract UNSPEC_* constants into this enum. (unspecv): Extract UNSPECV_* constants into this enum. --- gcc/config/xtensa/xtensa.md | 46 -

[COMMITTED 1/4] xtensa: Tabify, and trim trailing spaces

2022-12-27 Thread Max Filippov via Gcc-patches
From: Takayuki 'January June' Suwa Cosmetic and no functional changes. gcc/ChangeLog: * config/xtensa/elf.h: Tabify, and trim trailing spaces. * config/xtensa/linux.h: Likewise. * config/xtensa/uclinux.h: Likewise. * config/xtensa/xtensa-dynconfig.c: Likewise.

Re: [PATCH] xtensa: Check DF availability before use

2022-12-29 Thread Max Filippov via Gcc-patches
> gcc/config/xtensa/xtensa.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

[COMMITTED] gcc: xtensa: use GP_RETURN_* instead of magic constant

2022-12-29 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/xtensa.cc (xtensa_return_in_memory): Use GP_RETURN_* instead of magic constant. --- gcc/config/xtensa/xtensa.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index e726a115029f..ae4

Re: [PATCH] xtensa: Optimize stack frame adjustment more

2023-01-05 Thread Max Filippov via Gcc-patches
4ab2: b0c112 addia1, a1, -80 ... +4abf: 20c112 addia1, a1, 32 +4ac2: f00dret.n I.e. a1 is first moved into the parent stack frame, then back to the right spot. This does not look correct, especially for bare-metal targets. -- Thanks. -- Max

Re: [PATCH] xtensa: Optimize stack frame adjustment more

2023-01-05 Thread Max Filippov via Gcc-patches
your investigation, but it may be better to > withdraw the patch. The issue was in the unwinding code in the libgcc_s.so. I haven't figured out the exact mechanism, but found that emitting a separate note for each a1 change fixes it. -- Thanks. -- Max

Re: [PATCH] xtensa: Optimize stack frame adjustment more

2023-01-06 Thread Max Filippov via Gcc-patches
hange: textdata bss dec hex filename 7062530 635340 286400 7984270 79d48e vmlinux generic_kc705_defconfig with the change: textdata bss dec hex filename 7064078 635340 286400 7985818 79da9a vmlinux -- Thanks. -- Max

Re: [PATCH v2] xtensa: Optimize stack frame adjustment more

2023-01-07 Thread Max Filippov via Gcc-patches
And also change to try reusing the content of scratch register > A9 if the register is not modified in the function body. > --- > gcc/config/xtensa/xtensa.cc | 151 +--- > 1 file changed, 106 insertions(+), 45 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH] xtensa: Optimize bitwise splicing operation

2023-01-07 Thread Max Filippov via Gcc-patches
ft = floor_log2 (INTVAL (operands[3]) + 1); > + operands[3] = GEN_INT (shift); > + operands[4] = GEN_INT (32 - shift); > + operands[5] = gen_reg_rtx (SImode); > + operands[6] = gen_reg_rtx (SImode); > +} > + [(set_attr "type""arith") > + (set_attr "mode""SI") > + (set (attr "length") > + (if_then_else (match_test "TARGET_DENSITY > + && (INTVAL (operands[3]) == 0x7FFF > + || INTVAL (operands[4]) == > 0x7FFF)") > + (const_int 11) > + (const_int 12)))]) I wonder how the length could be 11 here? I always see 4 3-byte instructions generated by this pattern. -- Thanks. -- Max

Re: [PATCH v2] xtensa: Optimize bitwise splicing operation

2023-01-08 Thread Max Filippov via Gcc-patches
ed for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH] xtensa: Make instruction cost estimation for size more accurate

2023-01-10 Thread Max Filippov via Gcc-patches
angeLog: > > * config/xtensa/xtensa.cc (xtensa_insn_cost): > Let insn cost for size be obtained by applying COSTS_N_INSNS() > to instruction length and then dividing by 3. > --- > gcc/config/xtensa/xtensa.cc | 11 +++ > 1 file changed, 7 insertions(+), 4 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 1/2] xtensa: Tune "*btrue" insn pattern

2023-01-12 Thread Max Filippov via Gcc-patches
+-- > 1 file changed, 9 insertions(+), 2 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH 2/2] xtensa: Optimize ctzsi2 and ffssi2 a bit

2023-01-12 Thread Max Filippov via Gcc-patches
> gcc/config/xtensa/xtensa.md | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH] xtensa: Remove old broken tweak for leaf function

2023-01-14 Thread Max Filippov via Gcc-patches
| 51 ++-- > 3 files changed, 31 insertions(+), 99 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH] xtensa: Eliminate the use of callee-saved register that saves and restores only once

2023-01-16 Thread Max Filippov via Gcc-patches
- mov.n a15, sp + s32i.n sp, sp, 0 sub sp, sp, a10 mov.n a6, sp mov.n a12, a6 @@ -59,11 +58,10 @@ addi.n a2, a2, 4 bne a12, a13, .L6 .L1: - mov.n sp, a15 + l32i.n sp, sp, 0 l32i.n a0, sp, 12 l32i.n a12, sp, 8 l32i.n a13, sp, 4 - l32i.n a15, sp, 0 addisp, sp, 16 ret.n .size foo, .-foo -- Thanks. -- Max

Re: [PATCH] xtensa: Eliminate unnecessary general-purpose reg-reg moves

2023-01-17 Thread Max Filippov via Gcc-patches
SN(rtx_def*) gcc/gcc/rtl.h:1493 0x7c448d BLOCK_FOR_INSN(rtx_def*) gcc/gcc/rtl.h:1509 0x7c448d gen_peephole2_4(rtx_insn*, rtx_def**) gcc/gcc/config/xtensa/xtensa.md:3102 0xe1cce2 peephole2_optimize gcc/gcc/recog.cc:4180 0xe1cce2 rest_of_handle_peephole2 gcc/gcc/recog.cc:4331 0xe1cce2 execute gcc/gcc/recog.cc:4368 -- Thanks. -- Max

Re: [PATCH v2] xtensa: Eliminate the use of callee-saved register that saves and restores only once

2023-01-17 Thread Max Filippov via Gcc-patches
1.c -Os (test for excess errors) +FAIL: gcc.dg/torture/pr42878-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) E.g. check the following test with -g0 and -g: gcc/cc1 gcc/testsuite/gcc.dg/torture/pr42878-1.c -mlongcalls -mtext-section-literals -fdiagnostics-plain-output -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -- Thanks. -- Max

Re: [PATCH v3] xtensa: Eliminate the use of callee-saved register that saves and restores only once

2023-01-18 Thread Max Filippov via Gcc-patches
.c -Os execution test FAIL: gcc.dg/torture/tls/thr-init-2.c -O2 -fpic execution test FAIL: gcc.dg/torture/tls/thr-init-2.c -O3 -g -fpic execution test FAIL: gcc.dg/torture/tls/thr-init-2.c -Os -fpic execution test FAIL: gcc.dg/torture/tls/thr-init-2.c -O2 -fPIC execution test FAIL: gcc.dg/torture/tls/thr-init-2.c -O3 -g -fPIC execution test FAIL: gcc.dg/torture/tls/thr-init-2.c -Os -fPIC execution test -- Thanks. -- Max

Re: [PATCH v2] xtensa: Eliminate unnecessary general-purpose reg-reg moves

2023-01-18 Thread Max Filippov via Gcc-patches
0xd1bd77 df_scan_verify() gcc/gcc/df-scan.cc:4246 0xd06ca7 df_verify() gcc/gcc/df-core.cc:1818 0xd06ca7 df_analyze_1 gcc/gcc/df-core.cc:1214 0x1a7287c if_convert gcc/gcc/ifcvt.cc:5858 0x1a73ddd execute gcc/gcc/ifcvt.cc:6026 -- Thanks. -- Max

Re: [PATCH] xtensa: Optimize inversion of the MSB

2023-01-18 Thread Max Filippov via Gcc-patches
sa.md | 26 +- > 1 file changed, 25 insertions(+), 1 deletion(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

Re: [PATCH v4] xtensa: Eliminate the use of callee-saved register that saves and restores only once

2023-01-20 Thread Max Filippov via Gcc-patches
_LEND: l32ra9, .LC12 add.n sp, sp, a9 l32i.n a0, sp, 12 l32i.n a12, sp, 8 addisp, sp, 16 ret.n the stack pointer is modified after saving callee-saved registers, but the stack offset where a2 is stored and reloaded does not take this into an account. After having this many attempts and getting to the issues that are really hard to detect I wonder if the target backend is the right place for this optimization? -- Thanks. -- Max

Re: [PATCH v3] xtensa: Eliminate unnecessary general-purpose reg-reg moves

2023-01-20 Thread Max Filippov via Gcc-patches
_def const*, char const*, int, char const*) gcc/gcc/rtl-error.cc:108 0x6c3297 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*) gcc/gcc/rtl-error.cc:116 0x6b4735 extract_constrain_insn(rtx_insn*) gcc/gcc/recog.cc:2692 0xe1f67e copyprop_hardreg_forward_1 gcc/gcc/regcprop.cc:826 0xe20a0f execute gcc/gcc/regcprop.cc:1408 -- Thanks. -- Max

Re: [PATCH] xtensa: Optimize boolean evaluation when SImode EQ/NE to zero if TARGET_MINMAX

2023-09-05 Thread Max Filippov via Gcc-patches
minua2, a2, a9 > ret.n ISTM that test1 could be done with movnez in the same two instructions: movi a9, 1 movnez a2, a9, a2 -- Thanks. -- Max

Re: [PATCH] xtensa: Optimize boolean evaluation when SImode EQ/NE to zero if TARGET_MINMAX

2023-09-06 Thread Max Filippov via Gcc-patches
On Tue, Sep 5, 2023 at 9:24 PM Takayuki 'January June' Suwa wrote: > On 2023/09/06 8:01, Max Filippov wrote: > > On Tue, Sep 5, 2023 at 2:29 AM Takayuki 'January June' Suwa > > wrote: > >> ;; after (prereq. TARGET_MINMAX) > >> test0: &

Re: [PATCH] xtensa: Optimize boolean evaluation when SImode EQ/NE to zero if TARGET_MINMAX

2023-09-06 Thread Max Filippov via Gcc-patches
a.cc | 43 +++-- > gcc/config/xtensa/xtensa.md | 34 ----- > 2 files changed, 37 insertions(+), 40 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

[RFC] gcc: xtensa: use salt/saltu in xtensa_expand_scc

2023-09-07 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/predicates.md (xtensa_cstoresi_operator): Add unsigned comparisons. * config/xtensa/xtensa.cc (xtensa_expand_scc): Add code generation of salt/saltu instructions. * config/xtensa/xtensa.h (TARGET_SALT): New macro. * gcc/config/xte

Re: [PATCH] xtensa: Optimize several boolean evaluations of EQ/NE against constant zero

2023-09-13 Thread Max Filippov via Gcc-patches
registers. > * config/xtensa/xtensa.md (*eqne_INT_MIN): Ditto. > (eq_zero_NSA, eqne_zero, *eqne_zero_masked_bits): New patterns. > --- > gcc/config/xtensa/xtensa.cc | 35 +-- > gcc/config/xtensa/xtensa.md | 112 > 2 files changed, 113 insertions(+), 34 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max

[COMMITTED] gcc: xtensa: use salt/saltu in xtensa_expand_scc

2023-09-14 Thread Max Filippov via Gcc-patches
gcc/ * config/xtensa/predicates.md (xtensa_cstoresi_operator): Add unsigned comparisons. * config/xtensa/xtensa.cc (xtensa_expand_scc): Add code generation of salt/saltu instructions. * config/xtensa/xtensa.h (TARGET_SALT): New macro. * config/xtensa/

[PATCH] xtensa: fix PR target/94584

2020-04-13 Thread Max Filippov via Gcc-patches
Patterns zero_extendhisi2, zero_extendqisi2 and extendhisi2_internal can load value from memory, but they don't treat volatile memory correctly. Add %v1 before load instructions to emit 'memw' instruction when -mserialize-volatile is in effect. 2020-04-13 Max Filippov gcc/

Re: [PATCH] xtensa: fix PR target/94584

2020-04-14 Thread Max Filippov via Gcc-patches
On Tue, Apr 14, 2020 at 4:40 PM augustine.sterl...@gmail.com wrote: > > On Mon, Apr 13, 2020 at 4:39 PM Max Filippov wrote: > > 2020-04-13 Max Filippov > > gcc/ > > * config/xtensa/xtensa.md (zero_extendhisi2, zero_extendqisi2) > > (extendhisi2

[PATCH] gcc: xtensa: delegitimize UNSPEC_PLT

2020-05-26 Thread Max Filippov via Gcc-patches
This fixes 'non-delegitimized UNSPEC 3 found in variable location' notes issued when building libraries which interferes with running tests. 2020-05-24 Max Filippov gcc/ * config/xtensa/xtensa.c (xtensa_delegitimize_address): New function. (TARGET_DELEGITIMI

Re: [PATCH] gcc: xtensa: delegitimize UNSPEC_PLT

2020-05-27 Thread Max Filippov via Gcc-patches
On Wed, May 27, 2020 at 4:35 PM augustine.sterl...@gmail.com wrote: > > On Tue, May 26, 2020 at 11:43 AM Max Filippov wrote: > > > > This fixes 'non-delegitimized UNSPEC 3 found in variable location' notes > > issued when building libraries which interferes with

[COMMITTED] gcc: xtensa: fix PR target/98285

2020-12-14 Thread Max Filippov via Gcc-patches
2020-12-14 Max Filippov gcc/ * config/xtensa/predicates.md (addsubx_operand): Change accepted values from 2/4/8 to 1..3. * config/xtensa/xtensa.md (*addx, *subx): Change RTL pattern to use 'ashift' instead of 'mult'. Update operands[3] v

[COMMITTED] gcc: xtensa: rearrange DI mode constant loading

2020-12-16 Thread Max Filippov via Gcc-patches
From: Takayuki 'January June' Suwa 2020-12-16 Takayuki 'January June' Suwa gcc/ * config/xtensa/xtensa.c (xtensa_emit_move_sequence): Try to replace 'l32r' with 'movi' + 'slli' when optimizing for size. * config/xtensa/xtensa.md (movdi): Split loading DI mode constant

<    1   2   3   4   >