<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 11, 2018 at 12:20 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/intel/compiler/brw_fs_nir.<wbr>cpp | 16 +++++++++++-----<br>
 1 file changed, 11 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/intel/compiler/brw_fs_<wbr>nir.cpp b/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
index 5c414e45b61..ad31f7c82dc 100644<br>
--- a/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
+++ b/src/intel/compiler/brw_fs_<wbr>nir.cpp<br>
@@ -1162,8 +1162,9 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
       break;<br>
<br>
    case nir_op_i2b:<br>
-   case nir_op_f2b:<br>
-      if (nir_src_bit_size(instr->src[<wbr>0].src) == 64) {<br>
+   case nir_op_f2b: {<br>
+      uint32_t bit_size = nir_src_bit_size(instr->src[0]<wbr>.src);<br>
+      if (bit_size == 64) {<br>
          /* two-argument instructions can't take 64-bit immediates */<br>
          fs_reg zero;<br>
          fs_reg tmp;<br>
@@ -1185,13 +1186,18 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
          bld.CMP(tmp, op[0], zero, BRW_CONDITIONAL_NZ);<br>
          bld.MOV(result, subscript(tmp, BRW_REGISTER_TYPE_UD, 0));<br>
       } else {<br>
-         if (instr->op == nir_op_f2b) {<br>
-            bld.CMP(result, op[0], brw_imm_f(0.0f), BRW_CONDITIONAL_NZ);<br>
+         fs_reg zero;<br>
+         if (bit_size == 32) {<br>
+            zero = instr->op == nir_op_f2b ? brw_imm_f(0.0f) : brw_imm_d(0);<br>
          } else {<br>
-            bld.CMP(result, op[0], brw_imm_d(0), BRW_CONDITIONAL_NZ);<br>
+            assert(bit_size == 16);<br>
+            zero = instr->op == nir_op_f2b ?<br>
+               retype(brw_imm_w(0), BRW_REGISTER_TYPE_HF) : brw_imm_w(0);<br></blockquote><div><br></div><div>I really wish there were some better way of building immediates. Oh, well, we can fix that later.<br><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">
          }<br>
+         bld.CMP(result, op[0], zero, BRW_CONDITIONAL_NZ);<br>
       }<br>
       break;<br>
+   }<br>
<br>
    case nir_op_ftrunc:<br>
       inst = bld.RNDZ(result, op[0]);<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.14.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>