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,[EMAIL PROTECTED]@ha addi 9,9,[EMAIL PROTECTED]@l lwz 3,0(9) when two instructions would suffice: addis 9,13,[EMAIL PROTECTED]@ha lwz 3,[EMAIL PROTECTED]@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