diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-03-30 14:10:44 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2018-03-14 09:04:01 +0100 |
commit | 5e349757d5d9ebad3825ee826ce66cfb04e2a054 (patch) | |
tree | ce693a0308930d0bd79696c0f61cb07e34420859 | |
parent | ee4e07eaa5d3f5cbbaec4a36835c973a4b4c57aa (diff) |
ac: add ac_get_exec_mask helper function
TODO: this needs an optimization barrier to prevent hoisting / speculating
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 14 | ||||
-rw-r--r-- | src/amd/common/ac_llvm_build.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 1ae2b9dd17..a3afcb3586 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -1121,6 +1121,20 @@ ac_get_thread_id(struct ac_llvm_context *ctx) return tid; } +LLVMValueRef +ac_get_exec_mask(struct ac_llvm_context *ctx) +{ + LLVMContextRef context = ctx->context; + LLVMValueRef md_exec; + LLVMValueRef args[1]; + + md_exec = LLVMMDStringInContext(context, "exec", 4); + args[0] = LLVMMDNodeInContext(context, &md_exec, 1); + + return ac_build_intrinsic(ctx, "llvm.read_register.i64", ctx->i64, + args, 1, AC_FUNC_ATTR_READONLY); +} + /* * SI implements derivatives using the local data store (LDS) * All writes to the LDS happen in all executing threads at diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index 6adcc11448..bfbbe1b8d7 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -245,6 +245,9 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef ac_get_thread_id(struct ac_llvm_context *ctx); +LLVMValueRef +ac_get_exec_mask(struct ac_llvm_context *ctx); + #define AC_TID_MASK_TOP_LEFT 0xfffffffc #define AC_TID_MASK_TOP 0xfffffffd #define AC_TID_MASK_LEFT 0xfffffffe |