summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarol Herbst <[email protected]>2017-03-26 21:46:00 +0200
committerIlia Mirkin <[email protected]>2017-03-31 23:57:15 -0400
commit7d007824a312d4426e8e8e487e502e5fea2bbf58 (patch)
treedb8dc73d10efcf8efddf06488a4414a6d89e6583
parentad638514e362d0e84d28df2346a53fb9b29ff884 (diff)
gm107/ir: add LIMM form of mad
v2: renamed commit reordered modifiers add assert(dst == src2) v3: reordered modifiers again v5: no rounding bit for limms Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp34
-rw-r--r--src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp3
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 6de3f396e3e..6903132efa7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
@@ -1311,7 +1311,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()) {
@@ -1324,14 +1324,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);
@@ -1342,11 +1350,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 df0f35949d6..7cf0166cbbd 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -3741,8 +3741,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;
}