[Mesa-dev] [PATCH 3/3] i965/vec4: Remove useless conditionals.

Matt Turner mattst88 at gmail.com
Mon Jun 30 10:47:17 PDT 2014


On Mon, Jun 30, 2014 at 10:32 AM, Ian Romanick <idr at freedesktop.org> wrote:
> On 06/30/2014 10:11 AM, Matt Turner wrote:
>> Setting a couple of bits is the same cost or less as conditionally
>> setting a couple of bits.
>> ---
>>  src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 9 +++------
>>  1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
>> index 8f5b205..509c32c 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
>> @@ -1266,12 +1266,9 @@ vec4_generator::generate_code(exec_list *instructions)
>>
>>           brw_inst *last = &p->store[pre_emit_nr_insn];
>>
>> -         if (inst->conditional_mod)
>> -            brw_inst_set_cond_modifier(brw, last, inst->conditional_mod);
>> -         if (inst->no_dd_clear)
>> -            brw_inst_set_no_dd_clear(brw, last, true);
>> -         if (inst->no_dd_check)
>> -            brw_inst_set_no_dd_check(brw, last, true);
>> +         brw_inst_set_cond_modifier(brw, last, inst->conditional_mod);
>> +         brw_inst_set_no_dd_clear(brw, last, inst->no_dd_clear);
>> +         brw_inst_set_no_dd_check(brw, last, inst->no_dd_check);
>
> The old code will only set the bits.  The new code might also clear the
> bits, right?  Is that potentially a problem?

Ah, the missing piece of information here is that the bits are already
zero when this code is called.


More information about the mesa-dev mailing list