From: Samuel Pitoiset Date: Fri, 8 Nov 2019 16:12:39 +0000 (+0100) Subject: ac: add 8-bit and 16-bit supports to ac_build_optimization_barrier() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=670aa24c6982f1d503d065f2e8c9c7757d6c1f1c;p=mesa.git ac: add 8-bit and 16-bit supports to ac_build_optimization_barrier() Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c index b397f3461de..d97dd36480a 100644 --- a/src/amd/llvm/ac_llvm_build.c +++ b/src/amd/llvm/ac_llvm_build.c @@ -432,11 +432,19 @@ ac_build_optimization_barrier(struct ac_llvm_context *ctx, } else { LLVMTypeRef ftype = LLVMFunctionType(ctx->i32, &ctx->i32, 1, false); LLVMValueRef inlineasm = LLVMConstInlineAsm(ftype, code, "=v,0", true, false); + LLVMTypeRef type = LLVMTypeOf(*pvgpr); + unsigned bitsize = ac_get_elem_bits(ctx, type); LLVMValueRef vgpr = *pvgpr; - LLVMTypeRef vgpr_type = LLVMTypeOf(vgpr); - unsigned vgpr_size = ac_get_type_size(vgpr_type); + LLVMTypeRef vgpr_type; + unsigned vgpr_size; LLVMValueRef vgpr0; + if (bitsize < 32) + vgpr = LLVMBuildZExt(ctx->builder, vgpr, ctx->i32, ""); + + vgpr_type = LLVMTypeOf(vgpr); + vgpr_size = ac_get_type_size(vgpr_type); + assert(vgpr_size % 4 == 0); vgpr = LLVMBuildBitCast(builder, vgpr, LLVMVectorType(ctx->i32, vgpr_size / 4), ""); @@ -445,6 +453,9 @@ ac_build_optimization_barrier(struct ac_llvm_context *ctx, vgpr = LLVMBuildInsertElement(builder, vgpr, vgpr0, ctx->i32_0, ""); vgpr = LLVMBuildBitCast(builder, vgpr, vgpr_type, ""); + if (bitsize < 32) + vgpr = LLVMBuildTrunc(builder, vgpr, type, ""); + *pvgpr = vgpr; } }