i965: Optimize multiplication by -1 into a negated MOV.
instructions in affected programs: 968 -> 942 (-2.69%) helped: 4 Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
e8a6f2ad65
commit
eb47d0efd3
|
@ -2325,6 +2325,15 @@ fs_visitor::opt_algebraic()
|
|||
break;
|
||||
}
|
||||
|
||||
/* a * -1.0 = -a */
|
||||
if (inst->src[1].is_negative_one()) {
|
||||
inst->opcode = BRW_OPCODE_MOV;
|
||||
inst->src[0].negate = !inst->src[0].negate;
|
||||
inst->src[1] = reg_undef;
|
||||
progress = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* a * 0.0 = 0.0 */
|
||||
if (inst->src[1].is_zero()) {
|
||||
inst->opcode = BRW_OPCODE_MOV;
|
||||
|
|
|
@ -725,6 +725,11 @@ vec4_visitor::opt_algebraic()
|
|||
inst->opcode = BRW_OPCODE_MOV;
|
||||
inst->src[1] = src_reg();
|
||||
progress = true;
|
||||
} else if (inst->src[1].is_negative_one()) {
|
||||
inst->opcode = BRW_OPCODE_MOV;
|
||||
inst->src[0].negate = !inst->src[0].negate;
|
||||
inst->src[1] = src_reg();
|
||||
progress = true;
|
||||
}
|
||||
break;
|
||||
case BRW_OPCODE_CMP:
|
||||
|
|
Loading…
Reference in New Issue