<div dir="ltr"><div>This patch doesn't really do what the commit message says.  What it really does is implement float -> 8-bit converions for *any* size float.<br></div><div><br></div><div class="gmail_quote"><div dir="ltr">On Tue, Jan 15, 2019 at 7:55 AM Iago Toral Quiroga <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">These are not directly supported in hardware and brw_nir_lower_conversions<br>
should have taken care of that before we get here. Also, while we are<br>
at it, make sure 64-bit integer to 8-bit are also properly split by<br>
the same lowering pass, since they have the same hardware restrictions.<br></blockquote><div><br></div><div>Now that we have a lowering pass, having separate cases just so one of them can assert seems silly.  If anything, we should just do</div><div><br></div><div>if (result.type == BRW_REGISTER_TYPE_B ||</div><div>    result.type == BRW_REGISTER_TYPE_UB ||</div><div>    result.type == BRW_REGISTER_TYPE_HF)</div><div>   assert(type_sz(op[0].type) < 8) /* brw_nir_lower_conversions */</div><div><br></div><div>and have it all in one big case.  The only special case we need is for booleans where we need to negate them and fall through.</div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 src/intel/compiler/brw_fs_nir.cpp | 6 ++++--<br>
 1 file changed, 4 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/intel/compiler/brw_fs_nir.cpp b/src/intel/compiler/brw_fs_nir.cpp<br>
index cf546b8ff09..e454578d99b 100644<br>
--- a/src/intel/compiler/brw_fs_nir.cpp<br>
+++ b/src/intel/compiler/brw_fs_nir.cpp<br>
@@ -786,6 +786,10 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
    case nir_op_f2f16:<br>
    case nir_op_i2f16:<br>
    case nir_op_u2f16:<br>
+   case nir_op_i2i8:<br>
+   case nir_op_u2u8:<br>
+   case nir_op_f2i8:<br>
+   case nir_op_f2u8:<br>
       assert(type_sz(op[0].type) < 8); /* brw_nir_lower_conversions */<br>
       inst = bld.MOV(result, op[0]);<br>
       inst->saturate = instr->dest.saturate;<br>
@@ -824,8 +828,6 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
    case nir_op_u2u32:<br>
    case nir_op_i2i16:<br>
    case nir_op_u2u16:<br>
-   case nir_op_i2i8:<br>
-   case nir_op_u2u8:<br>
       inst = bld.MOV(result, op[0]);<br>
       inst->saturate = instr->dest.saturate;<br>
       break;<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>