This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fwd: gomp - cost of threadprivate data access]


On Mon, Mar 16, 2009 at 07:16:33PM +0100, Steven Bosscher wrote:
> On Mon, Mar 16, 2009 at 7:06 PM, Toon Moene <toon@moene.org> wrote:
> > [ Perhaps we need a somewhat larger audience for this one, as it isn't a
> > ?gfortran specific issue (despite the COMMONs). ]
> >
> > The reporter of this problem (perhaps it's necessary to open a bugzilla PR)
> > uses:
> >
> > It is GNU/linux on x86_64, fedora 10
> >
> > kernel 2.6.27.12-170.2.5.fc10.x86_64
> > glibc-2.9-3.x86_64
> 
> The __tls_get_addr() calls should already be optimized if the proper
> TLS model is used.

Yeah.  If the accesses are in the main program, they will already use the
very cheap local exec model, if they are in shared libraries that aren't
dlopened, but linked against the main program, just use
-ftls-model=initial-exec, which is only a tiny bit slower than that, but
still doesn't use any function calls.

__tls_get_addr is (supposed to be) handled like a const function, so for the
same variable (or for all static vars in the current TU) there should be
usually just a single call.

For dlopenable shared libraries you could also on i386/x86_64 try
-mtls-dialect=gnu2 instead of the default -mtls-dialect=gnu.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]