The implementation of ballotARB() will start by zeroing the flags
register. So, a doing something like
if (gl_SubGroupInvocationARB % 2u == 0u) {
... = ballotARB(true);
[...]
} else {
... = ballotARB(true);
[...]
}
(like fs-ballot-if-else.shader_test does) would generate identical MOVs
to the same destination (the flag register!), and we definitely do not
want to pull that out of the control flow.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
{
int then_movs = 0;
foreach_inst_in_block(fs_inst, inst, then_block) {
- if (then_movs == MAX_MOVS || inst->opcode != BRW_OPCODE_MOV)
+ if (then_movs == MAX_MOVS || inst->opcode != BRW_OPCODE_MOV ||
+ inst->flags_written())
break;
then_mov[then_movs] = inst;
int else_movs = 0;
foreach_inst_in_block(fs_inst, inst, else_block) {
- if (else_movs == MAX_MOVS || inst->opcode != BRW_OPCODE_MOV)
+ if (else_movs == MAX_MOVS || inst->opcode != BRW_OPCODE_MOV ||
+ inst->flags_written())
break;
else_mov[else_movs] = inst;