i965/fs: Indent the implementation of 32x32-bit MUL lowering by one level.

In order to make room for the code that will lower the MULH virtual
instruction.  Also move the hardware generation and execution type
checks into the same branch, they are going to have to be different
for MULH.

Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Francisco Jerez 2015-08-05 16:47:18 +03:00
parent f5b37fb1ac
commit 2e73126438
1 changed files with 147 additions and 143 deletions

View File

@ -3129,21 +3129,24 @@ fs_visitor::lower_integer_multiplication()
{
bool progress = false;
/* Gen8's MUL instruction can do a 32-bit x 32-bit -> 32-bit operation
* directly, but CHV/BXT cannot.
*/
if (devinfo->gen >= 8 && !devinfo->is_cherryview && !devinfo->is_broxton)
return false;
foreach_block_and_inst_safe(block, fs_inst, inst, cfg) {
if (inst->opcode != BRW_OPCODE_MUL ||
inst->dst.is_accumulator() ||
const fs_builder ibld(this, block, inst);
if (inst->opcode == BRW_OPCODE_MUL) {
if (inst->dst.is_accumulator() ||
(inst->dst.type != BRW_REGISTER_TYPE_D &&
inst->dst.type != BRW_REGISTER_TYPE_UD))
continue;
const fs_builder ibld(this, block, inst);
/* Gen8's MUL instruction can do a 32-bit x 32-bit -> 32-bit
* operation directly, but CHV/BXT cannot.
*/
if (devinfo->gen >= 8 &&
!devinfo->is_cherryview && !devinfo->is_broxton)
continue;
if (inst->src[1].file == IMM &&
inst->src[1].fixed_hw_reg.dw1.ud < (1 << 16)) {
/* The MUL instruction isn't commutative. On Gen <= 6, only the low
* 16-bits of src0 are read, and on Gen >= 7 only the low 16-bits of
* src1 are used.
@ -3151,8 +3154,6 @@ fs_visitor::lower_integer_multiplication()
* If multiplying by an immediate value that fits in 16-bits, do a
* single MUL instruction with that value in the proper location.
*/
if (inst->src[1].file == IMM &&
inst->src[1].fixed_hw_reg.dw1.ud < (1 << 16)) {
if (devinfo->gen < 7) {
fs_reg imm(GRF, alloc.allocate(dispatch_width / 8),
inst->dst.type);
@ -3279,6 +3280,9 @@ fs_visitor::lower_integer_multiplication()
ibld.MOV(null, inst->dst));
}
}
} else {
continue;
}
inst->remove(block);
progress = true;