Mesa (master): ac/nir: remove the bitfield_extract workaround for LLVM 8

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 20 08:41:58 UTC 2018


Module: Mesa
Branch: master
Commit: 576040f2e52cd70f1fe76e2639e5f8e2b2e825f0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=576040f2e52cd70f1fe76e2639e5f8e2b2e825f0

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Dec 19 17:52:54 2018 +0100

ac/nir: remove the bitfield_extract workaround for LLVM 8

This workaround has been introduced by 3d41757788a and it
is no longer needed since LLVM r346422.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/amd/common/ac_nir_to_llvm.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 225c930d89..81b76f65b8 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -429,16 +429,22 @@ static LLVMValueRef emit_bitfield_extract(struct ac_llvm_context *ctx,
 {
 	LLVMValueRef result;
 
-	/* FIXME: LLVM 7+ returns incorrect result when count is 0.
-	 * https://bugs.freedesktop.org/show_bug.cgi?id=107276
-	 */
-	LLVMValueRef zero = ctx->i32_0;
-	LLVMValueRef icond1 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), "");
-	LLVMValueRef icond2 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], zero, "");
+	if (HAVE_LLVM >= 0x0800) {
+		LLVMValueRef icond = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), "");
+		result = ac_build_bfe(ctx, srcs[0], srcs[1], srcs[2], is_signed);
+		result = LLVMBuildSelect(ctx->builder, icond, srcs[0], result, "");
+	} else {
+		/* FIXME: LLVM 7+ returns incorrect result when count is 0.
+		 * https://bugs.freedesktop.org/show_bug.cgi?id=107276
+		 */
+		LLVMValueRef zero = ctx->i32_0;
+		LLVMValueRef icond1 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), "");
+		LLVMValueRef icond2 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], zero, "");
 
-	result = ac_build_bfe(ctx, srcs[0], srcs[1], srcs[2], is_signed);
-	result = LLVMBuildSelect(ctx->builder, icond1, srcs[0], result, "");
-	result = LLVMBuildSelect(ctx->builder, icond2, zero, result, "");
+		result = ac_build_bfe(ctx, srcs[0], srcs[1], srcs[2], is_signed);
+		result = LLVMBuildSelect(ctx->builder, icond1, srcs[0], result, "");
+		result = LLVMBuildSelect(ctx->builder, icond2, zero, result, "");
+	}
 
 	return result;
 }




More information about the mesa-commit mailing list