i965/fs: Perform CSE on MOV ..., VF instructions.

Safe from causing optimization loops, since we don't constant propagate
VF arguments.

(for this and the previous patch):
total instructions in shared programs: 4289075 -> 4271932 (-0.40%)
instructions in affected programs:     1616779 -> 1599636 (-1.06%)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Matt Turner 2014-04-03 14:29:30 -07:00
parent 963a3c7f90
commit a28ad9d4c0
1 changed files with 11 additions and 5 deletions

View File

@ -62,6 +62,7 @@ static bool
is_expression(const fs_inst *const inst) is_expression(const fs_inst *const inst)
{ {
switch (inst->opcode) { switch (inst->opcode) {
case BRW_OPCODE_MOV:
case BRW_OPCODE_SEL: case BRW_OPCODE_SEL:
case BRW_OPCODE_NOT: case BRW_OPCODE_NOT:
case BRW_OPCODE_AND: case BRW_OPCODE_AND:
@ -194,11 +195,16 @@ fs_visitor::opt_cse_local(bblock_t *block)
} }
if (!found) { if (!found) {
/* Our first sighting of this expression. Create an entry. */ if (inst->opcode != BRW_OPCODE_MOV ||
aeb_entry *entry = ralloc(cse_ctx, aeb_entry); (inst->opcode == BRW_OPCODE_MOV &&
entry->tmp = reg_undef; inst->src[0].file == IMM &&
entry->generator = inst; inst->src[0].type == BRW_REGISTER_TYPE_VF)) {
aeb.push_tail(entry); /* Our first sighting of this expression. Create an entry. */
aeb_entry *entry = ralloc(cse_ctx, aeb_entry);
entry->tmp = reg_undef;
entry->generator = inst;
aeb.push_tail(entry);
}
} else { } else {
/* This is at least our second sighting of this expression. /* This is at least our second sighting of this expression.
* If we don't have a temporary already, make one. * If we don't have a temporary already, make one.