diff options
author | Samuel Pitoiset <[email protected]> | 2019-11-08 17:12:39 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-11-19 18:01:13 +0000 |
commit | 670aa24c6982f1d503d065f2e8c9c7757d6c1f1c (patch) | |
tree | 61e9186c6031dafddfe63b7cc410fe2f62ec71d4 /src/amd/llvm | |
parent | 21a9243f5e7733c360b6cfd09d81f92a4146d965 (diff) |
ac: add 8-bit and 16-bit supports to ac_build_optimization_barrier()
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/llvm')
-rw-r--r-- | src/amd/llvm/ac_llvm_build.c | 15 |
1 files changed, 13 insertions, 2 deletions
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; } } |