summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-08-18 22:53:11 -0400
committerIlia Mirkin <[email protected]>2015-08-20 17:58:30 -0400
commit9ebe7dc09479d9a8df2733ef96525a2b5e758f6d (patch)
tree6410f973c8679516cdcbe3ddddb6b125468f6a9c /src
parent63cb85e567ad1025ee990b38f43c2f1ef811821b (diff)
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index ef286c0ab38..cf83c19056e 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -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)