Re: [RFC,patch] Linker plugin - extend API for offloading corner case (aka: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook [GCC PR109128])

2023-05-10 Thread Alan Modra via Gcc-patches
On Thu, May 04, 2023 at 11:02:25AM +, Richard Biener via Binutils wrote: > So since we expect the linker to use the host side table is there a way > for the plugin to exactly query that (the set of symbols the linker > uses from the object passed to the plugin)? That would be possible and rela

Re: [PATCH 3/8] [RS6000] rs6000_rtx_costs tidy AND

2021-01-21 Thread Alan Modra via Gcc-patches
Ping. On Tue, Jan 12, 2021 at 02:01:57PM +1030, Alan Modra wrote: > Ping > https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555754.html > > On Thu, Oct 08, 2020 at 09:27:55AM +1030, Alan Modra wrote: > > * config/rs6000/rs6000.c (rs6000_rtx_costs): Tidy AND code. > > Don't avoid rec

Re: [PATCH 4/8] [RS6000] rs6000_rtx_costs tidy break/return

2021-01-21 Thread Alan Modra via Gcc-patches
Ping. On Tue, Jan 12, 2021 at 02:02:09PM +1030, Alan Modra wrote: > Ping > https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555755.html > > On Thu, Oct 08, 2020 at 09:27:56AM +1030, Alan Modra wrote: > > Most cases use "return false" rather than breaking out of the switch. > > Do so in all

Re: [PATCH 5/8] [RS6000] rs6000_rtx_costs cost IOR

