URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/gnu-old/gcc-4.2.2/gcc/testsuite/gcc.dg/tls
- from Rev 154 to Rev 816
- ↔ Reverse comparison
Rev 154 → Rev 816
/opt-1.c
0,0 → 1,30
/* { dg-do compile } */ |
/* { dg-options "-O2 -fPIC" } */ |
/* { dg-options "-O2 -fPIC -mtune=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ |
/* { dg-require-effective-target tls } */ |
/* { dg-require-effective-target fpic } */ |
|
extern __thread int thr; |
|
static int x; |
|
static void |
bar (void) |
{ |
x = 1; |
} |
|
static void |
#ifdef __i386__ |
__attribute__ ((regparm (3))) |
#endif |
foo (const char *x, void *y, int *z) |
{ |
bar (); |
} |
|
void |
test (const char *x, void *y) |
{ |
foo (x, y, &thr); |
} |
opt-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: init-1.c
===================================================================
--- init-1.c (nonexistent)
+++ init-1.c (revision 816)
@@ -0,0 +1,5 @@
+/* Invalid initializations. */
+/* { dg-require-effective-target tls } */
+
+extern __thread int i;
+int *p = &i; /* { dg-error "initializer element is not constant" } */
init-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-2.c
===================================================================
--- opt-2.c (nonexistent)
+++ opt-2.c (revision 816)
@@ -0,0 +1,54 @@
+/* This testcase generated invalid assembly on IA-32,
+ since %gs:0 memory load was not exposed to the compiler
+ as memory load and mem to mem moves are not possible
+ on IA-32. */
+/* { dg-do link } */
+/* { dg-options "-O2 -ftls-model=initial-exec" } */
+/* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-require-effective-target tls } */
+
+__thread int thr;
+
+struct A
+{
+ unsigned int a, b, c, d, e;
+};
+
+int bar (int x, unsigned long y, void *z)
+{
+ return 0;
+}
+
+int
+foo (int x, int y, const struct A *z)
+{
+ struct A b;
+ int d;
+
+ b = *z;
+ d = bar (x, y, &b);
+ if (d == 0 && y == 0x5402)
+ {
+ int e = thr;
+ d = bar (x, 0x5401, &b);
+ if (d)
+ {
+ thr = e;
+ d = 0;
+ }
+ else if ((z->c & 0600) != (b.c & 0600)
+ || ((z->c & 060) && ((z->c & 060) != (b.c & 060))))
+ {
+ thr = 22;
+ d = -1;
+ }
+ }
+
+ return d;
+}
+
+int main (void)
+{
+ foo (1, 2, 0);
+ return 0;
+}
opt-2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: section-1.c
===================================================================
--- section-1.c (nonexistent)
+++ section-1.c (revision 816)
@@ -0,0 +1,12 @@
+/* Verify that we get errors for trying to put TLS data in
+ sections which can't work. */
+/* { dg-require-effective-target tls } */
+
+#define A(X) __attribute__((section(X)))
+
+__thread int i A("foo"); /* Ok */
+
+__thread int j A(".data"); /* { dg-error "causes a section type conflict" "conflict with .data section" { xfail *-*-* } } */
+
+int k A("bar");
+__thread int l A("bar"); /* { dg-error "causes a section type conflict" "conflict with user-defined section" } */
section-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-3.c
===================================================================
--- opt-3.c (nonexistent)
+++ opt-3.c (revision 816)
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fpic" } */
+/* { dg-options "-O2 -fpic -mregparm=3" { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-effective-target tls } */
+/* { dg-require-effective-target fpic } */
+
+extern __thread int i, j, k;
+extern void bar(int *, int *, int *);
+void foo(void)
+{
+ bar(&i, &j, &k);
+}
opt-3.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: diag-1.c
===================================================================
--- diag-1.c (nonexistent)
+++ diag-1.c (revision 816)
@@ -0,0 +1,12 @@
+/* Valid __thread specifiers. */
+/* { dg-require-effective-target tls } */
+
+__thread int g1;
+extern __thread int g2;
+static __thread int g3;
+
+void foo()
+{
+ extern __thread int l1;
+ static __thread int l2;
+}
diag-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-4.c
===================================================================
--- opt-4.c (nonexistent)
+++ opt-4.c (revision 816)
@@ -0,0 +1,54 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
+
+struct A
+{
+ int a1;
+ int a2;
+};
+
+extern __thread const unsigned char *tcc1, **tcc2;
+
+extern inline const unsigned char ** __attribute__ ((const))
+foo (void)
+{
+ const unsigned char **a = &tcc1;
+ if (*a == 0)
+ *a = *tcc2 + 128;
+ return a;
+}
+
+extern inline int
+bar (const struct A *x)
+{
+ int a;
+
+ if (x->a2 & 8)
+ return 0;
+ a = x->a1;
+ return a > 0 && ((*foo ())[a] & 64);
+}
+
+int
+baz (const struct A *x, char *y)
+{
+ const struct A *a;
+
+ for (a = x; !!a->a1; a++)
+ if (! (x->a2 & 8))
+ if (bar (a))
+ {
+ *y++ = a->a1;
+ if (x->a1)
+ *y++ = ':';
+ *y = '\0';
+ }
+ return 0;
+}
+
+/* Verify tcc1 and tcc2 variables show up only in the TLS access sequences. */
+/* { dg-final { scan-assembler "tcc1@" { target i?86-*-* x86_64-*-* } } } */
+/* { dg-final { scan-assembler "tcc2@" { target i?86-*-* x86_64-*-* } } } */
+/* { dg-final { scan-assembler-not "tcc1\[^@\]" { target i?86-*-* x86_64-*-* } } } */
+/* { dg-final { scan-assembler-not "tcc2\[^@\]" { target i?86-*-* x86_64-*-* } } } */
opt-4.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: diag-2.c
===================================================================
--- diag-2.c (nonexistent)
+++ diag-2.c (revision 816)
@@ -0,0 +1,22 @@
+/* Invalid __thread specifiers. */
+/* { dg-require-effective-target tls } */
+
+__thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */
+__thread static int g2; /* { dg-error "'__thread' before 'static'" } */
+__thread __thread int g3; /* { dg-error "duplicate '__thread'" } */
+typedef __thread int g4; /* { dg-error "'__thread' used with 'typedef'" } */
+
+void foo()
+{
+ __thread int l1; /* { dg-error "implicitly auto and declared '__thread'" } */
+ auto __thread int l2; /* { dg-error "'__thread' used with 'auto'" } */
+ __thread extern int l3; /* { dg-error "'__thread' before 'extern'" } */
+ register __thread int l4; /* { dg-error "'__thread' used with 'register'" } */
+}
+
+__thread void f1 (); /* { dg-error "invalid storage class for function" } */
+extern __thread void f2 (); /* { dg-error "invalid storage class for function" } */
+static __thread void f3 (); /* { dg-error "invalid storage class for function" } */
+__thread void f4 () { } /* { dg-error "function definition declared '__thread'" } */
+
+void bar(__thread int p1); /* { dg-error "storage class specified for parameter" } */
diag-2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-5.c
===================================================================
--- opt-5.c (nonexistent)
+++ opt-5.c (revision 816)
@@ -0,0 +1,110 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
+/* Sched1 moved {load_tp} pattern between strlen call and the copy
+ of the hard return value to its pseudo. This resulted in a
+ reload abort, since the hard register was not spillable. */
+
+extern __thread int __libc_errno __attribute__ ((tls_model ("initial-exec")));
+
+struct stat64
+ {
+ long dummy[4];
+ };
+typedef __SIZE_TYPE__ size_t;
+typedef unsigned long long uint64_t;
+typedef int __mode_t;
+
+extern size_t strlen (__const char *__s) __attribute__ ((__pure__));
+extern int strcmp (__const char *__s1, __const char *__s2)
+ __attribute__ ((__pure__));
+
+extern int __open64 (__const char *__file, int __oflag, ...);
+extern int __open (__const char *__file, int __oflag, ...);
+extern int __mkdir (__const char *__path, __mode_t __mode);
+extern int __lxstat64 (int __ver, __const char *__filename,
+ struct stat64 *__stat_buf) ;
+
+static const char letters[] =
+"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
+int
+__gen_tempname (char *tmpl, int kind)
+{
+ int len;
+ char *XXXXXX;
+ static uint64_t value;
+ uint64_t random_time_bits;
+ unsigned int count;
+ int fd = -1;
+ int save_errno = __libc_errno;
+ struct stat64 st;
+ unsigned int attempts_min = 62 * 62 * 62;
+ unsigned int attempts = attempts_min < 238328 ? 238328 : attempts_min;
+
+ len = strlen (tmpl);
+ if (len < 6 || strcmp(&tmpl[len - 6], "XXXXXX"))
+ {
+ (__libc_errno = (22));
+ return -1;
+ }
+
+ XXXXXX = &tmpl[len - 6];
+
+ for (count = 0; count < attempts; value += 7777, ++count)
+ {
+ uint64_t v = value;
+
+ XXXXXX[0] = letters[v % 62];
+ v /= 62;
+ XXXXXX[1] = letters[v % 62];
+ v /= 62;
+ XXXXXX[2] = letters[v % 62];
+ v /= 62;
+ XXXXXX[3] = letters[v % 62];
+ v /= 62;
+ XXXXXX[4] = letters[v % 62];
+ v /= 62;
+ XXXXXX[5] = letters[v % 62];
+
+ switch (kind)
+ {
+ case 0:
+ fd = __open (tmpl, 02 | 01000 | 04000, 0400 | 0200);
+ break;
+
+ case 1:
+ fd = __open64 (tmpl, 02 | 01000 | 04000, 0400 | 0200);
+ break;
+
+ case 2:
+ fd = __mkdir (tmpl, 0400 | 0200 | 0100);
+ break;
+
+ case 3:
+ if (__lxstat64 (2, tmpl, &st) < 0)
+ {
+ if (__libc_errno == 2)
+ {
+ (__libc_errno = (save_errno));
+ return 0;
+ }
+ else
+
+ return -1;
+ }
+ continue;
+ }
+
+ if (fd >= 0)
+ {
+ (__libc_errno = (save_errno));
+ return fd;
+ }
+ else if (__libc_errno != 17)
+ return -1;
+ }
+
+ (__libc_errno = (17));
+ return -1;
+}
opt-5.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: diag-3.c
===================================================================
--- diag-3.c (nonexistent)
+++ diag-3.c (revision 816)
@@ -0,0 +1,11 @@
+/* Report invalid extern and __thread combinations. */
+/* { dg-require-effective-target tls } */
+
+extern int j; /* { dg-error "previous declaration" } */
+__thread int j; /* { dg-error "follows non-thread-local" } */
+
+extern __thread int i; /* { dg-error "previous declaration" } */
+int i; /* { dg-error "follows thread-local" } */
+
+extern __thread int k; /* This is fine. */
+__thread int k;
diag-3.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-6.c
===================================================================
--- opt-6.c (nonexistent)
+++ opt-6.c (revision 816)
@@ -0,0 +1,71 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
+
+extern void abort (void);
+extern void exit (int);
+
+struct A
+{
+ char a;
+ int b;
+ long long c;
+};
+extern __thread struct A a1, a2, a3, a4;
+extern struct A *f1a (void);
+extern struct A *f2a (void);
+extern struct A *f3a (void);
+extern struct A *f4a (void);
+extern struct A *f5a (void);
+extern struct A *f6a (void);
+extern struct A *f7a (void);
+extern struct A *f8a (void);
+extern struct A *f9a (void);
+extern struct A *f10a (void);
+extern int f1b (void);
+extern int f2b (void);
+extern int f3b (void);
+extern int f4b (void);
+extern int f5b (void);
+extern int f6b (void);
+extern int f7b (void);
+extern int f8b (void);
+extern int f9b (void);
+extern int f10b (void);
+extern void check1 (void);
+extern void check2 (void);
+__thread int dummy = 12;
+__thread struct A local = { 1, 2, 3 };
+
+int
+main (void)
+{
+ struct A *p;
+
+ if (local.a != 1 || local.b != 2 || local.c != 3)
+ abort ();
+ if (a1.a != 4 || a1.b != 5 || a1.c != 6)
+ abort ();
+ if (a2.a != 22 || a2.b != 23 || a2.c != 24)
+ abort ();
+ if (a3.a != 10 || a3.b != 11 || a3.c != 12)
+ abort ();
+ if (a4.a != 25 || a4.b != 26 || a4.c != 27)
+ abort ();
+ check1 ();
+ check2 ();
+ if (f1a () != &a1 || f2a () != &a2 || f3a () != &a3 || f4a () != &a4)
+ abort ();
+ p = f5a (); if (p->a != 16 || p->b != 16 + 1 || p->c != 16 + 2)
+ abort ();
+ p = f6a (); if (p->a != 19 || p->b != 19 + 1 || p->c != 19 + 2)
+ abort ();
+ if (f7a () != &a2 || f8a () != &a4)
+ abort ();
+ p = f9a (); if (p->a != 28 || p->b != 28 + 1 || p->c != 28 + 2)
+ abort ();
+ p = f10a (); if (p->a != 31 || p->b != 31 + 1 || p->c != 31 + 2)
+ abort ();
+
+ exit (0);
+}
opt-6.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: diag-4.c
===================================================================
--- diag-4.c (nonexistent)
+++ diag-4.c (revision 816)
@@ -0,0 +1,11 @@
+/* Invalid __thread specifiers. As diag-4.c but some cases in
+ different orders. */
+/* { dg-require-effective-target tls } */
+
+__thread typedef int g4; /* { dg-error "'__thread' used with 'typedef'" } */
+
+void foo()
+{
+ __thread auto int l2; /* { dg-error "'__thread' used with 'auto'" } */
+ __thread register int l4; /* { dg-error "'__thread' used with 'register'" } */
+}
diag-4.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-7.c
===================================================================
--- opt-7.c (nonexistent)
+++ opt-7.c (revision 816)
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-effective-target tls } */
+
+static __thread void *baz [4] __attribute__((tls_model ("initial-exec")));
+void foo (void)
+{
+ void **u = (void **) baz;
+
+ u[0] = 0;
+ u[1] = 0;
+}
+
+/* { dg-final { scan-assembler-not "\[48\]\\+baz" { target i?86-*-* x86_64-*-* } } } */
opt-7.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: diag-5.c
===================================================================
--- diag-5.c (nonexistent)
+++ diag-5.c (revision 816)
@@ -0,0 +1,4 @@
+/* __thread specifiers on empty declarations. */
+/* { dg-require-effective-target tls } */
+
+__thread struct foo; /* { dg-warning "warning: useless '__thread' in empty declaration" } */
diag-5.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-8.c
===================================================================
--- opt-8.c (nonexistent)
+++ opt-8.c (revision 816)
@@ -0,0 +1,14 @@
+/* PR 18910 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
+
+static __thread void *foo [2];
+void
+test1 (void)
+{
+ unsigned int s;
+
+ for (s = 0; s < 2; ++s)
+ foo [s] = &foo[s];
+}
opt-8.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-9.c
===================================================================
--- opt-9.c (nonexistent)
+++ opt-9.c (revision 816)
@@ -0,0 +1,8 @@
+/* PR 21412 */
+/* { dg-do compile */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-effective-target tls } */
+
+struct S { int x[10]; };
+extern __thread struct S s;
+int *foo() { return &s.x[2]; }
opt-9.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pic-1.c
===================================================================
--- pic-1.c (nonexistent)
+++ pic-1.c (revision 816)
@@ -0,0 +1,72 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fpic -ftls-model=global-dynamic" } */
+/* { dg-require-effective-target tls } */
+
+extern __thread long e1;
+extern __thread int e2;
+static __thread long s1;
+static __thread int s2;
+
+long *ae1 (void)
+{
+ return &e1;
+}
+
+int *ae2 (void)
+{
+ return &e2;
+}
+
+long *as1 (void)
+{
+ return &s1;
+}
+
+int *as2 (void)
+{
+ return &s2;
+}
+
+long ge1 (void)
+{
+ return e1;
+}
+
+int ge2 (void)
+{
+ return e2;
+}
+
+long gs1 (void)
+{
+ return s1;
+}
+
+int gs2 (void)
+{
+ return s2;
+}
+
+long ge3 (void)
+{
+ return e1 + e2;
+}
+
+long gs3 (void)
+{
+ return s1 + s2;
+}
+
+long ge4 (void)
+{
+ if (0)
+ return e1;
+ return e2;
+}
+
+long gs4 (void)
+{
+ if (0)
+ return s1;
+ return s2;
+}
pic-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: trivial.c
===================================================================
--- trivial.c (nonexistent)
+++ trivial.c (revision 816)
@@ -0,0 +1,3 @@
+/* { dg-require-effective-target tls } */
+
+__thread int i;
trivial.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: tls.exp
===================================================================
--- tls.exp (nonexistent)
+++ tls.exp (revision 816)
@@ -0,0 +1,36 @@
+# Copyright (C) 2002, 2005, 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# .
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
Index: asm-1.c
===================================================================
--- asm-1.c (nonexistent)
+++ asm-1.c (revision 816)
@@ -0,0 +1,8 @@
+/* { dg-options "-Werror" } */
+/* { dg-require-effective-target tls } */
+__thread int i;
+
+int foo ()
+{
+ asm volatile ("" :: "m" (&i)); /* { dg-error "directly addressable" } */
+}
asm-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-10.c
===================================================================
--- opt-10.c (nonexistent)
+++ opt-10.c (revision 816)
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fpic" } */
+/* { dg-require-effective-target tls } */
+
+/* The web pass was creating unrecognisable pic_load_dot_plus_four insns
+ on ARM. */
+
+__thread int a_thread_local;
+void *
+spin (int n)
+{
+ int i;
+ for (i = 0; i <= n; i++)
+ {
+ a_thread_local += i;
+ }
+}
opt-10.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-11.c
===================================================================
--- opt-11.c (nonexistent)
+++ opt-11.c (revision 816)
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+
+extern void abort (void);
+extern void *memset (void *, int, __SIZE_TYPE__);
+
+struct A
+{
+ char pad[48];
+ int i;
+ int pad2;
+ int j;
+};
+__thread struct A a;
+
+int *
+__attribute__((noinline))
+foo (void)
+{
+ return &a.i;
+}
+
+int
+main (void)
+{
+ int *p = foo ();
+ memset (&a, 0, sizeof (a));
+ a.i = 6;
+ a.j = 8;
+ if (p[0] != 6 || p[1] != 0 || p[2] != 8)
+ abort ();
+ return 0;
+}
opt-11.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: opt-12.c
===================================================================
--- opt-12.c (nonexistent)
+++ opt-12.c (revision 816)
@@ -0,0 +1,50 @@
+/* PR target/29198 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fpic" } */
+/* { dg-require-effective-target tls_runtime } */
+/* { dg-require-effective-target fpic } */
+
+extern void abort (void);
+
+int f2 (int, int, int, int);
+struct s { char b[4]; };
+__thread struct s thra[2];
+
+void
+__attribute__((noinline))
+f1 (int a1, int a2)
+{
+ int i, j;
+ for (i = 0; i < 4; i++)
+ {
+ int tot = 0;
+ for (j = 0; j < 4; j++)
+ tot += f2 (a1, a2, i, j);
+ *(&thra[0].b[0] + i) = tot;
+ }
+}
+
+int
+__attribute__((noinline))
+f2 (int a, int b, int c, int d)
+{
+ return a + b + c + d;
+}
+
+int
+main (void)
+{
+ f1 (0, 0);
+ if (thra[0].b[0] != 6
+ || thra[0].b[1] != 10
+ || thra[0].b[2] != 14
+ || thra[0].b[3] != 18)
+ abort ();
+ f1 (2, 3);
+ if (thra[0].b[0] != 26
+ || thra[0].b[1] != 30
+ || thra[0].b[2] != 34
+ || thra[0].b[3] != 38)
+ abort ();
+ return 0;
+}
opt-12.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: struct-1.c
===================================================================
--- struct-1.c (nonexistent)
+++ struct-1.c (revision 816)
@@ -0,0 +1,33 @@
+/* This testcase ICEd on IA-32 because the backend was inconsistent whether
+ to allow addends for @dtpoff relocs or not. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fpic" } */
+/* { dg-require-effective-target tls } */
+
+struct S {
+ int s0, s1, s2, s3;
+};
+static __thread struct S x;
+extern void abort (void);
+extern void exit (int);
+
+void
+foo (struct S *s)
+{
+ s->s2 = 231;
+}
+
+void
+bar (void)
+{
+ if (x.s0 == 231 || x.s2 != 231)
+ abort ();
+}
+
+int
+main ()
+{
+ foo (&x);
+ bar ();
+ exit (0);
+}
struct-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: alpha-1.c
===================================================================
--- alpha-1.c (nonexistent)
+++ alpha-1.c (revision 816)
@@ -0,0 +1,10 @@
+/* Make sure that we honor initial-exec. */
+/* { dg-do compile { target alpha*-*-* } } */
+/* { dg-options "" } */
+/* { dg-require-effective-target tls } */
+
+static __thread int xyzzy __attribute__ ((tls_model ("initial-exec")));
+int foo(void) { return xyzzy; }
+
+/* { dg-final { scan-assembler "gottprel" } } */
+/* { dg-final { scan-assembler-not "tprel(lo|hi|16)" } } */
alpha-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: nonpic-1.c
===================================================================
--- nonpic-1.c (nonexistent)
+++ nonpic-1.c (revision 816)
@@ -0,0 +1,72 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftls-model=initial-exec" } */
+/* { dg-require-effective-target tls } */
+
+extern __thread long e1;
+extern __thread int e2;
+static __thread long s1;
+static __thread int s2;
+
+long *ae1 (void)
+{
+ return &e1;
+}
+
+int *ae2 (void)
+{
+ return &e2;
+}
+
+long *as1 (void)
+{
+ return &s1;
+}
+
+int *as2 (void)
+{
+ return &s2;
+}
+
+long ge1 (void)
+{
+ return e1;
+}
+
+int ge2 (void)
+{
+ return e2;
+}
+
+long gs1 (void)
+{
+ return s1;
+}
+
+int gs2 (void)
+{
+ return s2;
+}
+
+long ge3 (void)
+{
+ return e1 + e2;
+}
+
+long gs3 (void)
+{
+ return s1 + s2;
+}
+
+long ge4 (void)
+{
+ if (0)
+ return e1;
+ return e2;
+}
+
+long gs4 (void)
+{
+ if (0)
+ return s1;
+ return s2;
+}
nonpic-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: debug-1.c
===================================================================
--- debug-1.c (nonexistent)
+++ debug-1.c (revision 816)
@@ -0,0 +1,5 @@
+/* { dg-do assemble } */
+/* { dg-options "-g" } */
+/* { dg-require-effective-target tls } */
+
+__thread int i;
debug-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr24428-2.c
===================================================================
--- pr24428-2.c (nonexistent)
+++ pr24428-2.c (revision 816)
@@ -0,0 +1,13 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls_runtime } */
+
+__thread double thrtest[81];
+int main ()
+{
+ double *p, *e;
+ e = &thrtest[81];
+ for (p = &thrtest[0]; p < e; ++p)
+ *p = 1.0;
+ return 0;
+}
pr24428-2.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: pr24428.c
===================================================================
--- pr24428.c (nonexistent)
+++ pr24428.c (revision 816)
@@ -0,0 +1,12 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls_runtime } */
+
+__thread double thrtest[81];
+int main ()
+{
+ int i;
+ for (i = 0; i < 81; i++)
+ thrtest[i] = 1.0;
+ return 0;
+}
pr24428.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: alias-1.c
===================================================================
--- alias-1.c (nonexistent)
+++ alias-1.c (revision 816)
@@ -0,0 +1,24 @@
+/* { dg-do link } */
+/* { dg-require-alias "" } */
+/* { dg-require-visibility "" } */
+/* { dg-require-effective-target tls } */
+/* Test that encode_section_info handles the change from externally
+ defined to locally defined (via hidden). Extracted from glibc. */
+
+struct __res_state {
+ char x[123];
+};
+
+extern __thread struct __res_state bar
+ __attribute__ ((tls_model ("initial-exec")));
+
+int main()
+{
+ bar.x[0] = 0;
+ return 0;
+}
+
+__thread struct __res_state foo;
+extern __thread struct __res_state bar
+ __attribute__ ((alias ("foo")))
+ __attribute__ ((visibility ("hidden")));
alias-1.c
Property changes :
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property