From 059f870d74e90835361e4b8a5596c9aacd979c07 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 3 Mar 2022 13:08:17 +0100 Subject: [PATCH] ac/nir: implement nir_op_pack_{uint,sint}_2x16 Signed-off-by: Samuel Pitoiset Reviewed-by: Rhys Perry Part-of: --- src/amd/llvm/ac_nir_to_llvm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 5b3a67b1907..67d0ebfa55f 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -578,6 +578,8 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) case nir_op_pack_half_2x16: case nir_op_pack_snorm_2x16: case nir_op_pack_unorm_2x16: + case nir_op_pack_uint_2x16: + case nir_op_pack_sint_2x16: case nir_op_pack_32_2x16: case nir_op_pack_64_2x32: src_components = 2; @@ -1123,6 +1125,24 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) case nir_op_pack_unorm_2x16: result = emit_pack_2x16(&ctx->ac, src[0], ac_build_cvt_pknorm_u16); break; + case nir_op_pack_uint_2x16: { + LLVMValueRef comp[2]; + + comp[0] = LLVMBuildExtractElement(ctx->ac.builder, src[0], ctx->ac.i32_0, ""); + comp[1] = LLVMBuildExtractElement(ctx->ac.builder, src[0], ctx->ac.i32_1, ""); + + result = ac_build_cvt_pk_u16(&ctx->ac, comp, 16, false); + break; + } + case nir_op_pack_sint_2x16: { + LLVMValueRef comp[2]; + + comp[0] = LLVMBuildExtractElement(ctx->ac.builder, src[0], ctx->ac.i32_0, ""); + comp[1] = LLVMBuildExtractElement(ctx->ac.builder, src[0], ctx->ac.i32_1, ""); + + result = ac_build_cvt_pk_i16(&ctx->ac, comp, 16, false); + break; + } case nir_op_unpack_half_2x16: result = emit_unpack_half_2x16(&ctx->ac, src[0]); break;