summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/amd/common/ac_llvm_build.c14
-rw-r--r--src/amd/common/ac_llvm_build.h3
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