Browse Source

nvc0/ir: don't require AND when the high byte is being addressed

unpackUnorm* lowering doesn't AND the high byte/word as it's
unnecessary. Detect that situation as well.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
tags/11.0-branchpoint
Ilia Mirkin 10 years ago
parent
commit
9ebe7dc094
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

+ 12
- 0
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp View File

@@ -1532,6 +1532,7 @@ AlgebraicOpt::handleCVT_NEG(Instruction *cvt)
// CVT(EXTBF(x, byte/word))
// CVT(AND(bytemask, x))
// CVT(AND(bytemask, SHR(x, 8/16/24)))
// CVT(SHR(x, 16/24))
void
AlgebraicOpt::handleCVT_EXTBF(Instruction *cvt)
{
@@ -1578,6 +1579,17 @@ AlgebraicOpt::handleCVT_EXTBF(Instruction *cvt)
arg = shift->getSrc(0);
offset = imm1.reg.data.u32;
}
} else if (insn->op == OP_SHR && insn->src(1).getImmediate(imm0)) {
arg = insn->getSrc(0);
if (imm0.reg.data.u32 == 24) {
width = 8;
offset = 24;
} else if (imm0.reg.data.u32 == 16) {
width = 16;
offset = 16;
} else {
return;
}
}

if (!arg)

Loading…
Cancel
Save