diff options
author | Samuel Pitoiset <[email protected]> | 2019-11-08 12:44:39 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-11-19 18:01:13 +0000 |
commit | 58d5ab98a3fde7dfafc2d48e91bf29a604e04b3b (patch) | |
tree | d510864f4cd58c69686ac511d6cf45364be2b2e9 | |
parent | 204cf54b70d5a711ab3a18bbcf7fcd169dc34a83 (diff) |
ac: add 8-bit and 16-bit supports to ac_build_shuffle()
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r-- | src/amd/llvm/ac_llvm_build.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c index 8137713d086..f2349018dee 100644 --- a/src/amd/llvm/ac_llvm_build.c +++ b/src/amd/llvm/ac_llvm_build.c @@ -4320,12 +4320,17 @@ ac_build_quad_swizzle(struct ac_llvm_context *ctx, LLVMValueRef src, LLVMValueRef ac_build_shuffle(struct ac_llvm_context *ctx, LLVMValueRef src, LLVMValueRef index) { + LLVMTypeRef type = LLVMTypeOf(src); + LLVMValueRef result; + index = LLVMBuildMul(ctx->builder, index, LLVMConstInt(ctx->i32, 4, 0), ""); - return ac_build_intrinsic(ctx, - "llvm.amdgcn.ds.bpermute", ctx->i32, - (LLVMValueRef []) {index, src}, 2, - AC_FUNC_ATTR_READNONE | - AC_FUNC_ATTR_CONVERGENT); + src = LLVMBuildZExt(ctx->builder, src, ctx->i32, ""); + + result = ac_build_intrinsic(ctx, "llvm.amdgcn.ds.bpermute", ctx->i32, + (LLVMValueRef []) {index, src}, 2, + AC_FUNC_ATTR_READNONE | + AC_FUNC_ATTR_CONVERGENT); + return LLVMBuildTrunc(ctx->builder, result, type, ""); } LLVMValueRef |