+2011-05-24 Uros Bizjak <ubizjak@gmail.com>
+ Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * gcc.dg/torture/tls/run-gd.c: New test.
+ * gcc.dg/torture/tls/run-ie.c: New test.
+ * gcc.dg/torture/tls/run-ld.c: New test.
+ * gcc.dg/torture/tls/run-le.c: New test.
+ * lib/target-supports.exp (check_effective_target_tls_runtime):
+ Build testcase with TLS options.
+
2011-05-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc.dg/vect/pr48172.c: Remove dg-do run.
--- /dev/null
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+/* { dg-add-options tls } */
+
+extern void abort (void);
+
+__thread int tls_gd __attribute__((tls_model("global-dynamic"))) = 0;
+
+int get_gd (void)
+{
+ return tls_gd;
+}
+
+int *get_gdp (void)
+{
+ return &tls_gd;
+}
+
+int main (void)
+{
+ int val;
+
+ val = get_gd ();
+ if (val != 0)
+ abort ();
+
+ val = *get_gdp ();
+ if (val != 0)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+/* { dg-add-options tls } */
+
+extern void abort (void);
+
+__thread int tls_ie __attribute__((tls_model("initial-exec"))) = 4;
+
+int get_ie (void)
+{
+ return tls_ie;
+}
+
+int *get_iep (void)
+{
+ return &tls_ie;
+}
+
+int main (void)
+{
+ int val;
+
+ val = get_ie ();
+ if (val != 4)
+ abort ();
+
+ val = *get_iep ();
+ if (val != 4)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+/* { dg-add-options tls } */
+
+extern void abort (void);
+
+__thread int tls_ld __attribute__((tls_model("local-dynamic"))) = 1;
+__thread int tls_ld2 __attribute__((tls_model("local-dynamic"))) = 2;
+
+int get_ld (void)
+{
+ return tls_ld + tls_ld2;
+}
+
+int *get_ldp (void)
+{
+ return &tls_ld;
+}
+
+int main (void)
+{
+ int val;
+
+ val = get_ld ();
+ if (val != 1 + 2)
+ abort ();
+
+ val = *get_ldp ();
+ if (val != 1)
+ abort ();
+
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+/* { dg-add-options tls } */
+
+extern void abort (void);
+
+__thread int tls_le __attribute__((tls_model("local-exec"))) = 3;
+
+int get_le (void)
+{
+ return tls_le;
+}
+
+int *get_lep (void)
+{
+ return &tls_le;
+}
+
+int main (void)
+{
+ int val;
+
+ val = get_le ();
+ if (val != 3)
+ abort ();
+
+ val = *get_lep ();
+ if (val != 3)
+ abort ();
+
+ return 0;
+}
return [check_runtime tls_runtime {
__thread int thr = 0;
int main (void) { return thr; }
- }]
+ } [add_options_for_tls ""]]
}
# Return 1 if -ffunction-sections is supported, 0 otherwise.