diff options
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 14 |
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; |