mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 14:30:10 +01:00
ac/nir: implement nir_op_[un]pack_[64/32]_*
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6622>
This commit is contained in:
parent
3022cf3bac
commit
581a3516dc
1 changed files with 28 additions and 2 deletions
|
|
@ -585,11 +585,16 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
|
|||
case nir_op_vec2:
|
||||
case nir_op_vec3:
|
||||
case nir_op_vec4:
|
||||
case nir_op_unpack_32_2x16:
|
||||
case nir_op_unpack_64_2x32:
|
||||
case nir_op_unpack_64_4x16:
|
||||
src_components = 1;
|
||||
break;
|
||||
case nir_op_pack_half_2x16:
|
||||
case nir_op_pack_snorm_2x16:
|
||||
case nir_op_pack_unorm_2x16:
|
||||
case nir_op_pack_32_2x16:
|
||||
case nir_op_pack_64_2x32:
|
||||
src_components = 2;
|
||||
break;
|
||||
case nir_op_unpack_half_2x16:
|
||||
|
|
@ -599,6 +604,9 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
|
|||
case nir_op_cube_face_index:
|
||||
src_components = 3;
|
||||
break;
|
||||
case nir_op_pack_64_4x16:
|
||||
src_components = 4;
|
||||
break;
|
||||
default:
|
||||
src_components = num_components;
|
||||
break;
|
||||
|
|
@ -1057,13 +1065,17 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
|
|||
result = emit_ddxy(ctx, instr->op, src[0]);
|
||||
break;
|
||||
|
||||
case nir_op_unpack_64_2x32: {
|
||||
result = LLVMBuildBitCast(ctx->ac.builder, src[0],
|
||||
ctx->ac.v2i32, "");
|
||||
break;
|
||||
}
|
||||
case nir_op_unpack_64_2x32_split_x: {
|
||||
assert(ac_get_llvm_num_components(src[0]) == 1);
|
||||
LLVMValueRef tmp = LLVMBuildBitCast(ctx->ac.builder, src[0], ctx->ac.v2i32, "");
|
||||
result = LLVMBuildExtractElement(ctx->ac.builder, tmp, ctx->ac.i32_0, "");
|
||||
break;
|
||||
}
|
||||
|
||||
case nir_op_unpack_64_2x32_split_y: {
|
||||
assert(ac_get_llvm_num_components(src[0]) == 1);
|
||||
LLVMValueRef tmp = LLVMBuildBitCast(ctx->ac.builder, src[0], ctx->ac.v2i32, "");
|
||||
|
|
@ -1071,24 +1083,38 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
|
|||
break;
|
||||
}
|
||||
|
||||
case nir_op_pack_64_2x32: {
|
||||
result = LLVMBuildBitCast(ctx->ac.builder, src[0],
|
||||
ctx->ac.i64, "");
|
||||
break;
|
||||
}
|
||||
case nir_op_pack_64_2x32_split: {
|
||||
LLVMValueRef tmp = ac_build_gather_values(&ctx->ac, src, 2);
|
||||
result = LLVMBuildBitCast(ctx->ac.builder, tmp, ctx->ac.i64, "");
|
||||
break;
|
||||
}
|
||||
|
||||
case nir_op_pack_32_2x16: {
|
||||
result = LLVMBuildBitCast(ctx->ac.builder, src[0],
|
||||
ctx->ac.i32, "");
|
||||
break;
|
||||
}
|
||||
case nir_op_pack_32_2x16_split: {
|
||||
LLVMValueRef tmp = ac_build_gather_values(&ctx->ac, src, 2);
|
||||
result = LLVMBuildBitCast(ctx->ac.builder, tmp, ctx->ac.i32, "");
|
||||
break;
|
||||
}
|
||||
|
||||
case nir_op_unpack_32_2x16: {
|
||||
result = LLVMBuildBitCast(ctx->ac.builder, src[0],
|
||||
ctx->ac.v2i16, "");
|
||||
break;
|
||||
}
|
||||
case nir_op_unpack_32_2x16_split_x: {
|
||||
LLVMValueRef tmp = LLVMBuildBitCast(ctx->ac.builder, src[0], ctx->ac.v2i16, "");
|
||||
result = LLVMBuildExtractElement(ctx->ac.builder, tmp, ctx->ac.i32_0, "");
|
||||
break;
|
||||
}
|
||||
|
||||
case nir_op_unpack_32_2x16_split_y: {
|
||||
LLVMValueRef tmp = LLVMBuildBitCast(ctx->ac.builder, src[0], ctx->ac.v2i16, "");
|
||||
result = LLVMBuildExtractElement(ctx->ac.builder, tmp, ctx->ac.i32_1, "");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue