<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Apr 14, 2013 at 5:24 PM, Roland Scheidegger <span dir="ltr"><<a href="mailto:sroland@vmware.com" target="_blank">sroland@vmware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am 14.04.2013 10:12, schrieb <a href="mailto:jfonseca@vmware.com">jfonseca@vmware.com</a>:> - TBD<br>
<div><div class="h5">
> + Start an IF ... ELSE .. ENDIF block. Condition evaluates to true if<br>
> +<br>
> + src0.x != 0.0<br>
> +<br>
> + where src0.x is interpreted as a floating point register.<br>
</div></div>Maybe should say something wrt evaluation of NaNs? I know we haven't<br>
really established rules for comparisons etc. wrt NaNs but those<br>
bools-as-float make me cry. I guess it is no different though than other<br>
float opcodes, if we now really have a definition saying IF takes _any_<br>
float not just a bool-as-float which was loosely implied before.<br>
<div><div class="h5"><br></div></div></blockquote><div><br></div><div>I don't know where the term "bool-as-float" came from, but I'd rather not use it unless it's properly defined somewhere, and TGSI doesn't have bools anyway, so why bother? The GLSL compiler or glsl-to-tgsi is responsible for converting bools to either floats or ints and TGSI shouldn't need to care. Both r300g and r600g use (src0.x != 0.0) for IF and (src0.x != 0) for UIF (r600-only), so there is always the "not-equal-to" operator, which is also well defined for NaNs.<br>
<br></div><div>Also if you care about NaNs, we should start by defining how instructions should handle them, e.g. how relational operators handle NaNs, whether the multiplication operator follows the rule 0*anything = 0 (MUL, MAD, DP4, ...), etc.<br>
<br></div><div>R600 have separate opcodes depending on what behavior you want, for example:<br>- The MUL opcode follows the rule 0*anything = 0. (DX9)<br>- The MUL_IEEE opcode follows the IEEE behavior.<br></div><div><br>
The other opcodes with both the DX9 and IEEE behavior are: MAD, DP4, EX2, LG2, RCP, RSQ. There are also separate MIN and MAX opcodes for DX9 and DX10. We should choose our opcodes carefully depending on whether we are implementing a DX9, DX10, OpenGL, or OpenCL state tracker.<br>
</div><div></div><div></div><br><div>Marek<br></div></div></div></div>