[Mesa-dev] [PATCH 7/8] i965: call next_insn() before referencing a instruction by index

Yuanhan Liu yuanhan.liu at linux.intel.com
Thu Dec 22 19:13:09 PST 2011


On Thu, Dec 22, 2011 at 11:09:12AM -0800, Kenneth Graunke wrote:
> On 12/21/2011 01:33 AM, Yuanhan Liu wrote:
> [snip]
> > +   int emit_endif = 1;
> 
> Please use bool and true/false rather than int.

Yes, right. Will fix it.

> 
> >     /* In single program flow mode, we can express IF and ELSE instructions
> >      * equivalently as ADD instructions that operate on IP.  On platforms prior
> > @@ -1219,14 +1211,32 @@ brw_ENDIF(struct brw_compile *p)
> >      * instructions to conditional ADDs.  So we only do this trick on Gen4 and
> >      * Gen5.
> >      */
> > -   if (intel->gen < 6 && p->single_program_flow) {
> > +   if (intel->gen < 6 && p->single_program_flow)
> > +      emit_endif = 0;
> 
> You could actually just do this:
> 
> /* In single program flow mode, we can express IF and ELSE ...........
>  */
> bool emit_endif = !(intel->gen < 6 && p->single_program_flow);
> 
> But I'm fine with "bool emit_endif = true" and "emit_endif = false" if
> you prefer that.

Yes, I prefer that. From my point, in this case, with the comments, it
can tell us why we can't emit endif clearly.

Here is the fixed patch:



More information about the mesa-dev mailing list