[Mesa-dev] [PATCH 5/6] ac: add 8-bit and 64-bit support to ac_build_bitfield_reverse()

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Apr 1 14:18:10 UTC 2019


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/common/ac_llvm_build.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 8d749cc8eb0..54e90288bda 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -2585,6 +2585,13 @@ LLVMValueRef ac_build_bitfield_reverse(struct ac_llvm_context *ctx,
 	bitsize = ac_get_elem_bits(ctx, LLVMTypeOf(src0));
 
 	switch (bitsize) {
+	case 64:
+		result = ac_build_intrinsic(ctx, "llvm.bitreverse.i64", ctx->i64,
+					    (LLVMValueRef []) { src0 }, 1,
+					    AC_FUNC_ATTR_READNONE);
+
+		result = LLVMBuildTrunc(ctx->builder, result, ctx->i32, "");
+		break;
 	case 32:
 		result = ac_build_intrinsic(ctx, "llvm.bitreverse.i32", ctx->i32,
 					    (LLVMValueRef []) { src0 }, 1,
@@ -2595,6 +2602,13 @@ LLVMValueRef ac_build_bitfield_reverse(struct ac_llvm_context *ctx,
 					    (LLVMValueRef []) { src0 }, 1,
 					    AC_FUNC_ATTR_READNONE);
 
+		result = LLVMBuildZExt(ctx->builder, result, ctx->i32, "");
+		break;
+	case 8:
+		result = ac_build_intrinsic(ctx, "llvm.bitreverse.i8", ctx->i8,
+					    (LLVMValueRef []) { src0 }, 1,
+					    AC_FUNC_ATTR_READNONE);
+
 		result = LLVMBuildZExt(ctx->builder, result, ctx->i32, "");
 		break;
 	default:
-- 
2.21.0



More information about the mesa-dev mailing list