radeon/ac/llvm: add support for sendmsg emission
authorDave Airlie <airlied@redhat.com>
Mon, 13 Feb 2017 22:08:30 +0000 (22:08 +0000)
committerDave Airlie <airlied@redhat.com>
Tue, 14 Feb 2017 00:02:50 +0000 (00:02 +0000)
This lets us use the new intrinsic on the correct
version of llvm.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_llvm_build.c
src/amd/common/ac_llvm_build.h

index afcbf3199951f08ba3e9982c1819229c15b7a1c4..20216a749470ada9be3f9a2d2be53296a2e95a80 100644 (file)
@@ -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);
+}
index 37a5bea3f06b622f46a86f067cf2b107e0e22be2..e88874ad46b9a3bd8c2b87b7f68a8dd68725646b 100644 (file)
@@ -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