From 8c2dfe05c5db9946d2d30546920e98bcfb8e3eb9 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Tue, 22 Sep 2015 19:13:14 -0400 Subject: [PATCH] gk110/ir: add OP_CCTL handling --- .../nouveau/codegen/nv50_ir_emit_gk110.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) 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 8a98c29035f..59041dfacab 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gk110.cpp @@ -76,6 +76,7 @@ private: void emitSTORE(const Instruction *); void emitMOV(const Instruction *); void emitATOM(const Instruction *); + void emitCCTL(const Instruction *); void emitINTERP(const Instruction *); void emitAFETCH(const Instruction *); @@ -1714,6 +1715,14 @@ CodeEmitterGK110::emitMOV(const Instruction *i) } } +static inline bool +uses64bitAddress(const Instruction *ldst) +{ + return ldst->src(0).getFile() == FILE_MEMORY_GLOBAL && + ldst->src(0).isIndirect(0) && + ldst->getIndirect(0, 0)->reg.size == 8; +} + void CodeEmitterGK110::emitATOM(const Instruction *i) { @@ -1764,6 +1773,29 @@ CodeEmitterGK110::emitATOM(const Instruction *i) } } +void +CodeEmitterGK110::emitCCTL(const Instruction *i) +{ + int32_t offset = SDATA(i->src(0)).offset; + + code[0] = 0x00000002 | (i->subOp << 2); + + if (i->src(0).getFile() == FILE_MEMORY_GLOBAL) { + code[1] = 0x7b000000; + } else { + code[1] = 0x7c000000; + offset &= 0xffffff; + } + code[0] |= offset << 23; + code[1] |= offset >> 9; + + if (uses64bitAddress(i)) + code[1] |= 1 << 23; + srcId(i->src(0).getIndirect(0), 10); + + emitPredicate(i); +} + bool CodeEmitterGK110::emitInstruction(Instruction *insn) { @@ -2001,6 +2033,9 @@ CodeEmitterGK110::emitInstruction(Instruction *insn) case OP_ATOM: emitATOM(insn); break; + case OP_CCTL: + emitCCTL(insn); + break; case OP_PHI: case OP_UNION: case OP_CONSTRAINT: -- 2.30.2