<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jun 9, 2018 at 4:13 AM, Jose Maria Casanova Crespo <span dir="ltr"><<a href="mailto:jmcasanova@igalia.com" target="_blank">jmcasanova@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">These new shuffle functions deal with the shuffle/unshuffle operations<br>
needed for read/write operations using 32-bit components when the<br>
read/written components have a different bit-size (8, 16, 64-bits).<br>
Shuffle from 32-bit to 32-bit becomes a simple MOV.<br>
<br>
As the new function shuffle_src_to_dst takes of doing a shuffle or an<br>
unshuffle based on the different type_sz of source an destination this<br>
generic functions work with any source/destination assuming that writes<br>
use a 32-bit destination or reads use a 32-bit source.<br></blockquote><div><br></div><div>I'm having a lot of trouble understanding this paragraph.  Would you mind rephrasing it?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
To enable this new functions it is needed than there is no<br>
source/destination overlap in the case of shuffle_from_32bit_read.<br>
That never happens on shuffle_for_32bit_write as it allocates a new<br>
destination register as it was at shuffle_64bit_data_for_32bit_<wbr>write.<br>
---<br>
 src/intel/compiler/brw_fs.h       | 11 +++++++++<br>
 src/intel/compiler/brw_fs_nir.<wbr>cpp | 38 ++++++++++++++++++++++++++++++<wbr>+<br>
 2 files changed, 49 insertions(+)<br>
<br>
diff --git a/src/intel/compiler/brw_fs.h b/src/intel/compiler/brw_fs.h<br>
index faf51568637..779170ecc95 100644<br>
--- a/src/intel/compiler/brw_fs.h<br>
+++ b/src/intel/compiler/brw_fs.h<br>
@@ -519,6 +519,17 @@ void shuffle_16bit_data_for_32bit_<wbr>write(const brw::fs_builder &bld,<br>
                                         const fs_reg &src,<br>
                                         uint32_t components);<br>
<br>
+void shuffle_from_32bit_read(const brw::fs_builder &bld,<br>
+                             const fs_reg &dst,<br>
+                             const fs_reg &src,<br>
+                             uint32_t first_component,<br>
+                             uint32_t components);<br>
+<br>
+fs_reg shuffle_for_32bit_write(const brw::fs_builder &bld,<br>
+                               const fs_reg &src,<br>
+                               uint32_t first_component,<br>
+                               uint32_t components);<br>
+<br>
 fs_reg setup_imm_df(const brw::fs_builder &bld,<br>
                     double v);<br>
<br>
diff --git a/src/intel/compiler/brw_fs_<wbr>nir.cpp b/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
index 1a9d3c41d1d..1f684149fd5 100644<br>
--- a/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
+++ b/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
@@ -5454,6 +5454,44 @@ shuffle_src_to_dst(const fs_builder &bld,<br>
    }<br>
 }<br>
<br>
+void<br>
+shuffle_from_32bit_read(const fs_builder &bld,<br>
+                        const fs_reg &dst,<br>
+                        const fs_reg &src,<br>
+                        uint32_t first_component,<br>
+                        uint32_t components)<br>
+{<br>
+   assert(type_sz(src.type) == 4);<br>
+<br></blockquote><div><br></div><div>/* This function takes components in units of the destination type while shuffle_src_to_dst takes components in units of the smallest type */<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   if (type_sz(dst.type) > 4) {<br>
+      assert(type_sz(dst.type) == 8);<br>
+      first_component *= 2;<br>
+      components *= 2;<br>
+   }<br>
+<br>
+   shuffle_src_to_dst(bld, dst, src, first_component, components);<br>
+}<br>
+<br>
+fs_reg<br>
+shuffle_for_32bit_write(const fs_builder &bld,<br>
+                        const fs_reg &src,<br>
+                        uint32_t first_component,<br>
+                        uint32_t components)<br>
+{<br>
+   fs_reg dst = bld.vgrf(BRW_REGISTER_TYPE_D,<br>
+                         DIV_ROUND_UP (components * type_sz(src.type), 4));<br>
+<br></blockquote><div><br></div><div>/* This function takes components in units of the source type while
 shuffle_src_to_dst takes components in units of the smallest type */</div><div><br></div><div>With those added and the commit message re-worded a bit,<br></div><div><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   if (type_sz(src.type) > 4) {<br>
+      assert(type_sz(src.type) == 8);<br>
+      first_component *= 2;<br>
+      components *= 2;<br>
+   }<br>
+<br>
+   shuffle_src_to_dst(bld, dst, src, first_component, components);<br>
+<br>
+   return dst;<br>
+}<br>
+<br>
 fs_reg<br>
 setup_imm_df(const fs_builder &bld, double v)<br>
 {<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.17.1<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>