Before this patch, the following code would not be optimized even though
the first two instructions were common to the then and else blocks:
(+f0) IF
MOV dst0 ...
MOV dst1 ...
MOV dst2 ...
ELSE
MOV dst0 ...
MOV dst1 ...
MOV dst3 ...
ENDIF
This commit extends the peephole to handle this case.
No shader-db changes.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
fs_inst *else_mov[MAX_MOVS] = { NULL };
fs_inst *then_mov[MAX_MOVS] = { NULL };
- bool malformed_mov_found = false;
int movs = count_movs_from_if(then_mov, else_mov, if_inst, else_inst);
if (!then_mov[i]->dst.equals(else_mov[i]->dst) ||
then_mov[i]->is_partial_write() ||
else_mov[i]->is_partial_write()) {
- malformed_mov_found = true;
+ movs = i;
break;
}
}
}
- if (malformed_mov_found)
+ if (movs == 0)
continue;
/* Emit a CMP if our IF used the embedded comparison */