CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
142 lines
5.5 KiB
LLVM
142 lines
5.5 KiB
LLVM
; Run the tests with the `localexec` TLS mode specified.
|
|
; RUN: sed -e 's/\[\[TLS_MODE\]\]/(localexec)/' %s | llc -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=+bulk-memory,atomics - | FileCheck --check-prefixes=CHECK,TLS %s
|
|
; RUN: sed -e 's/\[\[TLS_MODE\]\]/(localexec)/' %s | llc -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=+bulk-memory,atomics -fast-isel - | FileCheck --check-prefixes=CHECK,TLS %s
|
|
; RUN: sed -e 's/\[\[TLS_MODE\]\]/(localexec)/' %s | llc -mtriple=wasm32-wasip3 -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=bulk-memory,atomics -fast-isel - | FileCheck --check-prefixes=CHECK,TLS-LIBCALL %s
|
|
|
|
; Also, run the same tests without a specified TLS mode--this should still emit `localexec` code on non-Emscripten targtes which don't currently support dynamic linking.
|
|
; RUN: sed -e 's/\[\[TLS_MODE\]\]//' %s | llc -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=+bulk-memory,atomics - | FileCheck --check-prefixes=CHECK,TLS %s
|
|
; RUN: sed -e 's/\[\[TLS_MODE\]\]//' %s | llc -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=+bulk-memory,atomics -fast-isel - | FileCheck --check-prefixes=CHECK,TLS %s
|
|
; RUN: sed -e 's/\[\[TLS_MODE\]\]//' %s | llc -mtriple=wasm32-wasip3 -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=bulk-memory,atomics -fast-isel - | FileCheck --check-prefixes=CHECK,TLS-LIBCALL %s
|
|
|
|
; Finally, when bulk memory is disabled, no TLS code should be generated.
|
|
; RUN: sed -e 's/\[\[TLS_MODE\]\]/(localexec)/' %s | llc -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=-bulk-memory,atomics - | FileCheck --check-prefixes=CHECK,NO-TLS %s
|
|
; RUN: sed -e 's/\[\[TLS_MODE\]\]/(localexec)/' %s | llc -mtriple=wasm32-wasip3 -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-disable-explicit-locals -mattr=-bulk-memory,atomics - | FileCheck --check-prefixes=CHECK,NO-TLS %s
|
|
target triple = "wasm32-unknown-unknown"
|
|
|
|
; CHECK-LABEL: address_of_tls:
|
|
; CHECK-NEXT: .functype address_of_tls () -> (i32)
|
|
define i32 @address_of_tls() {
|
|
; TLS-DAG: global.get __tls_base
|
|
; TLS-DAG: i32.const tls@TLSREL
|
|
; TLS-NEXT: i32.add
|
|
; TLS-NEXT: return
|
|
|
|
; TLS-LIBCALL-DAG: call __wasm_get_tls_base
|
|
; TLS-LIBCALL-DAG: i32.const tls@TLSREL
|
|
; TLS-LIBCALL-NEXT: i32.add
|
|
; TLS-LIBCALL-NEXT: return
|
|
|
|
; NO-TLS-NEXT: i32.const tls
|
|
; NO-TLS-NEXT: return
|
|
%p = call ptr @llvm.threadlocal.address.p0(ptr @tls)
|
|
%r = ptrtoint ptr %p to i32
|
|
ret i32 %r
|
|
}
|
|
|
|
; CHECK-LABEL: address_of_tls_external:
|
|
; CHECK-NEXT: .functype address_of_tls_external () -> (i32)
|
|
define i32 @address_of_tls_external() {
|
|
; TLS-DAG: global.get __tls_base
|
|
; TLS-DAG: i32.const tls_external@TLSREL
|
|
; TLS-NEXT: i32.add
|
|
; TLS-NEXT: return
|
|
|
|
; TLS-LIBCALL-DAG: call __wasm_get_tls_base
|
|
; TLS-LIBCALL-DAG: i32.const tls_external@TLSREL
|
|
; TLS-LIBCALL-NEXT: i32.add
|
|
; TLS-LIBCALL-NEXT: return
|
|
|
|
; NO-TLS-NEXT: i32.const tls_external
|
|
; NO-TLS-NEXT: return
|
|
%p = call ptr @llvm.threadlocal.address.p0(ptr @tls_external)
|
|
%r = ptrtoint ptr %p to i32
|
|
ret i32 %r
|
|
}
|
|
|
|
; CHECK-LABEL: ptr_to_tls:
|
|
; CHECK-NEXT: .functype ptr_to_tls () -> (i32)
|
|
define ptr @ptr_to_tls() {
|
|
; TLS-DAG: global.get __tls_base
|
|
; TLS-DAG: i32.const tls@TLSREL
|
|
; TLS-NEXT: i32.add
|
|
; TLS-NEXT: return
|
|
|
|
; TLS-LIBCALL-DAG: call __wasm_get_tls_base
|
|
; TLS-LIBCALL-DAG: i32.const tls@TLSREL
|
|
; TLS-LIBCALL-NEXT: i32.add
|
|
; TLS-LIBCALL-NEXT: return
|
|
|
|
; NO-TLS-NEXT: i32.const tls
|
|
; NO-TLS-NEXT: return
|
|
%p = call ptr @llvm.threadlocal.address.p0(ptr @tls)
|
|
ret ptr %p
|
|
}
|
|
|
|
; CHECK-LABEL: tls_load:
|
|
; CHECK-NEXT: .functype tls_load () -> (i32)
|
|
define i32 @tls_load() {
|
|
; TLS-DAG: global.get __tls_base
|
|
; TLS-DAG: i32.const tls@TLSREL
|
|
; TLS-NEXT: i32.add
|
|
; TLS-NEXT: i32.load 0
|
|
; TLS-NEXT: return
|
|
|
|
; TLS-LIBCALL-DAG: call __wasm_get_tls_base
|
|
; TLS-LIBCALL-DAG: i32.const tls@TLSREL
|
|
; TLS-LIBCALL-NEXT: i32.add
|
|
; TLS-LIBCALL-NEXT: i32.load 0
|
|
; TLS-LIBCALL-NEXT: return
|
|
|
|
; NO-TLS-NEXT: i32.const 0
|
|
; NO-TLS-NEXT: i32.load tls
|
|
; NO-TLS-NEXT: return
|
|
%p = call ptr @llvm.threadlocal.address.p0(ptr @tls)
|
|
%tmp = load i32, ptr %p, align 4
|
|
ret i32 %tmp
|
|
}
|
|
|
|
; CHECK-LABEL: tls_store:
|
|
; CHECK-NEXT: .functype tls_store (i32) -> ()
|
|
define void @tls_store(i32 %x) {
|
|
; TLS-DAG: global.get __tls_base
|
|
; TLS-DAG: i32.const tls@TLSREL
|
|
; TLS-NEXT: i32.add
|
|
; TLS-NEXT: i32.store 0
|
|
; TLS-NEXT: return
|
|
|
|
; TLS-LIBCALL-DAG: call __wasm_get_tls_base
|
|
; TLS-LIBCALL-DAG: i32.const tls@TLSREL
|
|
; TLS-LIBCALL-NEXT: i32.add
|
|
; TLS-LIBCALL-NEXT: i32.store 0
|
|
; TLS-LIBCALL-NEXT: return
|
|
|
|
; NO-TLS-NEXT: i32.const 0
|
|
; NO-TLS-NEXT: i32.store tls
|
|
; NO-TLS-NEXT: return
|
|
%p = call ptr @llvm.threadlocal.address.p0(ptr @tls)
|
|
store i32 %x, ptr %p, align 4
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: tls_size:
|
|
; CHECK-NEXT: .functype tls_size () -> (i32)
|
|
define i32 @tls_size() {
|
|
; CHECK-NEXT: global.get __tls_size
|
|
; CHECK-NEXT: return
|
|
%1 = call i32 @llvm.wasm.tls.size.i32()
|
|
ret i32 %1
|
|
}
|
|
|
|
; CHECK: .type tls,@object
|
|
; TLS-NEXT: .section .tbss.tls,"T",@
|
|
; TLS-LIBCALL-NEXT: .section .tbss.tls,"T",@
|
|
; NO-TLS-NEXT: .section .bss.tls,"",@
|
|
; CHECK-NEXT: .p2align 2
|
|
; CHECK-NEXT: tls:
|
|
; CHECK-NEXT: .int32 0
|
|
@tls = internal thread_local[[TLS_MODE]] global i32 0
|
|
|
|
@tls_external = external thread_local[[TLS_MODE]] global i32, align 4
|
|
|
|
declare i32 @llvm.wasm.tls.size.i32()
|