2021-01-21 Thread Alan Modra via Gcc-patches
Ping. On Tue, Jan 12, 2021 at 02:02:18PM +1030, Alan Modra wrote: > Ping > https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555756.html > > On Thu, Oct 08, 2020 at 09:27:57AM +1030, Alan Modra wrote: > > * config/rs6000/rs6000.c (rotate_insert_cost): New function. > > (rs6000_rtx_co

Re: [PATCH 7/8] [RS6000] rs6000_rtx_costs reduce cost for SETs

2021-01-21 Thread Alan Modra via Gcc-patches
Ping. On Tue, Jan 12, 2021 at 02:02:27PM +1030, Alan Modra wrote: > Ping > https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555758.html > > On Thu, Oct 08, 2020 at 09:27:59AM +1030, Alan Modra wrote: > > The aim of this patch is to make rtx_costs for SETs closer to > > insn_cost for SETs.

Re: [PATCH 8/8] [RS6000] rs6000_rtx_costs for !speed

2021-01-21 Thread Alan Modra via Gcc-patches
Ping. On Tue, Jan 12, 2021 at 02:02:36PM +1030, Alan Modra wrote: > Ping > https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555759.html > > On Thu, Oct 08, 2020 at 09:28:00AM +1030, Alan Modra wrote: > > When optimizing for size we shouldn't be using metrics based on speed > > or vice-versa

Re: [RS6000] Adjust testcases for power10 instructions V3

2021-01-21 Thread Alan Modra via Gcc-patches
Ping. On Tue, Jan 12, 2021 at 02:03:18PM +1030, Alan Modra wrote: > Ping > https://gcc.gnu.org/pipermail/gcc-patches/2020-October/557587.html > > On Fri, Oct 30, 2020 at 07:00:14PM +1030, Alan Modra wrote: > > And now waking up to what you meant by the lvsl-lvsr.c \s comment, > > plus a revised p

Re: [PATCH 3/8] [RS6000] rs6000_rtx_costs tidy AND

2021-01-31 Thread Alan Modra via Gcc-patches
On Mon, Jan 25, 2021 at 04:37:21PM -0600, Segher Boessenkool wrote: > I still do not see what this improves, I only see possible obvious > regressions :-( You asked me to break the patch series into small pieces, for ease of review and to separate tidies from functional changes. Well OK, fair eno

Re: [PATCH 5/8] [RS6000] rs6000_rtx_costs cost IOR

2021-01-31 Thread Alan Modra via Gcc-patches
On Mon, Jan 25, 2021 at 04:51:43PM -0600, Segher Boessenkool wrote: > Hi! > > On Thu, Oct 08, 2020 at 09:27:57AM +1030, Alan Modra wrote: > > * config/rs6000/rs6000.c (rotate_insert_cost): New function. > > (rs6000_rtx_costs): Cost IOR. > > > > diff --git a/gcc/config/rs6000/rs6000.c b/gc

Re: [PATCH, rs6000] Optimization for PowerPC 64bit constant generation [PR94395]

2021-02-02 Thread Alan Modra via Gcc-patches
On Fri, Jan 29, 2021 at 11:11:23AM +0800, HAO CHEN GUI via Gcc-patches wrote: >    This patch tries to optimize PowerPC 64 bit constant generation when the > constant can be transformed from a 32 bit or 16 bit constant by rotating, > shifting and mask AND. All and more of what you are doing here f

Re: [PATCH 3/8] intl: always picify

2021-02-10 Thread Alan Modra via Gcc-patches
On Mon, Feb 08, 2021 at 11:16:30AM +, Nick Alcock via Binutils wrote: > intl/ChangeLog > 2021-02-02 Nick Alcock > > * aclocal.m4: include picflag.m4. > * configure.ac (PICFLAG): Add and substitute. > * Makefile.in (PICFLAG): New. > (COMPILE): Use it. > * config

Re: [PATCH 4/8] intl: turn LIBINTL into -L / -l form

2021-02-10 Thread Alan Modra via Gcc-patches
On Mon, Feb 08, 2021 at 11:16:31AM +, Nick Alcock via Binutils wrote: > intl/ChangeLog > 2021-02-04 Nick Alcock > > * configure.ac (LIBINTL): Transform into -L/-lintl form. > * configure: Regenerate. OK for binutils. -- Alan Modra Australia Development Lab, IBM

Re: [PATCH] Add -fgnu-retain/-fno-gnu-retain

2021-02-18 Thread Alan Modra via Gcc-patches
On Wed, Feb 17, 2021 at 11:23:12AM +, Jozef Lawrynowicz wrote: > In previous discussions, it seemed to me that there was general support > for the "used" attribute implying SHF_GNU_RETAIN and saving symbols from > linker garbage collection[1]. Of course, the current implementation > results in

[RS6000] rtx_costs

2020-09-14 Thread Alan Modra via Gcc-patches
This patch series fixes a number of issues in rs6000_rtx_costs, the aim being to provide costing somewhat closer to reality. Probably the most important patch of the series is patch 4, which just adds a comment. Without the analysis that went into that comment, I found myself making what seemed t

[RS6000] Count rldimi constant insns

2020-09-14 Thread Alan Modra via Gcc-patches
rldimi is generated by rs6000_emit_set_long_const when the high and low 32 bits of a 64-bit constant are equal. * config/rs6000/rs6000.c (num_insns_constant_gpr): Count rldimi constants correctly. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 20a4ba382

[RS6000] rs6000_rtx_costs cost IOR

2020-09-14 Thread Alan Modra via Gcc-patches
* config/rs6000/rs6000.c (rs6000_rtx_costs): Cost IOR. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8c300b82b11..fb5fe7969a3 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -21177,6 +21177,7 @@ static bool rs6000_rtx_costs (rtx x,

[RS6000] rotate and mask constants

2020-09-14 Thread Alan Modra via Gcc-patches
Implement more two insn constants. PR 94393 * config/rs6000/rs6000.c (rotate_and_mask_constant): New function. (num_insns_constant_multi, rs6000_emit_set_long_const): Use it here. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 86c90c4d756..1848c

[RS6000] rs6000_rtx_costs for AND

2020-09-14 Thread Alan Modra via Gcc-patches
The existing "case AND" in this function is not sufficient for optabs.c:avoid_expensive_constant usage, where the AND is passed in outer_code. * config/rs6000/rs6000.c (rs6000_rtx_costs): Move costing for AND to CONST_INT case. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/

[RS6000] rs6000_rtx_costs multi-insn constants

2020-09-14 Thread Alan Modra via Gcc-patches
This small patch to rs6000_rtx_const considerably improves code generated for large constants in 64-bit code, teaching gcc that it is better to load a constant from memory than to generate a sequence of up to five dependent instructions. Note that the rs6000 backend does generate large constants a

[RS6000] rs6000_rtx_costs comment

2020-09-14 Thread Alan Modra via Gcc-patches
Prior patches in this series were small bug fixes. This lays out the ground rules for following patches. * config/rs6000/rs6000.c (rs6000_rtx_costs): Expand comment. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 523d029800a..5b3c0ee0e8c 100644 --- a/gcc/confi

[RS6000] rs6000_rtx_costs reduce cost for SETs

2020-09-14 Thread Alan Modra via Gcc-patches
Also use rs6000_cost only for speed. * config/rs6000/rs6000.c (rs6000_rtx_costs): Reduce cost for SETs when insn operation cost handled on recursive call. Only use rs6000_cost for speed. Tidy break/return. Tidy AND costing. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/

[RS6000] rs6000_rtx_costs for PLUS/MINUS constant

2020-09-14 Thread Alan Modra via Gcc-patches
These functions do behave a little differently for SImode, so the mode should be passed. * config/rs6000/rs6000.c (rs6000_rtx_costs): Pass mode to reg_or_add_cint_operand and reg_or_sub_cint_operand. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 6fc86f

Re: [PATCH] rs6000: inefficient 64-bit constant generation for consecutive 1-bits

2020-09-14 Thread Alan Modra via Gcc-patches
On Thu, Sep 10, 2020 at 04:58:03PM -0500, Peter Bergner via Gcc-patches wrote: > +unsigned long > +test0 (void) > +{ > + return 0x0000UL; > +} > + > +unsigned long > +test1 (void) > +{ > + return 0x0000UL; > +} > + > +unsigned long > +test2 (void) > +{ > + return 0x00f

Re: [RS6000] rotate and mask constants

2020-09-15 Thread Alan Modra via Gcc-patches
On Tue, Sep 15, 2020 at 10:49:46AM +0930, Alan Modra wrote: > Implement more two insn constants. And tests. rot_cst1 checks the values generated, rot_cst2 checks instruction count. * gcc.target/powerpc/rot_cst.h, * gcc.target/powerpc/rot_cst1.c, * gcc.target/powerpc/rot_c

Re: [RS6000] rs6000_rtx_costs for AND

2020-09-16 Thread Alan Modra via Gcc-patches
On Tue, Sep 15, 2020 at 01:15:34PM -0500, will schmidt wrote: > On Tue, 2020-09-15 at 10:49 +0930, Alan Modra via Gcc-patches wrote: > > The existing "case AND" in this function is not sufficient for > > optabs.c:avoid_expensive_constant usage, where the AND is

Re: [RS6000] rs6000_rtx_costs cost IOR

2020-09-16 Thread Alan Modra via Gcc-patches
On Wed, Sep 16, 2020 at 07:02:06PM -0500, Segher Boessenkool wrote: > Hi! > > On Tue, Sep 15, 2020 at 10:49:44AM +0930, Alan Modra wrote: > > * config/rs6000/rs6000.c (rs6000_rtx_costs): Cost IOR. > > > case IOR: > > - /* FIXME */ > >*total = COSTS_N_INSNS (1); > > - re

Re: [RS6000] rs6000_rtx_costs reduce cost for SETs

2020-09-17 Thread Alan Modra via Gcc-patches
On Thu, Sep 17, 2020 at 12:51:25PM -0500, Segher Boessenkool wrote: > Hi! > > On Tue, Sep 15, 2020 at 10:49:45AM +0930, Alan Modra wrote: > > Also use rs6000_cost only for speed. > > More directly: use something completely different for !speed, namely, > code size. Yes, that might be better. >

Re: [RS6000] rs6000_rtx_costs reduce cost for SETs

2020-09-21 Thread Alan Modra via Gcc-patches
On Fri, Sep 18, 2020 at 01:13:18PM -0500, Segher Boessenkool wrote: > Thanks (to both of you). Interesting! Which of these unrelated changes > does this come from? Most of the changes I saw in code generation (not in spec, I didn't look there, but in gcc) came down to this change to the cost for

Re: [RS6000] rs6000_rtx_costs cost IOR

2020-09-21 Thread Alan Modra via Gcc-patches
On Mon, Sep 21, 2020 at 10:49:17AM -0500, Segher Boessenkool wrote: > Hi! > > On Thu, Sep 17, 2020 at 01:12:19PM +0930, Alan Modra wrote: > > On Wed, Sep 16, 2020 at 07:02:06PM -0500, Segher Boessenkool wrote: > > > > + /* Test both regs even though the one in the mask is > > > > +

PR97107, libgo fails to build for power10

2020-09-21 Thread Alan Modra via Gcc-patches
Calls from split-stack code to non-split-stack code need to expand mapped stack memory via __morestack. Even tail calls. __morestack is quite a surprising function on powerpc in that it calls back to its caller, and a tail call will continue running in the context of extra mapped stack. Bootstra

[RS6000] Power10 libffi fixes

2020-09-21 Thread Alan Modra via Gcc-patches
Power10 pc-relative code doesn't use or preserve r2 as a TOC pointer. That means calling between pc-relative and TOC using code can't be done without intervening linker stubs, and a call from TOC code to pc-relative code must have a nop after the bl in order to restore r2. Now the PowerPC libffi a

Re: PR97107, libgo fails to build for power10

2020-09-22 Thread Alan Modra via Gcc-patches
Hi Segher, On Tue, Sep 22, 2020 at 06:59:42PM -0500, Segher Boessenkool wrote: > On Tue, Sep 22, 2020 at 09:55:12AM +0930, Alan Modra wrote: > >if (!info->push_p) > > -return; > > +{ > > + /* We need the -fsplit-stack prologue for functions that make > > +tail calls. Tail cal

Re: [RS6000] Power10 libffi fixes

2020-09-23 Thread Alan Modra via Gcc-patches
On Tue, Sep 22, 2020 at 07:16:57PM -0500, Segher Boessenkool wrote: > Hi! > > On Tue, Sep 22, 2020 at 10:00:11AM +0930, Alan Modra wrote: > > gcc/ > > * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): > > Conditionally define __PCREL__. > > Please do that as a separate (earlier) p

Re: PR97107, libgo fails to build for power10

2020-09-23 Thread Alan Modra via Gcc-patches
On Tue, Sep 22, 2020 at 07:52:53PM -0500, Segher Boessenkool wrote: > It isn't obvious that the outer sequence is always what we want. If > there is some nicer way to get at the info you want, that would help. > > But, this is the expander only -- so I guess we are okay here, it is > much limited

Re: [RS6000] Power10 libffi fixes

2020-09-23 Thread Alan Modra via Gcc-patches
On Thu, Sep 24, 2020 at 01:11:02PM +0930, Alan Modra wrote: > I've fixed the changelog, a comment, and added a nop after bl for the > old calls without @notoc. While there really isn't a need for the > nops in libffi.so since the callee is hidden visibility, there is a > miniscule chance that a st

Re: [PATCH] rs6000: Use parameterized names for tablejump

2020-09-29 Thread Alan Modra via Gcc-patches
On Wed, Sep 30, 2020 at 12:04:25AM +, Segher Boessenkool wrote: > * config/rs6000/rs6000.md (tablejump): Simplify. > (tablejumpsi): Merge this ... > (tablejumpdi): ... and this ... > (@tablejump_normal): ... into this. > (tablejumpsi_nospec): Merge this ... >

[RS6000] gcc/configure typo fix

2020-09-29 Thread Alan Modra via Gcc-patches
Committed as obvious. * configure.ac (--with-long-double-format): Typo fix. * configure: Regenerate. diff --git a/gcc/configure.ac b/gcc/configure.ac index f5612161dcd..1ad5bbc6935 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -6260,7 +6260,7 @@ supported if the default

[RS6000] -mno-minimal-toc vs. power10 pcrelative

2020-09-30 Thread Alan Modra via Gcc-patches
We've had this hack in the libgcc config to build libgcc with -mcmodel=small for powerpc64 for a long time. It wouldn't be a bad thing if someone who knows the multilib machinery well could arrange for -mcmodel=small to be passed just for ppc64 when building for earlier than power10. But for now,

[RS6000] Adjust gcc asm for power10

2020-09-30 Thread Alan Modra via Gcc-patches
Generate assembly that is .localentry 1 with @notoc calls to match. Bootstrapped and regression tested powerpc64le-linux on power8, and bootstrapped on power10. (I lost the power10 machine to someone else before I could build a baseline to compare against.) gcc/ * config/rs6000/ppc-asm.h

Re: [RS6000] Adjust gcc asm for power10

2020-09-30 Thread Alan Modra via Gcc-patches
On Wed, Sep 30, 2020 at 05:36:08PM -0500, Segher Boessenkool wrote: > On Wed, Sep 30, 2020 at 05:06:57PM +0930, Alan Modra wrote: > > Generate assembly that is .localentry 1 with @notoc calls to match. > > What is the purpose of this? Non-obvious patchexs without any > explanation like that cost

Re: [RS6000] -mno-minimal-toc vs. power10 pcrelative

2020-10-01 Thread Alan Modra via Gcc-patches
On Wed, Sep 30, 2020 at 03:56:32PM -0500, Segher Boessenkool wrote: > On Wed, Sep 30, 2020 at 05:01:45PM +0930, Alan Modra wrote: > > * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Don't > > set -mcmodel=small for -mno-minimal-toc when pcrel. > > > - SET_CMODEL (CMODEL_

[RS6000] ICE in decompose, at rtl.h:2282

2020-10-01 Thread Alan Modra via Gcc-patches
during RTL pass: fwprop1 gcc.dg/pr82596.c: In function 'test_cststring': gcc.dg/pr82596.c:27:1: internal compiler error: in decompose, at rtl.h:2282 -m32 gcc/testsuite/gcc.dg/pr82596.c fails along with other tests after applying rtx_cost patches, which exposed a backend bug. legitimize_address wh

Re: [RS6000] -mno-minimal-toc vs. power10 pcrelative

2020-10-01 Thread Alan Modra via Gcc-patches
Hi Segher, On Thu, Oct 01, 2020 at 01:22:07PM -0500, Segher Boessenkool wrote: > Hi! > > On Thu, Oct 01, 2020 at 10:57:48PM +0930, Alan Modra wrote: > > On Wed, Sep 30, 2020 at 03:56:32PM -0500, Segher Boessenkool wrote: > > > On Wed, Sep 30, 2020 at 05:01:45PM +0930, Alan Modra wrote: > > > >

[PATCH] calls.c:can_implement_as_sibling_call_p REG_PARM_STACK_SPACE check

2020-10-02 Thread Alan Modra via Gcc-patches
This moves an #ifdef block of code from calls.c to targetm.function_ok_for_sibcall. Only two targets, x86 and rs6000, define REG_PARM_STACK_SPACE or OUTGOING_REG_PARM_STACK_SPACE macros that might vary depending on the called function. Macros like UNITS_PER_WORD don't change over a function bound

Re: [PATCH] calls.c:can_implement_as_sibling_call_p REG_PARM_STACK_SPACE check

2020-10-02 Thread Alan Modra via Gcc-patches
On Fri, Oct 02, 2020 at 04:41:05PM +0930, Alan Modra wrote: > This moves an #ifdef block of code from calls.c to > targetm.function_ok_for_sibcall. Not only did I miss cc'ing the i386 maintainers, I missed seeing that the ATTRIBUTE_UNUSED reg_parm_stack_space param of can_implement_as_sibling_call

Re: [PATCH] calls.c:can_implement_as_sibling_call_p REG_PARM_STACK_SPACE check

2020-10-04 Thread Alan Modra via Gcc-patches
Hi Segher, On Fri, Oct 02, 2020 at 01:50:24PM -0500, Segher Boessenkool wrote: > On Fri, Oct 02, 2020 at 04:41:05PM +0930, Alan Modra wrote: > > This moves an #ifdef block of code from calls.c to > > targetm.function_ok_for_sibcall. Only two targets, x86 and rs6000, > > define REG_PARM_STACK_SPAC

[PATCH 4/8] [RS6000] rs6000_rtx_costs tidy break/return

2020-10-07 Thread Alan Modra via Gcc-patches
Most cases use "return false" rather than breaking out of the switch. Do so in all cases. * config/rs6000/rs6000.c (rs6000_rtx_costs): Tidy break/return. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index bc5e51aa5ce..383d2901c9f 100644 --- a/gcc/config/rs6000/rs60

[PATCH 1/8] [RS6000] rs6000_rtx_costs comment

2020-10-07 Thread Alan Modra via Gcc-patches
This lays out the ground rules for following patches. * config/rs6000/rs6000.c (rs6000_rtx_costs): Expand comment. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b58eeae2b98..97180bb3819 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @

[PATCH 5/8] [RS6000] rs6000_rtx_costs cost IOR

2020-10-07 Thread Alan Modra via Gcc-patches
* config/rs6000/rs6000.c (rotate_insert_cost): New function. (rs6000_rtx_costs): Cost IOR. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 383d2901c9f..15a806fe307 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -21206,6 +21206

[PATCH 3/8] [RS6000] rs6000_rtx_costs tidy AND

2020-10-07 Thread Alan Modra via Gcc-patches
* config/rs6000/rs6000.c (rs6000_rtx_costs): Tidy AND code. Don't avoid recursion on const_int shift count. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index e870ba0039a..bc5e51aa5ce 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @

[PATCH 7/8] [RS6000] rs6000_rtx_costs reduce cost for SETs

2020-10-07 Thread Alan Modra via Gcc-patches
The aim of this patch is to make rtx_costs for SETs closer to insn_cost for SETs. One visible effect on powerpc code is increased if-conversion. * config/rs6000/rs6000.c (rs6000_rtx_costs): Reduce cost of SET operands. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/r

[PATCH 2/8] [RS6000] rs6000_rtx_costs for AND

2020-10-07 Thread Alan Modra via Gcc-patches
The existing "case AND" in this function is not sufficient for optabs.c:avoid_expensive_constant usage, where the AND is passed in outer_code. We'd like to cost AND of rs6000_is_valid_and_mask or rs6000_is_valid_2insn_and variety there, so that those masks aren't seen as expensive (ie. better to l

[PATCH 0/8] [RS6000] rs6000_rtx_costs V2

2020-10-07 Thread Alan Modra via Gcc-patches
This is a revised version of the patch series posted at https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553919.html Patch 8/8 in particular changes rather a lot more than the original !speed changes. Bootstrapped and regression tested powerpc64le-linux and powerpc64-linux biarch. Alan M

[PATCH 6/8] [RS6000] rs6000_rtx_costs multi-insn constants

2020-10-07 Thread Alan Modra via Gcc-patches
This small patch to rs6000_rtx_costs considerably improves code generated for large constants in 64-bit code, teaching gcc that it is better to load a constant from memory than to generate a sequence of up to five dependent instructions. Note that the rs6000 backend does generate large constants a

[PATCH 8/8] [RS6000] rs6000_rtx_costs for !speed

2020-10-07 Thread Alan Modra via Gcc-patches
When optimizing for size we shouldn't be using metrics based on speed or vice-versa. rtlanal.c:get_full_rtx_cost wants both speed and size metric from rs6000_rtx_costs independent of the global optimize_size. Note that the patch changes param_simultaneous_prefetches, param_l1_cache_size, param_l1

Re: [PATCH] Remove non-ANSI C macros in ansidecl.h.

2022-05-10 Thread Alan Modra via Gcc-patches
On Tue, May 10, 2022 at 10:57:47AM +0200, Martin Liška wrote: > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > @Alan: Are you fine with the change from binutils/gdb perspective? I'm fine if this isn't going into the binutils-gdb repo immediately. There are occurrences

Re: [PATCH] libiberty: stop using PTR macro.

2022-05-10 Thread Alan Modra via Gcc-patches
On Tue, May 10, 2022 at 10:56:22AM +0200, Martin Liška wrote: > diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c > @@ -457,15 +457,15 @@ htab_empty (htab_t htab) >else if (htab->free_with_arg_f != NULL) > (*htab->free_with_arg_f) (htab->alloc_arg, htab->entries); >if (

Re: [PATCH] libiberty: remove FINAL and OVERRIDE from ansidecl.h

2022-05-24 Thread Alan Modra via Gcc-patches
On Mon, May 23, 2022 at 07:42:29PM -0400, David Malcolm via Binutils wrote: > Any objections, or is there a reason to keep these macros that I'm > not aware of? (and did I send this to all the pertinent lists?) No objection from me. These macros are not used anywhere in binutils-gdb. -- Alan M

[PATCH 1/2] can_implement_as_sibling_call_p REG_PARM_STACK_SPACE check V2

2020-11-02 Thread Alan Modra via Gcc-patches
On Sat, Oct 31, 2020 at 12:10:35AM +1030, Alan Modra wrote: > Would it be better if I post the patches again, restructuring them as > 1) completely no functional change just moving the existing condition >to the powerpc and i386 target hooks, and > 2) twiddling the powerpc target hook? The no

[PATCH 2/2] [RS6000] REG_PARM_STACK_SPACE check V2

2020-11-02 Thread Alan Modra via Gcc-patches
On PowerPC we can tail call if the callee has less or equal REG_PARM_STACK_SPACE than the caller, as demonstrated by the testcase. So we should use /* If reg parm stack space increases, we cannot sibcall. */ if (REG_PARM_STACK_SPACE (decl ? decl : fntype) > INCOMING_REG_PARM_STACK_SPAC

Re: [PATCH 1/3] Refactor copying decl section names

2020-11-10 Thread Alan Modra via Gcc-patches
On Tue, Nov 10, 2020 at 11:45:37AM -0700, Jeff Law wrote: > > On 11/12/19 11:28 PM, Strager Neds wrote: > > * gcc/cgraph.h (symtab_node::get_section): Constify. > > (symtab_node::set_section): Declare new overload. > > * gcc/symtab.c (symtab_node::set_section): Define new overload. > > (symtab_nod

Re: [PATCH 1/3] Refactor copying decl section names

2020-11-10 Thread Alan Modra via Gcc-patches
On Tue, Nov 10, 2020 at 09:19:37PM -0700, Jeff Law wrote: > I think the const char * is fine. That should force resolution to the > same routine we were using earlier. Do you want to commit that fix or > shall I? Commited 693a79a355e1. -- Alan Modra Australia Development Lab, IBM

[RS6000] Use LIB2_SIDITI_CONV_FUNCS in place of ppc64-fp.c

2020-11-13 Thread Alan Modra via Gcc-patches
This patch retires ppc64-fp.c in favour of using "LIB2_SIDITI_CONV_FUNCS = yes", which is a lot better solution than having a copy of selected libgcc2.c functions. So for powerpc64-linux we see these changes in libgcc files (plus corresponding _s.o variants). +_fixdfti.o +_fixsfti.o +_fixtfti.o +_

obstack.h __PTR_ALIGN vs. ubsan

2021-09-01 Thread Alan Modra via Gcc-patches
Current ubsan complains on every use of __PTR_ALIGN (when ptrdiff_t is as large as a pointer), due to making calculations relative to a NULL pointer. This patch avoids the problem by extracting out and simplifying __BPTR_ALIGN for the usual case. I've continued to use ptrdiff_t here, where it mig

Make opcodes configure depend on bfd configure

2021-11-12 Thread Alan Modra via Gcc-patches
The idea is for opcodes to be able to see whether bfd is compiled for 64-bit. A lot of --enable-targets=all libopcodes is wasted space if bfd can't load 64-bit target object files. * Makefile.def (configure-opcodes): Depend on configure-bfd. * Makefile.in: Regenerate. Applied to

Re: PowerPC64 ELFv2 -fpatchable-function-entry

2021-05-19 Thread Alan Modra via Gcc-patches
On Tue, May 18, 2021 at 05:48:40AM -0500, Segher Boessenkool wrote: > I wrote a bit later: > > > > Can you make this less hacky please? Changing the generic code is just > > > fine as well, it needs some love. > > In effect making a callback / hook without making that explicit is bad > for maint

Re: [POWER10] __morestack calls from pcrel code

2021-07-14 Thread Alan Modra via Gcc-patches
On Wed, Jun 30, 2021 at 05:06:30PM -0300, Tulio Magno Quites Machado Filho wrote: > Alan Modra via Gcc-patches writes: > > > Compiling gcc/testsuite/gcc.dg/split-*.c and others with -mcpu=power10 > > and linking with a non-pcrel libgcc results in crashes due to the > >

Re: [PATCH 2/4 REVIEW] libtool.m4: fix nm BSD flag detection

2021-07-21 Thread Alan Modra via Gcc-patches
On Wed, Jul 07, 2021 at 08:03:45PM +0100, Nick Alcock via Gcc-patches wrote: > On 7 Jul 2021, Nick Clifton told this: > > > Hi Nick, > > > >> Ping? > > > > Oops. > > I sent a bunch of pings out at the same time, to a bunch of different > projects. You are the only person to respond, so thank you!

Re: [POWER10] __morestack calls from pcrel code

2021-07-21 Thread Alan Modra via Gcc-patches
On Wed, Jul 21, 2021 at 08:59:04AM -0400, David Edelsohn wrote: > On Wed, Jul 21, 2021 at 4:29 AM Alan Modra wrote: > > > > On Wed, Jul 14, 2021 at 08:24:16PM -0400, David Edelsohn wrote: > > > > > > * config/rs6000/morestack.S (R2_SAVE): Define. > > > > > > (__morestack): Save and restore

Re: RFC: Changing AC_PROG_CC to AC_PROG_CC_C99 in top level configure

2021-05-02 Thread Alan Modra via Gcc-patches
On Fri, Apr 30, 2021 at 03:48:00PM -0600, Jeff Law via Gcc-patches wrote: > > On 4/30/2021 12:36 PM, Simon Marchi via Gcc-patches wrote: > > On 2021-04-26 7:32 a.m., Nick Clifton via Gdb-patches wrote:> Hi Guys, > > >Given that gcc, gdb and now binutils are all now requiring C99 as a > > >

Re: RFC: Changing AC_PROG_CC to AC_PROG_CC_C99 in top level configure

2021-05-03 Thread Alan Modra via Gcc-patches
On Mon, May 03, 2021 at 10:47:15AM -0400, Simon Marchi wrote: > > Yes, I prefer the configure fix too. If we state we require C99 in > > binutils then we ought to be able to use C99.. > > > > Nick, does the configure.ac change also need to go in all subdirs, to > > support people running make in

Re: RFC: Changing AC_PROG_CC to AC_PROG_CC_C99 in top level configure

2021-05-04 Thread Alan Modra via Gcc-patches
On 2021-05-04 8:42 a.m., Nick Clifton wrote: > Hi Guys, > > On 4/30/21 7:36 PM, Simon Marchi wrote: >> I think this fix is obvious enough, I encourage you to push it, > > OK - I have pushed the patch to the mainline branches of both > the gcc and binutils-gdb repositories. Thanks Nick! Incident

Re: RFC: Changing AC_PROG_CC to AC_PROG_CC_C99 in top level configure

2021-05-05 Thread Alan Modra via Gcc-patches
On Wed, May 05, 2021 at 08:05:29AM +0100, Iain Sandoe wrote: > Alan Modra via Gcc-patches wrote: > > > On 2021-05-04 8:42 a.m., Nick Clifton wrote: > > > Hi Guys, > > > > > > On 4/30/21 7:36 PM, Simon Marchi wrote: > > > > I think thi

PR98125, PowerPC64 -fpatchable-function-entry

2021-05-06 Thread Alan Modra via Gcc-patches
This series of patches fixes -fpatchable-function-entry on PowerPC64 ELFv1 so that SECTION_LINK_ORDER (.section 'o' arg) is now supported, and on PowerPC64 ELFv2 to not break the global entry code. Bootstrapped powerpc64le-linux and x86_64-linux all langs. I did see one regression on both targets

PowerPC64 ELFv1 -fpatchable-function-entry

2021-05-06 Thread Alan Modra via Gcc-patches
On PowerPC64 ELFv1 function symbols are defined on function descriptors in an .opd section rather than in the function code. .opd is not split up by the PowerPC64 backend for comdat groups or other situations where per-function sections are required. Thus SECTION_LINK_ORDER can't use the function

Revert "rs6000: Avoid -fpatchable-function-entry* regressions on powerpc64 be [PR98125]"

2021-05-06 Thread Alan Modra via Gcc-patches
This reverts commit b680b9049737198d010e49cf434704c6a6ed2b3f now that the PowerPC64 ELFv1 regression is fixed properly. PR testsuite/98125 * targhooks.h (default_print_patchable_function_entry_1): Delete. * targhooks.c (default_print_patchable_function_entry_1): Delete.

PowerPC64 ELFv2 -fpatchable-function-entry

2021-05-06 Thread Alan Modra via Gcc-patches
PowerPC64 ELFv2 dual entry point functions have a couple of problems with -fpatchable-function-entry. One is that the nops added after the global entry land in the global entry code which is constrained to be a power of two number of instructions, and zero global entry code has special meaning for

Re: PowerPC64 ELFv1 -fpatchable-function-entry

2021-05-18 Thread Alan Modra via Gcc-patches
On Fri, May 07, 2021 at 07:24:02PM -0500, Segher Boessenkool wrote: > Looks good with those things tweaked. Except that the patch chose the wrong section to emit the label, because the decl is wrong. But of course I was using the same decl as used in existing SHF_LINK_ORDER support, so it was alr

Re: PowerPC64 ELFv2 -fpatchable-function-entry

2021-05-18 Thread Alan Modra via Gcc-patches
On Mon, May 10, 2021 at 04:39:55PM -0500, Segher Boessenkool wrote: > Hi! > > On Fri, May 07, 2021 at 12:19:52PM +0930, Alan Modra wrote: > > PowerPC64 ELFv2 dual entry point functions have a couple of problems > > with -fpatchable-function-entry. One is that the nops added after the > > global e

Re: [RS6000] PR96493, powerpc local call linkage failure

2020-08-11 Thread Alan Modra via Gcc-patches
This fixes a fail when power10 isn't supported by binutils, and ensures the test isn't run without power10 hardware or simulation on the off chance that power10 insns are emitted in the future for this testcase. Bootstrapped etc. OK? PR target/96525 * testsuite/gcc.target/powerpc

Re: [RS6000] PR96493, powerpc local call linkage failure

2020-08-11 Thread Alan Modra via Gcc-patches
On Tue, Aug 11, 2020 at 01:30:36PM -0500, Segher Boessenkool wrote: > Either always running or what this patch does will work. But please add > comments what the test case wants to test, That's already in the testcase. /* Test local calls between pcrel and non-pcrel code. The comment go

Re: [PATCH] rs6000: Support ELFv2 sibcall for indirect calls [PR96787]

2020-08-27 Thread Alan Modra via Gcc-patches
On Thu, Aug 27, 2020 at 08:21:34AM -0500, Bill Schmidt wrote: > Prior to P10, ELFv2 hasn't implemented nonlocal sibcalls. Now that we do, > we need to be sure that r12 is set up prior to such a call. > > Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no > regressions. Is this okay

Re: [PATCH] rs6000: Support ELFv2 sibcall for indirect calls [PR96787]

2020-08-27 Thread Alan Modra via Gcc-patches
On Thu, Aug 27, 2020 at 03:17:45PM -0500, Segher Boessenkool wrote: > On Thu, Aug 27, 2020 at 01:51:25PM -0500, Bill Schmidt wrote: > It not the copy that is unnecessary: the preventing it *here*, manually, > is what is unnecessary. Blame me for the original !rtx_equal_p in rs6000_call_aix that Bi

Re: [PATCH] rs6000: Support ELFv2 sibcall for indirect calls [PR96787]

2020-08-28 Thread Alan Modra via Gcc-patches
On Fri, Aug 28, 2020 at 01:17:27AM -0500, Segher Boessenkool wrote: > 1) Very many unnecessary moves are generated during expand *anyway*, a > few more will not hurt; > 2) In practice we always generate a move from a pseudo into r12 here, > never a copy from r12 into r12; > 3) Why generate dead cod

ubsan: d-demangle.c:214 signed integer overflow

2020-09-03 Thread Alan Modra via Gcc-patches
Running the libiberty testsuite ./test-demangle < libiberty/testsuite/d-demangle-expected libiberty/d-demangle.c:214:14: runtime error: signed integer overflow: 922337203 * 10 cannot be represented in type 'long int' On looking at silencing ubsan, I found a real bug in dlang_number. For a 32-bit

Re: ubsan: d-demangle.c:214 signed integer overflow

2020-09-03 Thread Alan Modra via Gcc-patches
On Thu, Sep 03, 2020 at 11:02:50PM +0200, Iain Buclaw wrote: > Excerpts from Alan Modra's message of September 3, 2020 3:01 pm: > > Running the libiberty testsuite > > ./test-demangle < libiberty/testsuite/d-demangle-expected > > libiberty/d-demangle.c:214:14: runtime error: signed integer overflow

Re: ubsan: d-demangle.c:214 signed integer overflow

2020-09-04 Thread Alan Modra via Gcc-patches
So this one is on top of the previously posted patch. * d-demangle.c (string_need): Take a size_t n arg, and use size_t tem. (string_append): Use size_t n. (string_appendn, string_prependn): Take a size_t n arg. (TEMPLATE_LENGTH_UNKNOWN): Define as -1UL. * d

Re: ubsan: d-demangle.c:214 signed integer overflow

2020-09-06 Thread Alan Modra via Gcc-patches
On Fri, Sep 04, 2020 at 06:23:10PM +0200, Iain Buclaw wrote: > If we're already using limits.h, I guess it should be fine to also add > > #define UINT_MAX ((unsigned) ~0U) Yes, except that I'll use the simpler fall-back #define UINT_MAX (~0U) The habit of using a cast for unsigned constants date

Re: [PATCH] ppc64 check for incompatible setting of minimal-toc

2020-09-11 Thread Alan Modra via Gcc-patches
On Fri, Sep 11, 2020 at 04:43:50AM -0300, Alexandre Oliva wrote: > Could you please shed any light as to the intent, so that we can sort > out the logic that will implement it? The history goes back to 2003 commit 9739c90c8d where a ppc64-linux host built most of gcc with -mminimal-toc due to toc/

[RS6000] make PLT loads volatile

2020-03-11 Thread Alan Modra via Gcc-patches
With lazy PLT resolution the first load of a PLT entry may be a value pointing at a resolver stub. gcc's loop processing can result in the PLT load in inline PLT calls being hoisted out of a loop in the mistaken idea that this is an optimisation. It isn't. If the value hoisted was that for a res

Re: [RS6000] make PLT loads volatile

2020-03-12 Thread Alan Modra via Gcc-patches
On Thu, Mar 12, 2020 at 11:57:17AM -0500, Segher Boessenkool wrote: > Hi! > > On Thu, Mar 12, 2020 at 01:18:50PM +1030, Alan Modra wrote: > > With lazy PLT resolution the first load of a PLT entry may be a value > > pointing at a resolver stub. gcc's loop processing can result in the > > PLT load

Re: [RS6000] make PLT loads volatile

2020-03-13 Thread Alan Modra via Gcc-patches
On Fri, Mar 13, 2020 at 10:40:38AM -0500, Segher Boessenkool wrote: > Hi! > > On Fri, Mar 13, 2020 at 10:06:01AM +1030, Alan Modra wrote: > > On Thu, Mar 12, 2020 at 11:57:17AM -0500, Segher Boessenkool wrote: > > > On Thu, Mar 12, 2020 at 01:18:50PM +1030, Alan Modra wrote: > > > > With lazy PLT

[RS6000] PR94145, make PLT loads volatile

2020-03-22 Thread Alan Modra via Gcc-patches
On Wed, Mar 18, 2020 at 04:53:59PM -0500, Segher Boessenkool wrote: > Could you please send a new patch (could be the same patch even) that > is easier to review for me? The PLT is volatile. On PowerPC it is a bss style section which the dynamic loader initialises to point at resolver stubs (call

[RS6000] PR96493, powerpc local call linkage failure

2020-08-06 Thread Alan Modra via Gcc-patches
This corrects current_file_function_operand, an operand predicate used to determine whether a symbol_ref is safe to use with the local_call patterns. Calls between pcrel and non-pcrel code need to go via linker stubs. In the case of non-pcrel code to pcrel the stub saves r2 but there needs to be

Re: [RS6000] PR96493, powerpc local call linkage failure

2020-08-06 Thread Alan Modra via Gcc-patches
On Thu, Aug 06, 2020 at 05:34:03PM -0500, Segher Boessenkool wrote: > > +/* { dg-do run } */ > > +/* { dg-options "-mdejagnu-cpu=powerpc64 -O2" } */ > > That is not a -mcpu= value you should ever use. Please just pick a real > existing CPU, maybe p7 or p8 since this requires ELFv2 anyway? Or, wh

[RS6000] Put call cookie back in AIX/ELFv2 call patterns

2020-03-27 Thread Alan Modra via Gcc-patches
-mlongcall -mno-pltseq is supposed to emit long calls by using indirect calls. It differs from -mlongcall -mpltseq in that the function addresses are not placed in the PLT and thus lazy PLT resolution is not available, affecting programs that dlopen shared libraries. In the case of -mcpu=future -

Re: [PATCH] rs6000: Don't split constant oprator when add, move to temp register for future optimization

2020-04-03 Thread Alan Modra via Gcc-patches
On Fri, Apr 03, 2020 at 02:13:06PM +0800, luoxhu via Gcc-patches wrote: > Seems PR94393? Yes, rs6000_emit_set_const calls rs6000_emit_set_long_const > for DImode. > I tried unsigned long like 0xabcd87654321, 0xabcd87654321 and > 0xc000ULL, > All of them are outside of loop even

Re: [PATCH] rs6000: Don't split constant oprator when add, move to temp register for future optimization

2020-04-03 Thread Alan Modra via Gcc-patches
On Fri, Apr 03, 2020 at 04:11:32PM -0500, Segher Boessenkool wrote: > On Fri, Apr 03, 2020 at 10:43:49PM +1030, Alan Modra wrote: > > Segher probably meant the part I'm working on and haven't posted yet, > > fixing lots of problems with rs6000_rtx_costs. > > I meant PR94393 in fact, but yeah, this

set_rtx_cost used wrongly, should be set_src_cost

2020-04-13 Thread Alan Modra via Gcc-patches
I believe set_rtx_cost is meant to handle a SET, not a PLUS as is passed in these two locations. Using the proper function for a PLUS doesn't make a huge difference: the only arg change to rtx_cost of any consequence is outer_code of SET rather than INSN. A mode of word_mode rather than VOIDmode

Re: [PATCH toplevel] libctf: new testsuite

2021-01-05 Thread Alan Modra via Gcc-patches
On Tue, Jan 05, 2021 at 03:25:10PM +, Nick Alcock wrote: > This enables 'make libctf-check', used by a new libctf testsuite in > binutils. > > 2021-01-05 Nick Alcock > > * Makefile.def (libctf): No longer no_check. Checking depends on > all-ld. > * Makefile.in: Regenerat

  1   2   >