public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison
@ 2020-03-29 23:02 npiggin at gmail dot com
  2020-03-30 13:07 ` [Bug target/94393] " amodra at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: npiggin at gmail dot com @ 2020-03-29 23:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

            Bug ID: 94393
           Summary: Powerpc suboptimal 64-bit constant comparison
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: npiggin at gmail dot com
  Target Milestone: ---

--- test case ----
void test1(unsigned long a)
{ 
        if (a > 0xc000000000000000ULL)
                printf("yes\n");
}
void test2(unsigned long a)
{
        if (a >= 0xc000000000000000ULL)
                printf("yes\n");
}
------------------

The first (important part) compiles to

        li 9,-1
        rldicr 9,9,0,1
        cmpld 0,3,9
        blelr 0

The second to

        lis 9,0xbfff
        ori 9,9,0xffff
        sldi 9,9,32
        oris 9,9,0xffff
        ori 9,9,0xffff
        cmpld 0,3,9
        blelr 0

The second could use the same 2-insn constant as the first, but with bltlr.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
@ 2020-03-30 13:07 ` amodra at gmail dot com
  2020-03-30 13:10 ` amodra at gmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gmail dot com @ 2020-03-30 13:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |amodra at gmail dot com
   Last reconfirmed|                            |2020-03-30
                 CC|amodra at gmail dot com            |
             Status|UNCONFIRMED                 |ASSIGNED

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
  2020-03-30 13:07 ` [Bug target/94393] " amodra at gmail dot com
@ 2020-03-30 13:10 ` amodra at gmail dot com
  2020-04-01 23:17 ` amodra at gmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gmail dot com @ 2020-03-30 13:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

--- Comment #1 from Alan Modra <amodra at gmail dot com> ---
Created attachment 48146
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48146&action=edit
teach gcc more two insn sequences for constants

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
  2020-03-30 13:07 ` [Bug target/94393] " amodra at gmail dot com
  2020-03-30 13:10 ` amodra at gmail dot com
@ 2020-04-01 23:17 ` amodra at gmail dot com
  2020-04-02  1:07 ` amodra at gmail dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gmail dot com @ 2020-04-01 23:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amodra at gmail dot com

--- Comment #2 from Alan Modra <amodra at gmail dot com> ---
*** Bug 57836 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
                   ` (2 preceding siblings ...)
  2020-04-01 23:17 ` amodra at gmail dot com
@ 2020-04-02  1:07 ` amodra at gmail dot com
  2020-04-03  2:26 ` npiggin at gmail dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gmail dot com @ 2020-04-02  1:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

--- Comment #3 from Alan Modra <amodra at gmail dot com> ---
There are two parts to fixing this PR.
1) We can do better in the sequences generated for some constants.
2) rs6000_rtx_costs needs to be accurate, so that expensive constants are put
in memory and stay there with optimisation.

Having looked at part 2 a little, I'd say fixes for that are definitely not
stage 4 material.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
                   ` (3 preceding siblings ...)
  2020-04-02  1:07 ` amodra at gmail dot com
@ 2020-04-03  2:26 ` npiggin at gmail dot com
  2020-07-13 15:49 ` bergner at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: npiggin at gmail dot com @ 2020-04-03  2:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

--- Comment #4 from Nicholas Piggin <npiggin at gmail dot com> ---
(In reply to Alan Modra from comment #3)
> There are two parts to fixing this PR.
> 1) We can do better in the sequences generated for some constants.
> 2) rs6000_rtx_costs needs to be accurate, so that expensive constants are
> put in memory and stay there with optimisation.
> 
> Having looked at part 2 a little, I'd say fixes for that are definitely not
> stage 4 material.

Well the other part I thought is that different branch test could be chosen in
order to use the cheapest constant. If you generate the 0xbfff... constant more
cheaply it'd still be more expensive than 0xc000...

That was my intention opening the two bugs but I didn't explain myself so well.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
                   ` (4 preceding siblings ...)
  2020-04-03  2:26 ` npiggin at gmail dot com
