[Mesa-dev] [PATCH 1/3] radeon/ac/llvm: add support for sendmsg emission
Dave Airlie
airlied at gmail.com
Mon Feb 13 22:15:07 UTC 2017
From: Dave Airlie <airlied at redhat.com>
This lets us use the new intrinsic on the correct
version of llvm.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/amd/common/ac_llvm_build.c | 13 +++++++++++++
src/amd/common/ac_llvm_build.h | 12 ++++++++++++
2 files changed, 25 insertions(+)
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index afcbf31..20216a7 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -750,3 +750,16 @@ ac_emit_ddxy(struct ac_llvm_context *ctx,
result = LLVMBuildFSub(ctx->builder, trbl, tl, "");
return result;
}
+
+void
+ac_emit_sendmsg(struct ac_llvm_context *ctx,
+ uint32_t msg,
+ LLVMValueRef wave_id)
+{
+ LLVMValueRef args[2];
+ const char *intr_name = (HAVE_LLVM < 0x0400) ? "llvm.SI.sendmsg" : "llvm.amdgcn.s.sendmsg";
+ args[0] = LLVMConstInt(ctx->i32, msg, false);
+ args[1] = wave_id;
+ ac_emit_llvm_intrinsic(ctx, intr_name, ctx->voidt,
+ args, 2, 0);
+}
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index 37a5bea..e88874a 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -170,6 +170,18 @@ ac_emit_ddxy(struct ac_llvm_context *ctx,
LLVMValueRef lds,
LLVMValueRef val);
+#define AC_SENDMSG_GS 2
+#define AC_SENDMSG_GS_DONE 3
+
+#define AC_SENDMSG_GS_OP_NOP (0 << 4)
+#define AC_SENDMSG_GS_OP_CUT (1 << 4)
+#define AC_SENDMSG_GS_OP_EMIT (2 << 4)
+#define AC_SENDMSG_GS_OP_EMIT_CUT (3 << 4)
+
+void ac_emit_sendmsg(struct ac_llvm_context *ctx,
+ uint32_t msg,
+ LLVMValueRef wave_id);
+
#ifdef __cplusplus
}
#endif
--
2.7.4
More information about the mesa-dev
mailing list