summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_llvm_build.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-04-01 16:18:10 +0200
committerSamuel Pitoiset <[email protected]>2019-04-01 18:53:57 +0200
commitd099bc5829fffce658c7155cb2459b79b45ebbc7 (patch)
tree9c56d15f0b8597e2074a033667464637057f052b /src/amd/common/ac_llvm_build.c
parent2cecf6c5cc3d64e40eb3b785a8174b33e8df7563 (diff)
ac: add 8-bit and 64-bit support to ac_build_bitfield_reverse()
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/common/ac_llvm_build.c')
-rw-r--r--src/amd/common/ac_llvm_build.c14
1 files changed, 14 insertions, 0 deletions
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,
@@ -2597,6 +2604,13 @@ LLVMValueRef ac_build_bitfield_reverse(struct ac_llvm_context *ctx,
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:
unreachable(!"invalid bitsize");
break;