diff options
Diffstat (limited to 'src/gallium/drivers')
3 files changed, 60 insertions, 11 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp index 2a6c773ba25..f2efb0c60bb 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp @@ -1621,7 +1621,8 @@ CodeEmitterGK110::emitSHFL(const Instruction *i) void CodeEmitterGK110::emitVOTE(const Instruction *i) { - assert(i->src(0).getFile() == FILE_PREDICATE); + const ImmediateValue *imm; + uint32_t u32; code[0] = 0x00000002; code[1] = 0x86c00000 | (i->subOp << 19); @@ -1646,9 +1647,24 @@ CodeEmitterGK110::emitVOTE(const Instruction *i) code[0] |= 255 << 2; if (!(rp & 2)) code[1] |= 7 << 16; - if (i->src(0).mod == Modifier(NV50_IR_MOD_NOT)) - code[1] |= 1 << 13; - srcId(i->src(0), 42); + + switch (i->src(0).getFile()) { + case FILE_PREDICATE: + if (i->src(0).mod == Modifier(NV50_IR_MOD_NOT)) + code[0] |= 1 << 13; + srcId(i->src(0), 42); + break; + case FILE_IMMEDIATE: + imm = i->getSrc(0)->asImm(); + assert(imm); + u32 = imm->reg.data.u32; + assert(u32 == 0 || u32 == 1); + code[1] |= (u32 == 1 ? 0x7 : 0xf) << 10; + break; + default: + assert(!"Unhandled src"); + break; + } } void diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp index 944563c93cf..b1645265565 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp @@ -2931,7 +2931,8 @@ CodeEmitterGM107::emitMEMBAR() void CodeEmitterGM107::emitVOTE() { - assert(insn->src(0).getFile() == FILE_PREDICATE); + const ImmediateValue *imm; + uint32_t u32; int r = -1, p = -1; for (int i = 0; insn->defExists(i); i++) { @@ -2951,8 +2952,24 @@ CodeEmitterGM107::emitVOTE() emitPRED (0x2d, insn->def(p)); else emitPRED (0x2d); - emitField(0x2a, 1, insn->src(0).mod == Modifier(NV50_IR_MOD_NOT)); - emitPRED (0x27, insn->src(0)); + + switch (insn->src(0).getFile()) { + case FILE_PREDICATE: + emitField(0x2a, 1, insn->src(0).mod == Modifier(NV50_IR_MOD_NOT)); + emitPRED (0x27, insn->src(0)); + break; + case FILE_IMMEDIATE: + imm = insn->getSrc(0)->asImm(); + assert(imm); + u32 = imm->reg.data.u32; + assert(u32 == 0 || u32 == 1); + emitPRED(0x27); + emitField(0x2a, 1, u32 == 0); + break; + default: + assert(!"Unhandled src"); + break; + } } void diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp index f4c39a168be..5ca86720544 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp @@ -2583,7 +2583,8 @@ CodeEmitterNVC0::emitSHFL(const Instruction *i) void CodeEmitterNVC0::emitVOTE(const Instruction *i) { - assert(i->src(0).getFile() == FILE_PREDICATE); + const ImmediateValue *imm; + uint32_t u32; code[0] = 0x00000004 | (i->subOp << 5); code[1] = 0x48000000; @@ -2608,9 +2609,24 @@ CodeEmitterNVC0::emitVOTE(const Instruction *i) code[0] |= 63 << 14; if (!(rp & 2)) code[1] |= 7 << 22; - if (i->src(0).mod == Modifier(NV50_IR_MOD_NOT)) - code[0] |= 1 << 23; - srcId(i->src(0), 20); + + switch (i->src(0).getFile()) { + case FILE_PREDICATE: + if (i->src(0).mod == Modifier(NV50_IR_MOD_NOT)) + code[0] |= 1 << 23; + srcId(i->src(0), 20); + break; + case FILE_IMMEDIATE: + imm = i->getSrc(0)->asImm(); + assert(imm); + u32 = imm->reg.data.u32; + assert(u32 == 0 || u32 == 1); + code[0] |= (u32 == 1 ? 0x7 : 0xf) << 20; + break; + default: + assert(!"Unhandled src"); + break; + } } bool |