diff options
author | Samuel Pitoiset <[email protected]> | 2019-11-08 17:12:15 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-11-19 18:01:13 +0000 |
commit | 21a9243f5e7733c360b6cfd09d81f92a4146d965 (patch) | |
tree | 89f8dd59351bc5b51b8df994bf89e25690f53d22 /src/amd | |
parent | ef352a2466d620e7605502d6f404b17d4bf5ddd5 (diff) |
ac: add 8-bit and 16-bit supports to ac_build_wwm()
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/llvm/ac_llvm_build.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c index 641587051b8..b397f3461de 100644 --- a/src/amd/llvm/ac_llvm_build.c +++ b/src/amd/llvm/ac_llvm_build.c @@ -3864,12 +3864,27 @@ ac_build_ds_swizzle(struct ac_llvm_context *ctx, LLVMValueRef src, unsigned mask static LLVMValueRef ac_build_wwm(struct ac_llvm_context *ctx, LLVMValueRef src) { + LLVMTypeRef src_type = LLVMTypeOf(src); + unsigned bitsize = ac_get_elem_bits(ctx, src_type); char name[32], type[8]; + LLVMValueRef ret; + + src = ac_to_integer(ctx, src); + + if (bitsize < 32) + src = LLVMBuildZExt(ctx->builder, src, ctx->i32, ""); + ac_build_type_name_for_intr(LLVMTypeOf(src), type, sizeof(type)); snprintf(name, sizeof(name), "llvm.amdgcn.wwm.%s", type); - return ac_build_intrinsic(ctx, name, LLVMTypeOf(src), - (LLVMValueRef []) { src }, 1, - AC_FUNC_ATTR_READNONE); + ret = ac_build_intrinsic(ctx, name, LLVMTypeOf(src), + (LLVMValueRef []) { src }, 1, + AC_FUNC_ATTR_READNONE); + + if (bitsize < 32) + ret = LLVMBuildTrunc(ctx->builder, ret, + ac_to_integer_type(ctx, src_type), ""); + + return LLVMBuildBitCast(ctx->builder, ret, src_type, ""); } static LLVMValueRef |