Manman Ren | 6815026 | 2015-11-11 22:42:31 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck --check-prefix=CHECK --check-prefix=LINUX %s |
| 2 | // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple x86_64-apple-darwin12 | FileCheck --check-prefix=CHECK --check-prefix=DARWIN %s |
Richard Smith | 2fd1d7a | 2013-04-19 16:42:07 +0000 | [diff] [blame] | 3 | |
| 4 | int &f(); |
| 5 | |
Manman Ren | 6815026 | 2015-11-11 22:42:31 +0000 | [diff] [blame] | 6 | // LINUX: @r = thread_local global i32* null |
| 7 | // DARWIN: @r = internal thread_local global i32* null |
Richard Smith | 2fd1d7a | 2013-04-19 16:42:07 +0000 | [diff] [blame] | 8 | thread_local int &r = f(); |
| 9 | |
Manman Ren | 6815026 | 2015-11-11 22:42:31 +0000 | [diff] [blame] | 10 | // LINUX: @_ZTH1r = alias void (), void ()* @__tls_init |
| 11 | // DARWIN: @_ZTH1r = internal alias void (), void ()* @__tls_init |
Richard Smith | 2fd1d7a | 2013-04-19 16:42:07 +0000 | [diff] [blame] | 12 | |
| 13 | int &g() { return r; } |
| 14 | |
| 15 | // CHECK: define {{.*}} @[[R_INIT:.*]]() |
Hal Finkel | a2347ba | 2014-07-18 15:52:10 +0000 | [diff] [blame] | 16 | // CHECK: call dereferenceable({{[0-9]+}}) i32* @_Z1fv() |
Richard Smith | 2fd1d7a | 2013-04-19 16:42:07 +0000 | [diff] [blame] | 17 | // CHECK: store i32* %{{.*}}, i32** @r, align 8 |
| 18 | |
Hal Finkel | a2347ba | 2014-07-18 15:52:10 +0000 | [diff] [blame] | 19 | // CHECK-LABEL: define dereferenceable({{[0-9]+}}) i32* @_Z1gv() |
Manman Ren | b0b3af7 | 2015-12-17 00:42:36 +0000 | [diff] [blame] | 20 | // LINUX: call i32* @_ZTW1r() |
| 21 | // DARWIN: call cxx_fast_tlscc i32* @_ZTW1r() |
Richard Smith | 2fd1d7a | 2013-04-19 16:42:07 +0000 | [diff] [blame] | 22 | // CHECK: ret i32* %{{.*}} |
| 23 | |
Akira Hatanaka | 26907f9 | 2016-01-15 03:34:06 +0000 | [diff] [blame^] | 24 | // LINUX: define weak_odr hidden i32* @_ZTW1r() [[ATTR0:#[0-9]+]] { |
| 25 | // DARWIN: define cxx_fast_tlscc i32* @_ZTW1r() [[ATTR1:#[0-9]+]] { |
Richard Smith | 2fd1d7a | 2013-04-19 16:42:07 +0000 | [diff] [blame] | 26 | // CHECK: call void @_ZTH1r() |
David Blaikie | a953f28 | 2015-02-27 21:19:58 +0000 | [diff] [blame] | 27 | // CHECK: load i32*, i32** @r, align 8 |
Richard Smith | 2fd1d7a | 2013-04-19 16:42:07 +0000 | [diff] [blame] | 28 | // CHECK: ret i32* %{{.*}} |
| 29 | |
Stephen Lin | 4362261 | 2013-08-15 06:47:53 +0000 | [diff] [blame] | 30 | // CHECK-LABEL: define internal void @__tls_init() |
Richard Smith | 2fd1d7a | 2013-04-19 16:42:07 +0000 | [diff] [blame] | 31 | // CHECK: call void @[[R_INIT]]() |
Manman Ren | b0b3af7 | 2015-12-17 00:42:36 +0000 | [diff] [blame] | 32 | |
Akira Hatanaka | 26907f9 | 2016-01-15 03:34:06 +0000 | [diff] [blame^] | 33 | // LINUX: attributes [[ATTR0]] = { {{.*}}"target-features"{{.*}} } |
| 34 | // DARWIN: attributes [[ATTR1]] = { {{.*}}nounwind{{.*}}"target-features"{{.*}} } |