Patchwork [RFA,Fortran,try,11] Emulated tls rewrite

login
register
mail settings
Submitter IainS
Date July 27, 2010, 12:11 p.m.
Message ID <A4BA62A2-FAC7-46D2-AA19-6F766C0EEE00@sandoe-acoustics.co.uk>
Download mbox | patch
Permalink /patch/59997/
State New
Headers show

Comments

IainS - July 27, 2010, 12:11 p.m.
Richard,

Thanks very much for working on this.

On 26 Jul 2010, at 23:55, Richard Henderson wrote:

> I've committed v11 of this patch.

1
Since LTO and emutls issues are now resolved I've re-enabled the  
relevant tests for ObjC/C++
(after re-checking on i686-darwin{8,9} and x86_64-unknown-linux-gnu.)  
that is r162563.

2
I  noticed that the cse test is not in the set.
If that was an intentional omission (i.e. no longer needed) then fine.
Otherwise, updated version below
If OK, I'll do a changelog and apply it.

thanks again,
Iain



\tL___emutls_get_address.stub.*call 
\tL___emutls_get_address.stub.*" { target "*-*-darwin8" } } } */
+/* { dg-final { scan-assembler-not  
"tls_lookup.*tls_lookup.*" { target *-wrs-vxworks } } } */
+
Richard Henderson - July 27, 2010, 3:54 p.m.
On 07/27/2010 05:11 AM, IainS wrote:
> I  noticed that the cse test is not in the set.
> If that was an intentional omission (i.e. no longer needed) then fine.
> Otherwise, updated version below
> If OK, I'll do a changelog and apply it.

Not an intentional omission.  The test is ok.


r~
IainS - Aug. 18, 2010, 9:04 a.m.
On 27 Jul 2010, at 16:54, Richard Henderson wrote:

> On 07/27/2010 05:11 AM, IainS wrote:
>> I  noticed that the cse test is not in the set.
>> If that was an intentional omission (i.e. no longer needed) then  
>> fine.
>> Otherwise, updated version below
>> If OK, I'll do a changelog and apply it.
>
> Not an intentional omission.  The test is ok.

better late than never:

test cse for emulated TLS targets.

testsuite:

         * lib/target-supports.exp  
(check_effective_target_tls_emulated): New.
         * gcc.dg/tls/thr-cse-1.c: New.

r163330
cheers,
Iain

Patch

Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 162562)
+++ gcc/testsuite/lib/target-supports.exp	(working copy)
@@ -614,6 +614,23 @@  proc check_effective_target_tls_native {} {
      }]
  }

+# Return 1 if *emulated* thread local storage (TLS) is supported, 0  
otherwise.
+
+proc check_effective_target_tls_emulated {} {
+    # VxWorks uses emulated TLS machinery, but with non-standard helper
+    # functions, so we fail to automatically detect it.
+    global target_triplet
+    if { [regexp ".*-.*-vxworks.*" $target_triplet] } {
+	return 1
+    }
+
+    return [check_no_messages_and_pattern tls_emulated "emutls"  
assembly {
+	__thread int i;
+	int f (void) { return i; }
+	void g (int j) { i = j; }
+    }]
+}
+
  # Return 1 if TLS executables can run correctly, 0 otherwise.

  proc check_effective_target_tls_runtime {} {
Index: gcc/testsuite/gcc.dg/tls/thr-cse-1.c
===================================================================
--- gcc/testsuite/gcc.dg/tls/thr-cse-1.c	(revision 0)
+++ gcc/testsuite/gcc.dg/tls/thr-cse-1.c	(revision 0)
@@ -0,0 +1,21 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+/* { dg-require-effective-target tls_emulated } */
+
+/* Test that we only get one call to emutls_get_address when CSE is
+   active.  Note that the var _must_ be initialized for the scan asm
+   to work, since otherwise there will be an initializer which will,
+   correctly, call emutls_get_address.  */
+int foo (int b, int c, int d)
+{
+  static __thread int a=1;
+  a += b;
+  a -= c;
+  a += d;
+  return a;
+}
+
+/* { dg-final { scan-assembler-not  
"emutls_get_address.*emutls_get_address.*" { target { { ! "*-wrs- 
vxworks" } && { ! "*-*-darwin8" } } } } } */
+/* { dg-final { scan-assembler-not "call