<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 30, 2018 at 7:18 AM, Iago Toral Quiroga <span dir="ltr"><<a href="mailto:itoral@igalia.com" target="_blank">itoral@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Noitice that we don't need 'split' versions of the 64-bit to / from<br>
16-bit opcodes which we require during pack lowering to implement these<br>
operations. This is because these operations can be expressed as a<br>
collection of 32-bit from / to 16-bit and 64-bit to / from 32-bit<br>
operations, so we don't need new opcodes specifically for them.<br>
---<br>
 src/compiler/nir/nir_opcodes.<wbr>py | 19 +++++++++++++++++++<br>
 1 file changed, 19 insertions(+)<br>
<br>
diff --git a/src/compiler/nir/nir_<wbr>opcodes.py b/src/compiler/nir/nir_<wbr>opcodes.py<br>
index 89a6c6becc..3c3316dcaa 100644<br>
--- a/src/compiler/nir/nir_<wbr>opcodes.py<br>
+++ b/src/compiler/nir/nir_<wbr>opcodes.py<br>
@@ -91,6 +91,7 @@ tfloat = "float"<br>
 tint = "int"<br>
 tbool = "bool32"<br>
 tuint = "uint"<br>
+tuint16 = "uint16"<br>
 tfloat32 = "float32"<br>
 tint32 = "int32"<br>
 tuint32 = "uint32"<br>
@@ -282,12 +283,24 @@ dst.x = (src0.x <<  0) |<br>
         (src0.w << 24);<br>
 """)<br>
<br>
+unop_horiz("pack_32_2x16", 1, tuint32, 2, tuint16,<br>
+           "dst.x = src0.x | ((uint32_t)src0.y << 16);")<br>
+<br>
 unop_horiz("pack_64_2x32", 1, tuint64, 2, tuint32,<br>
            "dst.x = src0.x | ((uint64_t)src0.y << 32);")<br>
<br>
+unop_horiz("pack_64_4x16", 1, tuint64, 4, tuint16,<br>
+           "dst.x = src0.x | ((uint64_t)src0.y << 16) | ((uint64_t)src0.z << 32) | ((uint64_t)src0.w << 48);")<br>
+<br>
 unop_horiz("unpack_64_2x32", 2, tuint32, 1, tuint64,<br>
            "dst.x = src0.x; dst.y = src0.x >> 32;")<br>
<br>
+unop_horiz("unpack_64_4x16", 4, tuint16, 1, tuint64,<br>
+           "dst.x = src0.x; dst.y = src0.x >> 16; dst.z = src0.x >> 32; dst.w = src0.w >> 48;")<br>
+<br>
+unop_horiz("unpack_32_2x16", 2, tuint16, 1, tuint32,<br>
+           "dst.x = src0.x; dst.y = src0.x >> 16;")<br>
+<br>
 # Lowered floating point unpacking operations.<br>
<br>
<br>
@@ -296,6 +309,9 @@ unop_horiz("unpack_half_2x16_<wbr>split_x", 1, tfloat32, 1, tuint32,<br>
 unop_horiz("unpack_half_2x16_<wbr>split_y", 1, tfloat32, 1, tuint32,<br>
            "unpack_half_1x16((uint16_t)(<wbr>src0.x >> 16))")<br>
<br>
+unop_convert("unpack_32_2x16_<wbr>split_x", tuint16, tuint32, "src0")<br>
+unop_convert("unpack_32_2x16_<wbr>split_y", tuint16, tuint32, "src0 >> 16")<br>
+<br>
 unop_convert("unpack_64_2x32_<wbr>split_x", tuint32, tuint64, "src0")<br>
 unop_convert("unpack_64_2x32_<wbr>split_y", tuint32, tuint64, "src0 >> 32")<br>
<br>
@@ -608,6 +624,9 @@ binop_horiz("pack_half_2x16_<wbr>split", 1, tuint32, 1, tfloat32, 1, tfloat32,<br>
 binop_convert("pack_64_2x32_<wbr>split", tuint64, tuint32, "",<br>
               "src0 | ((uint64_t)src1 << 32)")<br>
<br>
+binop_convert("pack_32_2x16_<wbr>split", tuint32, tuint16, "",<br>
+              "src0 | ((uint32_t)src1 << 16)")<br>
+<br>
 # bfm implements the behavior of the first operation of the SM5 "bfi" assembly<br>
 # and that of the "bfi1" i965 instruction. That is, it has undefined behavior<br>
 # if either of its arguments are 32.<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.14.1<br>
<br>
</font></span></blockquote></div><br></div>