public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/57836] New: large constants evaluated inline
@ 2013-07-06 11:58 amodra at gmail dot com
  2013-11-09 22:25 ` [Bug target/57836] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: amodra at gmail dot com @ 2013-07-06 11:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57836

            Bug ID: 57836
           Summary: large constants evaluated inline
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amodra at gmail dot com

On powerpc64 with -mcmodel=small -O1, this

int x;

void f1 (long long hx)
{
  if (hx < 0x3ff0000000000000LL)
    x++;
}

results in

.L.f1:
    lis 9,0x3fef
    ori 9,9,65535
    sldi 9,9,32
    oris 9,9,0xffff
    ori 9,9,65535
    cmpd 7,3,9
    bgtlr 7
    ld 9,.LC1@toc(2)
    lwz 10,0(9)
    addi 10,10,1
    stw 10,0(9)
    blr

The -mcmodel isn't significant, just there to make comparison with older
compilers easy.  Prior to gcc-4.5 we generated

.L.f1:
    ld 0,.LC0@toc(2)
    cmpd 7,3,0
    bgtlr 7
    ld 9,.LC1@toc(2)
    lwz 11,0(9)
    addi 0,11,1
    stw 0,0(9)
    blr

Both pre- and post-4.5 compilers initially expand rtl using the constant load
from toc, but 4.5 and later substitute the constant in the first cse pass.
The problem stems from rtx cost for the load from toc being the same as the
inline constant form.

The costs are the same both pre- and post-4.5.  The reason pre-4.5 does not
substitute the constant is related to this comment is cse.c:
      /* Find cheapest and skip it for the next time.   For items
         of equal cost, use this order:
         src_folded, src, src_eqv, src_related and hash table entry.  */
Pre-4.5 src_folded is NULL, src is a mem, src_eqv the constant.
Post-4.5 src_folded is the constant, src is a mem, src_eqv the constant again.

Pre-4.5, rs6000.c lacked delegitimize_address. src_folded is set by fold_rtx,
which calls equiv_constant, which calls avoid_constant_pool_reference, which
calls targetm.delegitimize_address.  When this is missing, we don't get to see
the constant..


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

* [Bug target/57836] large constants evaluated inline
  2013-07-06 11:58 [Bug target/57836] New: large constants evaluated inline amodra at gmail dot com
@ 2013-11-09 22:25 ` pinskia at gcc dot gnu.org
  2014-05-12  6:38 ` amodra at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-11-09 22:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57836

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-11-09
   Target Milestone|---                         |4.7.4
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.


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

* [Bug target/57836] large constants evaluated inline
  2013-07-06 11:58 [Bug target/57836] New: large constants evaluated inline amodra at gmail dot com
  2013-11-09 22:25 ` [Bug target/57836] " pinskia at gcc dot gnu.org
@ 2014-05-12  6:38 ` amodra at gmail dot com
  2014-05-15  0:14 ` dje at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: amodra at gmail dot com @ 2014-05-12  6:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57836

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |amodra at gmail dot com
   Target Milestone|4.7.4                       |4.10.0


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

* [Bug target/57836] large constants evaluated inline
  2013-07-06 11:58 [Bug target/57836] New: large constants evaluated inline amodra at gmail dot com
  2013-11-09 22:25 ` [Bug target/57836] " pinskia at gcc dot gnu.org
  2014-05-12  6:38 ` amodra at gmail dot com
@ 2014-05-15  0:14 ` dje at gcc dot gnu.org
  2015-04-22 11:59 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dje at gcc dot gnu.org @ 2014-05-15  0:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from David Edelsohn <dje at gcc dot gnu.org> ---
The affect of deligitimize_address on storing constants in the TOC vs
materializing inline was unintentional, but my JIT experiments on POWER7 did
not show a bad performance affect from materializing inline. Before we restore
the old behavior, we should try to figure out which method actually produces
better performance on recent hardware for PPC64 Linux and AIX.


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

* [Bug target/57836] large constants evaluated inline
  2013-07-06 11:58 [Bug target/57836] New: large constants evaluated inline amodra at gmail dot com
                   ` (2 preceding siblings ...)
  2014-05-15  0:14 ` dje at gcc dot gnu.org
@ 2015-04-22 11:59 ` jakub at gcc dot gnu.org
  2015-07-16  9:16 ` rguenth at gcc dot gnu.org
  2020-04-01 23:17 ` amodra at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-22 11:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.0                         |5.2

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 5.1 has been released.


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

* [Bug target/57836] large constants evaluated inline
  2013-07-06 11:58 [Bug target/57836] New: large constants evaluated inline amodra at gmail dot com
                   ` (3 preceding siblings ...)
  2015-04-22 11:59 ` jakub at gcc dot gnu.org
@ 2015-07-16  9:16 ` rguenth at gcc dot gnu.org
  2020-04-01 23:17 ` amodra at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.2                         |5.3

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.


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

* [Bug target/57836] large constants evaluated inline
  2013-07-06 11:58 [Bug target/57836] New: large constants evaluated inline amodra at gmail dot com
                   ` (4 preceding siblings ...)
  2015-07-16  9:16 ` rguenth at gcc dot gnu.org
@ 2020-04-01 23:17 ` amodra at gmail dot com
  5 siblings, 0 replies; 7+ 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=57836

Alan Modra <amodra at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|5.5                         |11.0
         Resolution|---                         |DUPLICATE

--- Comment #7 from Alan Modra <amodra at gmail dot com> ---
Some issues related to large constants have already been fixed, thus closing
this bug as a dup of pr94393

*** This bug has been marked as a duplicate of bug 94393 ***

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

end of thread, other threads:[~2020-04-01 23:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-06 11:58 [Bug target/57836] New: large constants evaluated inline amodra at gmail dot com
2013-11-09 22:25 ` [Bug target/57836] " pinskia at gcc dot gnu.org
2014-05-12  6:38 ` amodra at gmail dot com
2014-05-15  0:14 ` dje at gcc dot gnu.org
2015-04-22 11:59 ` jakub at gcc dot gnu.org
2015-07-16  9:16 ` rguenth at gcc dot gnu.org
2020-04-01 23:17 ` amodra at gmail dot com

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).