<p dir="ltr">Thanks for picking this up! I don't know that much about statement expressions, so I'm giving this one an ACK only. 2 and 3 are Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>>. I left some comments on 4 but nothing functional.<br></p>
<p dir="ltr">On Jan 16, 2015 5:29 AM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br>
><br>
> In order to support calling lower_load_payload() inside a condition,<br>
> this patch makes OPT() a statement expression:<br>
><br>
> <a href="https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html">https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html</a><br>
><br>
> We recently did the equivalent change in the vec4 backend (commit<br>
> 9b8bd67768769b685c25e1276e053505aede5f93).<br>
><br>
> Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
> ---<br>
> src/mesa/drivers/dri/i965/brw_fs.cpp | 18 +++++++++++-------<br>
> 1 file changed, 11 insertions(+), 7 deletions(-)<br>
><br>
> This was useful when debugging some stuff.<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> index 5d129fe..35639de 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
> @@ -3543,7 +3543,7 @@ fs_visitor::optimize()<br>
> assign_constant_locations();<br>
> demote_pull_constants();<br>
><br>
> -#define OPT(pass, args...) do { \<br>
> +#define OPT(pass, args...) ({ \<br>
> pass_num++; \<br>
> bool this_progress = pass(args); \<br>
> \<br>
> @@ -3556,7 +3556,8 @@ fs_visitor::optimize()<br>
> } \<br>
> \<br>
> progress = progress || this_progress; \<br>
> - } while (false)<br>
> + this_progress; \<br>
> + })<br>
><br>
> if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {<br>
> char filename[64];<br>
> @@ -3568,10 +3569,11 @@ fs_visitor::optimize()<br>
><br>
> bool progress;<br>
> int iteration = 0;<br>
> + int pass_num = 0;<br>
> do {<br>
> progress = false;<br>
> + pass_num = 0;<br>
> iteration++;<br>
> - int pass_num = 0;<br>
><br>
> OPT(remove_duplicate_mrf_writes);<br>
><br>
> @@ -3590,11 +3592,13 @@ fs_visitor::optimize()<br>
> OPT(compact_virtual_grfs);<br>
> } while (progress);<br>
><br>
> - if (lower_load_payload()) {<br>
> + pass_num = 0;<br>
> +<br>
> + if (OPT(lower_load_payload)) {<br>
> split_virtual_grfs();<br>
> - register_coalesce();<br>
> - compute_to_mrf();<br>
> - dead_code_eliminate();<br>
> + OPT(register_coalesce);<br>
> + OPT(compute_to_mrf);<br>
> + OPT(dead_code_eliminate);<br>
> }<br>
><br>
> lower_uniform_pull_constant_loads();<br>
> --<br>
> 2.2.2<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>