36 lines · c
1// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s2// RUN: %clang_cc1 -triple riscv32 -emit-llvm -o - %s | FileCheck %s3// RUN: %clang_cc1 -triple riscv64 -emit-llvm -o - %s | FileCheck %s4 5// CHECK: @b = external thread_local global6// CHECK: @d.e = internal thread_local global7// CHECK: @d.f = internal thread_local global8// CHECK: @f.a = internal thread_local(initialexec) global9// CHECK: @a ={{.*}} thread_local global10// CHECK: @g ={{.*}} thread_local global11// CHECK: @h ={{.*}} thread_local(localdynamic) global12// CHECK: @i ={{.*}} thread_local(initialexec) global13// CHECK: @j ={{.*}} thread_local(localexec) global14 15// CHECK-NOT: @_ZTW16// CHECK-NOT: @_ZTH17 18__thread int a;19extern __thread int b;20int c(void) { return *&b; }21int d(void) {22 __thread static int e;23 __thread static union {float a; int b;} f = {.b = 1};24 return 0;25}26 27__thread int g __attribute__((tls_model("global-dynamic")));28__thread int h __attribute__((tls_model("local-dynamic")));29__thread int i __attribute__((tls_model("initial-exec")));30__thread int j __attribute__((tls_model("local-exec")));31 32int f(void) {33 __thread static int a __attribute__((tls_model("initial-exec")));34 return a++;35}36