Subject: [PATCH v5] gm107/ir: add LIMM form of mad v2: renamed commit reordered modifiers add assert(dst == src2) v3: reordered modifiers again v5: no roudning bit for limms
Signed-off-by: Karol Herbst <karolher...@gmail.com> --- .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 34 ++++++++++++++++------ .../drivers/nouveau/codegen/nv50_ir_peephole.cpp | 3 +- 2 files changed, 26 insertions(+), 11 deletions(-) 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 5bd0fa0..c627642 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp @@ -1307,7 +1307,7 @@ CodeEmitterGM107::emitFMUL() void CodeEmitterGM107::emitFFMA() { - /*XXX: ffma32i exists, but not using it as third src overlaps dst */ + bool isLongIMMD = false; switch(insn->src(2).getFile()) { case FILE_GPR: switch (insn->src(1).getFile()) { @@ -1320,14 +1320,22 @@ CodeEmitterGM107::emitFFMA() emitCBUF(0x22, -1, 0x14, 16, 2, insn->src(1)); break; case FILE_IMMEDIATE: - emitInsn(0x32800000); - emitIMMD(0x14, 19, insn->src(1)); + if (longIMMD(insn->getSrc(1))) { + assert(insn->getDef(0)->reg.data.id == insn->getSrc(2)->reg.data.id); + isLongIMMD = true; + emitInsn(0x0c000000); + emitIMMD(0x14, 32, insn->src(1)); + } else { + emitInsn(0x32800000); + emitIMMD(0x14, 19, insn->src(1)); + } break; default: assert(!"bad src1 file"); break; } - emitGPR (0x27, insn->src(2)); + if (!isLongIMMD) + emitGPR (0x27, insn->src(2)); break; case FILE_MEMORY_CONST: emitInsn(0x51800000); @@ -1338,11 +1346,19 @@ CodeEmitterGM107::emitFFMA() assert(!"bad src2 file"); break; } - emitRND (0x33); - emitSAT (0x32); - emitNEG (0x31, insn->src(2)); - emitNEG2(0x30, insn->src(0), insn->src(1)); - emitCC (0x2f); + + if (isLongIMMD) { + emitNEG (0x39, insn->src(2)); + emitNEG2(0x38, insn->src(0), insn->src(1)); + emitSAT (0x37); + emitCC (0x34); + } else { + emitRND (0x33); + emitSAT (0x32); + emitNEG (0x31, insn->src(2)); + emitNEG2(0x30, insn->src(0), insn->src(1)); + emitCC (0x2f); + } emitFMZ(0x35, 2); emitGPR(0x08, insn->src(0)); diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp index 3c5ded6..5b46012 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp @@ -3601,8 +3601,7 @@ bool Program::optimizePostRA(int level) { RUN_PASS(2, FlatteningPass, run); - if (getTarget()->getChipset() < NVISA_GM107_CHIPSET) - RUN_PASS(2, PostRaLoadPropagation, run); + RUN_PASS(2, PostRaLoadPropagation, run); return true; } -- 2.10.1 2016-11-06 15:34 GMT+01:00 Ilia Mirkin <imir...@alum.mit.edu>: > On Nov 6, 2016 9:06 AM, "Karol Herbst" <karolher...@gmail.com> wrote: >> >> v2: renamed commit >> reordered modifiers >> add assert(dst == src2) >> v3: reordered modifiers again >> >> Signed-off-by: Karol Herbst <karolher...@gmail.com> >> --- >> .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 35 >> ++++++++++++++++------ >> .../drivers/nouveau/codegen/nv50_ir_peephole.cpp | 3 +- >> 2 files changed, 27 insertions(+), 11 deletions(-) >> >> 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 5bd0fa0..01a2525 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp >> @@ -1307,7 +1307,7 @@ CodeEmitterGM107::emitFMUL() >> void >> CodeEmitterGM107::emitFFMA() >> { >> - /*XXX: ffma32i exists, but not using it as third src overlaps dst */ >> + bool isLongIMMD = false; >> switch(insn->src(2).getFile()) { >> case FILE_GPR: >> switch (insn->src(1).getFile()) { >> @@ -1320,14 +1320,22 @@ CodeEmitterGM107::emitFFMA() >> emitCBUF(0x22, -1, 0x14, 16, 2, insn->src(1)); >> break; >> case FILE_IMMEDIATE: >> - emitInsn(0x32800000); >> - emitIMMD(0x14, 19, insn->src(1)); >> + if (longIMMD(insn->getSrc(1))) { >> + assert(insn->getDef(0)->reg.data.id == >> insn->getSrc(2)->reg.data.id); >> + isLongIMMD = true; >> + emitInsn(0x0c000000); >> + emitIMMD(0x14, 32, insn->src(1)); >> + } else { >> + emitInsn(0x32800000); >> + emitIMMD(0x14, 19, insn->src(1)); >> + } >> break; >> default: >> assert(!"bad src1 file"); >> break; >> } >> - emitGPR (0x27, insn->src(2)); >> + if (!isLongIMMD) >> + emitGPR (0x27, insn->src(2)); >> break; >> case FILE_MEMORY_CONST: >> emitInsn(0x51800000); >> @@ -1338,11 +1346,20 @@ CodeEmitterGM107::emitFFMA() >> assert(!"bad src2 file"); >> break; >> } >> - emitRND (0x33); >> - emitSAT (0x32); >> - emitNEG (0x31, insn->src(2)); >> - emitNEG2(0x30, insn->src(0), insn->src(1)); >> - emitCC (0x2f); >> + >> + emitRND(0x33); > > Won't this overlap with the high bit of the immediate? In other emitters, > the rounding mode is only set for the non-limm form. > >> + >> + if (isLongIMMD) { >> + emitNEG (0x39, insn->src(2)); >> + emitNEG2(0x38, insn->src(0), insn->src(1)); >> + emitSAT (0x37); >> + emitCC (0x34); >> + } else { >> + emitSAT (0x32); >> + emitNEG (0x31, insn->src(2)); >> + emitNEG2(0x30, insn->src(0), insn->src(1)); >> + emitCC (0x2f); >> + } >> >> emitFMZ(0x35, 2); >> emitGPR(0x08, insn->src(0)); >> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp >> b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp >> index 3c5ded6..5b46012 100644 >> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp >> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp >> @@ -3601,8 +3601,7 @@ bool >> Program::optimizePostRA(int level) >> { >> RUN_PASS(2, FlatteningPass, run); >> - if (getTarget()->getChipset() < NVISA_GM107_CHIPSET) >> - RUN_PASS(2, PostRaLoadPropagation, run); >> + RUN_PASS(2, PostRaLoadPropagation, run); >> >> return true; >> } >> -- >> 2.10.1 >> >> _______________________________________________ >> mesa-dev mailing list >> mesa-dev@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev