<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 class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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 class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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 class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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?<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>
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>
-- <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>