[i386 PATCH] Mark __tls_get_addr call as pure

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Tue May 8 09:50:00 GMT 2007


This is the same that is done by the rs6000 backend.  Together with 
other patches I posted, it helps getting rid of libcall notes on i386 
(x86_64 actually).

I would appreciate more testing since I don't have an x86_64 backend.  I 
bootstrapped it on i686-pc-linux-gnu just to make sure I didn't screw up 
something, and tested on the test case Steven posted earlier:

/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -fno-tree-pre -fno-tree-loop-im -fpic 
ftls-model=local-dynamic" } */
/* { dg-final { scan-assembler-times "__tls_get_addr" 1 } } */

typedef struct { int a, b; } X;
static __thread X *x, *y;

int foo (void)
{
  int i;

  while (i < 128)
    {
      i += x->a;
      i += y->b;
    }

  return i;
}

Ok if somebody confirms it passes on x86_64?

I suggest testers to remove this line from libgomp/configure.tgt before 
testing:

         XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"

otherwise the code would not be stressed enough.

Paolo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dce-i386-tls.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070508/56cc9d53/attachment.ksh>


More information about the Gcc-patches mailing list