From 4f7798be9fea0e4a2569ea3f9d7f5ba59e024fd6 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sun, 7 Jun 2020 09:52:21 +1000 Subject: [PATCH] nvir/gm107: implement OP_PERMT PFETCH lowering will be changed to use this as it's more SM70-friendly, and this will also allow us to implement extract_byte/word opcodes. Signed-off-by: Ben Skeggs Reviewed-by: Karol Herbst Part-of: --- .../nouveau/codegen/nv50_ir_emit_gm107.cpp | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) 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 e244bd0d610..6324184204a 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp @@ -170,6 +170,7 @@ private: void emitBFI(); void emitBFE(); void emitFLO(); + void emitPRMT(); void emitLDSTs(int, DataType); void emitLDSTc(int); @@ -2371,6 +2372,33 @@ CodeEmitterGM107::emitFLO() emitGPR (0x00, insn->def(0)); } +void +CodeEmitterGM107::emitPRMT() +{ + switch (insn->src(1).getFile()) { + case FILE_GPR: + emitInsn(0x5bc00000); + emitGPR (0x14, insn->src(1)); + break; + case FILE_MEMORY_CONST: + emitInsn(0x4bc00000); + emitCBUF(0x22, -1, 0x14, 16, 2, insn->src(1)); + break; + case FILE_IMMEDIATE: + emitInsn(0x36c00000); + emitIMMD(0x14, 19, insn->src(1)); + break; + default: + assert(!"bad src1 file"); + break; + } + + emitField(0x30, 3, insn->subOp); + emitGPR (0x27, insn->src(2)); + emitGPR (0x08, insn->src(0)); + emitGPR (0x00, insn->def(0)); +} + /******************************************************************************* * memory ******************************************************************************/ @@ -3537,6 +3565,9 @@ CodeEmitterGM107::emitInstruction(Instruction *i) case OP_BFIND: emitFLO(); break; + case OP_PERMT: + emitPRMT(); + break; case OP_SLCT: if (isFloatType(insn->dType)) emitFCMP(); -- 2.30.2