nv50/ir: fix quadop emission in the presence of predication

When there's a predicate, it just goes onto the sources list. If the
quadop only has a single regular source, we will end up thinking that
the predicate is the second source. Check explicitly for the predSrc so
that we don't accidentally emit the wrong thing.

This fixes a bunch of dEQP-GLES3.functional.shaders.derivate.* tests.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
This commit is contained in:
Ilia Mirkin 2016-02-16 02:26:54 -05:00
parent 1d1ddfe5f8
commit ca23c8081f
4 changed files with 9 additions and 5 deletions

View File

@ -1239,7 +1239,7 @@ CodeEmitterGK110::emitQUADOP(const Instruction *i, uint8_t qOp, uint8_t laneMask
defId(i->def(0), 2);
srcId(i->src(0), 10);
srcId(i->srcExists(1) ? i->src(1) : i->src(0), 23);
srcId((i->srcExists(1) && i->predSrc != 1) ? i->src(1) : i->src(0), 23);
if (i->op == OP_QUADOP && progType != Program::TYPE_FRAGMENT)
code[1] |= 1 << 9; // dall

View File

@ -1535,7 +1535,10 @@ CodeEmitterGM107::emitFSWZADD()
emitRND (0x27);
emitField(0x26, 1, insn->lanes); /* abused for .ndv */
emitField(0x1c, 8, insn->subOp);
emitGPR (0x14, insn->src(1));
if (insn->predSrc != 1)
emitGPR (0x14, insn->src(1));
else
emitGPR (0x14);
emitGPR (0x08, insn->src(0));
emitGPR (0x00, insn->def(0));
}

View File

@ -527,7 +527,8 @@ CodeEmitterNV50::emitForm_ADD(const Instruction *i)
setSrcFileBits(i, NV50_OP_ENC_LONG_ALT);
setSrc(i, 0, 0);
setSrc(i, 1, 2);
if (i->predSrc != 1)
setSrc(i, 1, 2);
if (i->getIndirect(0, 0)) {
assert(!i->getIndirect(1, 0));
@ -840,7 +841,7 @@ CodeEmitterNV50::emitQUADOP(const Instruction *i, uint8_t lane, uint8_t quOp)
emitForm_ADD(i);
if (!i->srcExists(1))
if (!i->srcExists(1) || i->predSrc == 1)
srcId(i->src(0), 32 + 14);
}

View File

@ -1334,7 +1334,7 @@ CodeEmitterNVC0::emitQUADOP(const Instruction *i, uint8_t qOp, uint8_t laneMask)
defId(i->def(0), 14);
srcId(i->src(0), 20);
srcId(i->srcExists(1) ? i->src(1) : i->src(0), 26);
srcId((i->srcExists(1) && i->predSrc != 1) ? i->src(1) : i->src(0), 26);
if (i->op == OP_QUADOP && progType != Program::TYPE_FRAGMENT)
code[0] |= 1 << 9; // dall