[Bug c/27479] New: TLS accesses use one more instruction than necessary

paulus at samba dot org gcc-bugzilla@gcc.gnu.org
Mon May 8 07:23:00 GMT 2006


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



More information about the Gcc-bugs mailing list