From b8a51c8c4bc9b8d36bda2083bffeaa044f5aaad4 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Tue, 6 Jun 2017 16:40:26 -0700 Subject: radeonsi: move the guts of ARB_shader_group_vote emission to ac MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Nicolai Hähnle Reviewed-by: Marek Olšák Signed-off-by: Dave Airlie --- src/amd/common/ac_llvm_build.c | 30 ++++++++++++++++++++++++++++++ src/amd/common/ac_llvm_build.h | 6 ++++++ 2 files changed, 36 insertions(+) (limited to 'src/amd') diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index ab93aa25d2..a765c0d750 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -269,6 +269,36 @@ ac_build_ballot(struct ac_llvm_context *ctx, AC_FUNC_ATTR_CONVERGENT); } +LLVMValueRef +ac_build_vote_all(struct ac_llvm_context *ctx, LLVMValueRef value) +{ + LLVMValueRef active_set = ac_build_ballot(ctx, ctx->i32_1); + LLVMValueRef vote_set = ac_build_ballot(ctx, value); + return LLVMBuildICmp(ctx->builder, LLVMIntEQ, vote_set, active_set, ""); +} + +LLVMValueRef +ac_build_vote_any(struct ac_llvm_context *ctx, LLVMValueRef value) +{ + LLVMValueRef vote_set = ac_build_ballot(ctx, value); + return LLVMBuildICmp(ctx->builder, LLVMIntNE, vote_set, + LLVMConstInt(ctx->i64, 0, 0), ""); +} + +LLVMValueRef +ac_build_vote_eq(struct ac_llvm_context *ctx, LLVMValueRef value) +{ + LLVMValueRef active_set = ac_build_ballot(ctx, ctx->i32_1); + LLVMValueRef vote_set = ac_build_ballot(ctx, value); + + LLVMValueRef all = LLVMBuildICmp(ctx->builder, LLVMIntEQ, + vote_set, active_set, ""); + LLVMValueRef none = LLVMBuildICmp(ctx->builder, LLVMIntEQ, + vote_set, + LLVMConstInt(ctx->i64, 0, 0), ""); + return LLVMBuildOr(ctx->builder, all, none, ""); +} + LLVMValueRef ac_build_gather_values_extended(struct ac_llvm_context *ctx, LLVMValueRef *values, diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index 8369e59f28..323fd3a1fb 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -80,6 +80,12 @@ void ac_build_optimization_barrier(struct ac_llvm_context *ctx, LLVMValueRef ac_build_ballot(struct ac_llvm_context *ctx, LLVMValueRef value); +LLVMValueRef ac_build_vote_all(struct ac_llvm_context *ctx, LLVMValueRef value); + +LLVMValueRef ac_build_vote_any(struct ac_llvm_context *ctx, LLVMValueRef value); + +LLVMValueRef ac_build_vote_eq(struct ac_llvm_context *ctx, LLVMValueRef value); + LLVMValueRef ac_build_gather_values_extended(struct ac_llvm_context *ctx, LLVMValueRef *values, -- cgit v1.2.3