diff options
author | Venkatraman Govindaraju <venkatra@cs.wisc.edu> | 2013-09-22 06:48:52 +0000 |
---|---|---|
committer | Venkatraman Govindaraju <venkatra@cs.wisc.edu> | 2013-09-22 06:48:52 +0000 |
commit | 7d052f272d3f9ad0acdebf6811e29d529f70c1e1 (patch) | |
tree | 44ee51e39a3c57a8c9927963d604ba9304d759e5 /test/CodeGen | |
parent | 7d7db75a55319f1d21f0d8336744f90a81b87ac7 (diff) | |
download | external_llvm-7d052f272d3f9ad0acdebf6811e29d529f70c1e1.zip external_llvm-7d052f272d3f9ad0acdebf6811e29d529f70c1e1.tar.gz external_llvm-7d052f272d3f9ad0acdebf6811e29d529f70c1e1.tar.bz2 |
[Sparc] Add support for TLS in sparc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191164 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r-- | test/CodeGen/SPARC/tls.ll | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/CodeGen/SPARC/tls.ll b/test/CodeGen/SPARC/tls.ll new file mode 100644 index 0000000..660ddff --- /dev/null +++ b/test/CodeGen/SPARC/tls.ll @@ -0,0 +1,73 @@ +; RUN: llc <%s -march=sparc -relocation-model=static | FileCheck %s --check-prefix=v8abs +; RUN: llc <%s -march=sparcv9 -relocation-model=static | FileCheck %s --check-prefix=v9abs +; RUN: llc <%s -march=sparc -relocation-model=pic | FileCheck %s --check-prefix=pic +; RUN: llc <%s -march=sparcv9 -relocation-model=pic | FileCheck %s --check-prefix=pic + + +@local_symbol = internal thread_local global i32 0 +@extern_symbol = external thread_local global i32 + +; v8abs-LABEL: test_tls_local +; v8abs: sethi %tle_hix22(local_symbol), [[R0:%[goli][0-7]]] +; v8abs: xor [[R0]], %tle_lox10(local_symbol), [[R1:%[goli][0-7]]] +; v8abs: ld [%g7+[[R1]]] + +; v9abs-LABEL: test_tls_local +; v9abs: sethi %tle_hix22(local_symbol), [[R0:%[goli][0-7]]] +; v9abs: xor [[R0]], %tle_lox10(local_symbol), [[R1:%[goli][0-7]]] +; v9abs: ld [%g7+[[R1]]] + +; pic-LABEL: test_tls_local +; pic: or {{%[goli][0-7]}}, %lo(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[PC:%[goli][0-7]]] +; pic: add [[PC]], %o7, [[GOTBASE:%[goli][0-7]]] +; pic-DAG: sethi %tldm_hi22(local_symbol), [[R0:%[goli][0-7]]] +; pic-DAG: add [[R0]], %tldm_lo10(local_symbol), [[R1:%[goli][0-7]]] +; pic-DAG: add [[GOTBASE]], [[R1]], %o0, %tldm_add(local_symbol) +; pic-DAG: call __tls_get_addr, %tldm_call(local_symbol) +; pic-DAG: sethi %tldo_hix22(local_symbol), [[R2:%[goli][0-7]]] +; pic-DAG: xor [[R2]], %tldo_lox10(local_symbol), [[R3:%[goli][0-7]]] +; pic: add %o0, [[R3]], {{.+}}, %tldo_add(local_symbol) + +define i32 @test_tls_local() { +entry: + %0 = load i32* @local_symbol, align 4 + %1 = add i32 %0, 1 + store i32 %1, i32* @local_symbol, align 4 + ret i32 %1 +} + + +; v8abs-LABEL: test_tls_extern +; v8abs: or {{%[goli][0-7]}}, %lo(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[PC:%[goli][0-7]]] +; v8abs: add [[PC]], %o7, %[[GOTBASE:[goli][0-7]]] +; v8abs: sethi %tie_hi22(extern_symbol), [[R1:%[goli][0-7]]] +; v8abs: add [[R1]], %tie_lo10(extern_symbol), %[[R2:[goli][0-7]]] +; v8abs: ld [%[[GOTBASE]]+%[[R2]]], [[R3:%[goli][0-7]]], %tie_ld(extern_symbol) +; v8abs: add %g7, [[R3]], %[[R4:[goli][0-7]]], %tie_add(extern_symbol) +; v8abs: ld [%[[R4]]] + +; v9abs-LABEL: test_tls_extern +; v9abs: or {{%[goli][0-7]}}, %lo(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[PC:%[goli][0-7]]] +; v9abs: add [[PC]], %o7, %[[GOTBASE:[goli][0-7]]] +; v9abs: sethi %tie_hi22(extern_symbol), [[R1:%[goli][0-7]]] +; v9abs: add [[R1]], %tie_lo10(extern_symbol), %[[R2:[goli][0-7]]] +; v9abs: ldx [%[[GOTBASE]]+%[[R2]]], [[R3:%[goli][0-7]]], %tie_ldx(extern_symbol) +; v9abs: add %g7, [[R3]], %[[R4:[goli][0-7]]], %tie_add(extern_symbol) +; v9abs: ld [%[[R4]]] + +; pic-LABEL: test_tls_extern +; pic: or {{%[goli][0-7]}}, %lo(_GLOBAL_OFFSET_TABLE_+{{.+}}), [[PC:%[goli][0-7]]] +; pic: add [[PC]], %o7, [[GOTBASE:%[goli][0-7]]] +; pic: sethi %tgd_hi22(extern_symbol), [[R0:%[goli][0-7]]] +; pic: add [[R0]], %tgd_lo10(extern_symbol), [[R1:%[goli][0-7]]] +; pic: add [[GOTBASE]], [[R1]], %o0, %tgd_add(extern_symbol) +; pic: call __tls_get_addr, %tgd_call(extern_symbol) +; pic-NEXT: nop + +define i32 @test_tls_extern() { +entry: + %0 = load i32* @extern_symbol, align 4 + %1 = add i32 %0, 1 + store i32 %1, i32* @extern_symbol, align 4 + ret i32 %1 +} |