<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">---<br>
 src/compiler/spirv/vtn_alu.c | 31 ++++++++++++++++++++++--------<wbr>-<br>
 1 file changed, 22 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c<br>
index 3134849ba9..3708a9dc0c 100644<br>
--- a/src/compiler/spirv/vtn_alu.c<br>
+++ b/src/compiler/spirv/vtn_alu.c<br>
@@ -251,10 +251,17 @@ vtn_handle_bitcast(struct vtn_builder *b, struct vtn_ssa_value *dest,<br>
       vtn_assert(src_bit_size % dest_bit_size == 0);<br>
       unsigned divisor = src_bit_size / dest_bit_size;<br>
       for (unsigned comp = 0; comp < src_components; comp++) {<br>
-         vtn_assert(src_bit_size == 64);<br>
-         vtn_assert(dest_bit_size == 32);<br>
-         nir_ssa_def *split =<br>
-            nir_unpack_64_2x32(&b->nb, nir_channel(&b->nb, src, comp));<br>
+         nir_ssa_def *split;<br>
+         if (src_bit_size == 64) {<br>
+            assert(dest_bit_size == 32 || dest_bit_size == 16);<br>
+            split = dest_bit_size == 32 ?<br>
+               nir_unpack_64_2x32(&b->nb, nir_channel(&b->nb, src, comp)) :<br>
+               nir_unpack_64_4x16(&b->nb, nir_channel(&b->nb, src, comp));<br>
+         } else {<br>
+            vtn_assert(src_bit_size == 32);<br>
+            vtn_assert(dest_bit_size == 16);<br>
+            split = nir_unpack_32_2x16(&b->nb, nir_channel(&b->nb, src, comp));<br>
+         }<br>
          for (unsigned i = 0; i < divisor; i++)<br>
             dest_chan[divisor * comp + i] = nir_channel(&b->nb, split, i);<br>
       }<br>
@@ -263,11 +270,17 @@ vtn_handle_bitcast(struct vtn_builder *b, struct vtn_ssa_value *dest,<br>
       unsigned divisor = dest_bit_size / src_bit_size;<br>
       for (unsigned comp = 0; comp < dest_components; comp++) {<br>
          unsigned channels = ((1 << divisor) - 1) << (comp * divisor);<br>
-         nir_ssa_def *src_chan =<br>
-            nir_channels(&b->nb, src, channels);<br>
-         vtn_assert(dest_bit_size == 64);<br>
-         vtn_assert(src_bit_size == 32);<br>
-         dest_chan[comp] = nir_pack_64_2x32(&b->nb, src_chan);<br>
+         nir_ssa_def *src_chan = nir_channels(&b->nb, src, channels);<br>
+         if (dest_bit_size == 64) {<br>
+            assert(src_bit_size == 32 || src_bit_size == 16);<br>
+            dest_chan[comp] = src_bit_size == 32 ?<br>
+               nir_pack_64_2x32(&b->nb, src_chan) :<br>
+               nir_pack_64_4x16(&b->nb, src_chan);<br>
+         } else {<br>
+            vtn_assert(dest_bit_size == 32);<br>
+            vtn_assert(src_bit_size == 16);<br>
+            dest_chan[comp] = nir_pack_32_2x16(&b->nb, src_chan);<br>
+         }<br>
       }<br>
    }<br>
    dest->def = nir_vec(&b->nb, dest_chan, dest_components);<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.14.1<br>
<br>
</font></span></blockquote></div><br></div>