<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<div dir="auto">
<div dir="auto"><br></div><div dir="auto"><br></div>
<div id="aqm-original" style="color: black;">
<!-- body start -->
<div style="text-align:left; direction:ltr;" class="aqm-original-body"><div style="color: black;">
<p style="color: black; font-size: 10pt; font-family: sans-serif; margin: 8pt 0;">On January 18, 209 01:56:05 Iago Toral <itoral@igalia.com> wrote:</p>
<blockquote type="cite" class="gmail_quote" style="margin: 0 0 0 0.75ex; border-left: 1px solid #808080; padding-left: 0.75ex;">
<div>On Thu, 2019-01-17 at 13:55 -0600, Jason Ekstrand wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Jan 15, 2019 at 7:54 AM Iago Toral Quiroga <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> wrote:<br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">v2:<br>
 - make 16-bit be its own separate case (Jason)<br>
<br>
Reviewed-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com" target="_blank">topi.pohjolainen@intel.com</a>><br>
---<br>
 src/intel/compiler/brw_fs_nir.cpp | 18 +++++++++++++++++-<br>
 1 file changed, 17 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp<br>
index d742f55a957..cf546b8ff09 100644<br>
--- a/src/intel/compiler/brw_fs_nir.cpp<br>
+++ b/src/intel/compiler/brw_fs_nir.cpp<br>
@@ -844,7 +844,22 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
             : bld.MOV(result, brw_imm_f(1.0f));<br>
<br>
          set_predicate(BRW_PREDICATE_NORMAL, inst);<br>
-      } else if (type_sz(op[0].type) < 8) {<br>
+      } else if (type_sz(op[0].type) == 2) {<br>
+         /* AND(val, 0x8000) gives the sign bit.<br>
+          *<br>
+          * Predicated OR ORs 1.0 (0x3c00) with the sign bit if val is not zero.<br>
+          */<br>
+         fs_reg zero = retype(brw_imm_uw(0), BRW_REGISTER_TYPE_HF);<br>
+         bld.CMP(bld.null_reg_f(), op[0], zero, BRW_CONDITIONAL_NZ);<br>
+<br>
+         fs_reg result_int = retype(result, BRW_REGISTER_TYPE_UW);<br>
+         op[0].type = BRW_REGISTER_TYPE_UW;<br>
+         result.type = BRW_REGISTER_TYPE_UW;<br></blockquote><div><br></div><div>Why are you whacking the type on result and also making a result_int temp?  I guess you just copied that from the 32-bit case?  </div></div></div></blockquote><div><br></div><div>Oh yes, I didn't noticed that.</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>If we're going to whack result.type (which is fine), just use result for the rest of it.  With that fixed,</div></div></div></blockquote><div><br></div><div>Right, while I am on it I guess it makes sense to do this small fix for the 32-bit case in the same patch unless you prefer that to be a separate change.</div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">That's probably best separate on the off chance something bisects to it.  You can automatically add my review to the new patch though.</div><div dir="auto"><br></div><div id="aqm-original" style="color: black;" dir="auto"><div style="text-align:left; direction:ltr;" class="aqm-original-body"><div style="color: black;"><blockquote type="cite" class="gmail_quote" style="margin: 0 0 0 0.75ex; border-left: 1px solid #808080; padding-left: 0.75ex;"><div></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
+         bld.AND(result_int, op[0], brw_imm_uw(0x8000u));<br>
+<br>
+         inst = bld.OR(result_int, result_int, brw_imm_uw(0x3c00u));<br>
+         inst->predicate = BRW_PREDICATE_NORMAL;<br>
+      } else if (type_sz(op[0].type) == 4) {<br>
          /* AND(val, 0x80000000) gives the sign bit.<br>
           *<br>
           * Predicated OR ORs 1.0 (0x3f800000) with the sign bit if val is not<br>
@@ -866,6 +881,7 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
           * - The sign is encoded in the high 32-bit of each DF<br>
           * - We need to produce a DF result.<br>
           */<br>
+         assert(type_sz(op[0].type) == 8);<br>
<br>
          fs_reg zero = vgrf(glsl_type::double_type);<br>
          bld.MOV(zero, setup_imm_df(bld, 0.0));<br>
</blockquote></div></div></blockquote></blockquote>
</div>
</div>
<!-- body end -->

</div><div dir="auto"><br></div>
</div></body>
</html>