<html dir="ltr"><head></head><body style="text-align:left; direction:ltr;"><div>On Fri, 2018-12-07 at 14:25 -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, Dec 4, 2018 at 1:18 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">There are no 8-bit immediates, so assert in that case.<br>
16-bit immediates are replicated in each word of a 32-bit immediate, so<br>
we only need to check the lower 16-bits.<br>
---<br>
 src/intel/compiler/brw_shader.cpp | 20 ++++++++++++++++++++<br>
 1 file changed, 20 insertions(+)<br>
<br>
diff --git a/src/intel/compiler/brw_shader.cpp b/src/intel/compiler/brw_shader.cpp<br>
index b77bd798d17..9999adbb52f 100644<br>
--- a/src/intel/compiler/brw_shader.cpp<br>
+++ b/src/intel/compiler/brw_shader.cpp<br>
@@ -708,11 +708,18 @@ backend_reg::is_zero() const<br>
    if (file != IMM)<br>
       return false;<br>
<br>
+   assert(type_sz(type) > 1);<br>
+<br></blockquote><div><br></div><div>We should probably also assert that things are properly replicated.<br></div></div></div></blockquote><div><br></div><div>Good idea, I'll add that too.</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> </div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
    switch (type) {<br>
+   case BRW_REGISTER_TYPE_HF:<br>
+      return (d & 0xffff) == 0;<br></blockquote><div><br></div><div>Do we want to check for -0 as well?  I think that'd be 0x8000.<br></div></div></div></blockquote><div><br></div><div>Mmm... yes, I think we should probably do that. Thanks!</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"><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
    case BRW_REGISTER_TYPE_F:<br>
       return f == 0;<br>
    case BRW_REGISTER_TYPE_DF:<br>
       return df == 0;<br>
+   case BRW_REGISTER_TYPE_W:<br>
+   case BRW_REGISTER_TYPE_UW:<br>
+      return (d & 0xffff) == 0;<br>
    case BRW_REGISTER_TYPE_D:<br>
    case BRW_REGISTER_TYPE_UD:<br>
       return d == 0;<br>
@@ -730,11 +737,18 @@ backend_reg::is_one() const<br>
    if (file != IMM)<br>
       return false;<br>
<br>
+   assert(type_sz(type) > 1);<br></blockquote><div><br></div><div>Again, assert proper replication?</div></div></div><div dir="ltr"><div class="gmail_quote"><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
+<br>
    switch (type) {<br>
+   case BRW_REGISTER_TYPE_HF:<br>
+      return (d & 0xffff) == 0x3c00;<br>
    case BRW_REGISTER_TYPE_F:<br>
       return f == 1.0f;<br>
    case BRW_REGISTER_TYPE_DF:<br>
       return df == 1.0;<br>
+   case BRW_REGISTER_TYPE_W:<br>
+   case BRW_REGISTER_TYPE_UW:<br>
+      return (d & 0xffff) == 1;<br>
    case BRW_REGISTER_TYPE_D:<br>
    case BRW_REGISTER_TYPE_UD:<br>
       return d == 1;<br>
@@ -752,11 +766,17 @@ backend_reg::is_negative_one() const<br>
    if (file != IMM)<br>
       return false;<br>
<br>
+   assert(type_sz(type) > 1);<br>
+<br>
    switch (type) {<br>
+   case BRW_REGISTER_TYPE_HF:<br>
+      return (d & 0xffff) == 0xbc00;<br>
    case BRW_REGISTER_TYPE_F:<br>
       return f == -1.0;<br>
    case BRW_REGISTER_TYPE_DF:<br>
       return df == -1.0;<br>
+   case BRW_REGISTER_TYPE_W:<br>
+      return (d & 0xffff) == -1;<br>
    case BRW_REGISTER_TYPE_D:<br>
       return d == -1;<br>
    case BRW_REGISTER_TYPE_Q:<br>
</blockquote></div></div></blockquote></body></html>