From d099bc5829fffce658c7155cb2459b79b45ebbc7 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 1 Apr 2019 16:18:10 +0200 Subject: ac: add 8-bit and 64-bit support to ac_build_bitfield_reverse() Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/common/ac_llvm_build.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/amd/common/ac_llvm_build.c') 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: -- cgit v1.2.3