public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/27479]  New: TLS accesses use one more instruction than necessary
@ 2006-05-08  7:23 paulus at samba dot org
  2006-05-08  7:30 ` [Bug target/27479] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: paulus at samba dot org @ 2006-05-08  7:23 UTC (permalink / raw)
  To: gcc-bugs

To access a TLS variable in the local-exec model, gcc will emit three
instructions, for instance (for a 64-bit compile):
  addis 9,13,x@tprel@ha
  addi 9,9,x@tprel@l
  lwz 3,0(9)
when two instructions would suffice:
  addis 9,13,x@tprel@ha
  lwz 3,x@tprel@l(9)

This can be seen with a simple little program like this:

__thread int x;
int foo(void)
{
        return x;
}


-- 
           Summary: TLS accesses use one more instruction than necessary
           Product: gcc
           Version: 4.0.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paulus at samba dot org
 GCC build triplet: powerpc-linux-gnu
  GCC host triplet: powerpc-linux-gnu
GCC target triplet: powerpc-linux-gnu


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


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

* [Bug target/27479] TLS accesses use one more instruction than necessary
  2006-05-08  7:23 [Bug c/27479] New: TLS accesses use one more instruction than necessary paulus at samba dot org
@ 2006-05-08  7:30 ` pinskia at gcc dot gnu dot org
  2006-05-08 23:28 ` amodra at bigpond dot net dot au
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-08  7:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-05-08 07:30 -------
legitimate_lo_sum_address_p is most likely where the issue, it is returning
false for this case when it should be returning true, I might take more of a
look later today.


-- 


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


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

* [Bug target/27479] TLS accesses use one more instruction than necessary
  2006-05-08  7:23 [Bug c/27479] New: TLS accesses use one more instruction than necessary paulus at samba dot org
  2006-05-08  7:30 ` [Bug target/27479] " pinskia at gcc dot gnu dot org
@ 2006-05-08 23:28 ` amodra at bigpond dot net dot au
  2006-05-08 23:36 ` amodra at bigpond dot net dot au
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: amodra at bigpond dot net dot au @ 2006-05-08 23:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from amodra at bigpond dot net dot au  2006-05-08 23:28 -------
Confirmed.  TLS code sequences consist of address generation followed by
address dereference, for all TLS models.  The address generation part uses
UNSPECs because we need to differentiate the addis/addi from other hi/lo_sum
patterns:  The TLS versions need to emit reloc specifiers.  Existing combined
patterns cannot be used.

To fix this problem, the rs6000 backend needs to be taught how to combine the
lo_sum lookalike part of the TLS address generation with the TLS load/store.  I
would guess that the easiest way to implement this is with new peephole2
patterns.


-- 

amodra at bigpond dot net dot au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-08 23:28:21
               date|                            |


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


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

* [Bug target/27479] TLS accesses use one more instruction than necessary
  2006-05-08  7:23 [Bug c/27479] New: TLS accesses use one more instruction than necessary paulus at samba dot org
  2006-05-08  7:30 ` [Bug target/27479] " pinskia at gcc dot gnu dot org
  2006-05-08 23:28 ` amodra at bigpond dot net dot au
@ 2006-05-08 23:36 ` amodra at bigpond dot net dot au
  2006-05-09  7:49 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: amodra at bigpond dot net dot au @ 2006-05-08 23:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from amodra at bigpond dot net dot au  2006-05-08 23:36 -------
Either that, or rewrite rs6000 tls support without using unspecs..


-- 


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


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

* [Bug target/27479] TLS accesses use one more instruction than necessary
  2006-05-08  7:23 [Bug c/27479] New: TLS accesses use one more instruction than necessary paulus at samba dot org
                   ` (2 preceding siblings ...)
  2006-05-08 23:36 ` amodra at bigpond dot net dot au
@ 2006-05-09  7:49 ` pinskia at gcc dot gnu dot org
  2006-05-09 17:20 ` dje at gcc dot gnu dot org
  2009-05-14  3:23 ` bje at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-09  7:49 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |missed-optimization


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


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

* [Bug target/27479] TLS accesses use one more instruction than necessary
  2006-05-08  7:23 [Bug c/27479] New: TLS accesses use one more instruction than necessary paulus at samba dot org
                   ` (3 preceding siblings ...)
  2006-05-09  7:49 ` pinskia at gcc dot gnu dot org
@ 2006-05-09 17:20 ` dje at gcc dot gnu dot org
  2009-05-14  3:23 ` bje at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dje at gcc dot gnu dot org @ 2006-05-09 17:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dje at gcc dot gnu dot org  2006-05-09 17:20 -------
You might be able to combine the address generation with the load in
legitimize_reload_address.  See the existing code for SYMBOL_REF.


-- 

dje at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at gcc dot gnu dot org


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


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

* [Bug target/27479] TLS accesses use one more instruction than necessary
  2006-05-08  7:23 [Bug c/27479] New: TLS accesses use one more instruction than necessary paulus at samba dot org
                   ` (4 preceding siblings ...)
  2006-05-09 17:20 ` dje at gcc dot gnu dot org
@ 2009-05-14  3:23 ` bje at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-05-14  3:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

bje at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |bje at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-10-22 23:32:07         |2009-05-14 03:23:41
               date|                            |


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


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

end of thread, other threads:[~2009-05-14  3:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-08  7:23 [Bug c/27479] New: TLS accesses use one more instruction than necessary paulus at samba dot org
2006-05-08  7:30 ` [Bug target/27479] " pinskia at gcc dot gnu dot org
2006-05-08 23:28 ` amodra at bigpond dot net dot au
2006-05-08 23:36 ` amodra at bigpond dot net dot au
2006-05-09  7:49 ` pinskia at gcc dot gnu dot org
2006-05-09 17:20 ` dje at gcc dot gnu dot org
2009-05-14  3:23 ` bje at gcc dot gnu dot 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).