Mesa (master): ac/nir: implement nir_op_[un]pack_[64/32]_*

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 22 02:55:24 UTC 2020


Module: Mesa
Branch: master
Commit: 581a3516dc1109785bf019e24c4fdb2c84df727d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=581a3516dc1109785bf019e24c4fdb2c84df727d

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Mon Aug 31 17:34:02 2020 +0100

ac/nir: implement nir_op_[un]pack_[64/32]_*

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6622>

---

 src/amd/llvm/ac_nir_to_llvm.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index b50314dec47..c86339205ee 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -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, "");



More information about the mesa-commit mailing list