@ 2020-07-13 15:49 ` bergner at gcc dot gnu.org
  2020-07-14 22:56 ` segher at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bergner at gcc dot gnu.org @ 2020-07-13 15:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

--- Comment #5 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to Alan Modra from comment #3)
> There are two parts to fixing this PR.
> 1) We can do better in the sequences generated for some constants.
> 2) rs6000_rtx_costs needs to be accurate, so that expensive constants are
> put in memory and stay there with optimisation.
> 
> Having looked at part 2 a little, I'd say fixes for that are definitely not
> stage 4 material.

Alan, I think you pushed some changes to help with 1) above, correct?
Is there more to do for 1)?

As for 2), we're in stage1 now.  Do you have ideas about what must be done
there?  Do we still want to do something for 2)?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
                   ` (5 preceding siblings ...)
  2020-07-13 15:49 ` bergner at gcc dot gnu.org
@ 2020-07-14 22:56 ` segher at gcc dot gnu.org
  2020-07-15  9:05 ` amodra at gmail dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: segher at gcc dot gnu.org @ 2020-07-14 22:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> ---
It certainly would be nice to improve this :-)  It won't help most code
very much -- how often do two-word values happen at all -- but we have
to revisit how all this is decided anyway (for prefixed instructions),
so now would be a good time :-)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
                   ` (6 preceding siblings ...)
  2020-07-14 22:56 ` segher at gcc dot gnu.org
@ 2020-07-15  9:05 ` amodra at gmail dot com
  2021-07-16  4:46 ` amodra at gmail dot com
  2023-10-08  3:08 ` guojiufu at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gmail dot com @ 2020-07-15  9:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

--- Comment #7 from Alan Modra <amodra at gmail dot com> ---
(In reply to Peter Bergner from comment #5)
> Alan, I think you pushed some changes to help with 1) above, correct?
> Is there more to do for 1)?
Possibly, I haven't looked at what needs to be done (if anything) for pli.

> As for 2), we're in stage1 now.  Do you have ideas about what must be done
> there?  Do we still want to do something for 2)?
I wrote a series of patches in early April.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
                   ` (7 preceding siblings ...)
  2020-07-15  9:05 ` amodra at gmail dot com
@ 2021-07-16  4:46 ` amodra at gmail dot com
  2023-10-08  3:08 ` guojiufu at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: amodra at gmail dot com @ 2021-07-16  4:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2020-October
                   |                            |/555760.html
           Assignee|amodra at gmail dot com            |unassigned at gcc dot gnu.org

--- Comment #8 from Alan Modra <amodra at gmail dot com> ---
Patch posted at given URL above.  I'm taking myself off as assignee because it
is clear to me the patch is going nowhere.  Someone more capable than me will
need to take up the task, sorry.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/94393] Powerpc suboptimal 64-bit constant comparison
  2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
                   ` (8 preceding siblings ...)
  2021-07-16  4:46 ` amodra at gmail dot com
@ 2023-10-08  3:08 ` guojiufu at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: guojiufu at gcc dot gnu.org @ 2023-10-08  3:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94393

Jiu Fu Guo <guojiufu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
                 CC|                            |guojiufu at gcc dot gnu.org
             Status|NEW                         |RESOLVED

--- Comment #9 from Jiu Fu Guo <guojiufu at gcc dot gnu.org> ---
After r14-4470, trunk generates better code for this case.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-10-08  3:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-29 23:02 [Bug target/94393] New: Powerpc suboptimal 64-bit constant comparison npiggin at gmail dot com
2020-03-30 13:07 ` [Bug target/94393] " amodra at gmail dot com
2020-03-30 13:10 ` amodra at gmail dot com
2020-04-01 23:17 ` amodra at gmail dot com
2020-04-02  1:07 ` amodra at gmail dot com
2020-04-03  2:26 ` npiggin at gmail dot com
2020-07-13 15:49 ` bergner at gcc dot gnu.org
2020-07-14 22:56 ` segher at gcc dot gnu.org
2020-07-15  9:05 ` amodra at gmail dot com
2021-07-16  4:46 ` amodra at gmail dot com
2023-10-08  3:08 ` guojiufu at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).