<p dir="ltr"></p>
<p dir="ltr">On Nov 6, 2016 9:06 AM, "Karol Herbst" <<a href="mailto:karolherbst@gmail.com">karolherbst@gmail.com</a>> wrote:<br>
><br>
> v2: renamed commit<br>
>     reordered modifiers<br>
>     add assert(dst == src2)<br>
> v3: reordered modifiers again<br>
><br>
> Signed-off-by: Karol Herbst <<a href="mailto:karolherbst@gmail.com">karolherbst@gmail.com</a>><br>
> ---<br>
>  .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 35 ++++++++++++++++------<br>
>  .../drivers/nouveau/codegen/nv50_ir_peephole.cpp   |  3 +-<br>
>  2 files changed, 27 insertions(+), 11 deletions(-)<br>
><br>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp<br>
> index 5bd0fa0..01a2525 100644<br>
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp<br>
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp<br>
> @@ -1307,7 +1307,7 @@ CodeEmitterGM107::emitFMUL()<br>
>  void<br>
>  CodeEmitterGM107::emitFFMA()<br>
>  {<br>
> -   /*XXX: ffma32i exists, but not using it as third src overlaps dst */<br>
> +   bool isLongIMMD = false;<br>
>     switch(insn->src(2).getFile()) {<br>
>     case FILE_GPR:<br>
>        switch (insn->src(1).getFile()) {<br>
> @@ -1320,14 +1320,22 @@ CodeEmitterGM107::emitFFMA()<br>
>           emitCBUF(0x22, -1, 0x14, 16, 2, insn->src(1));<br>
>           break;<br>
>        case FILE_IMMEDIATE:<br>
> -         emitInsn(0x32800000);<br>
> -         emitIMMD(0x14, 19, insn->src(1));<br>
> +         if (longIMMD(insn->getSrc(1))) {<br>
> +            assert(insn->getDef(0)-><a href="http://reg.data.id">reg.data.id</a> == insn->getSrc(2)-><a href="http://reg.data.id">reg.data.id</a>);<br>
> +            isLongIMMD = true;<br>
> +            emitInsn(0x0c000000);<br>
> +            emitIMMD(0x14, 32, insn->src(1));<br>
> +         } else {<br>
> +            emitInsn(0x32800000);<br>
> +            emitIMMD(0x14, 19, insn->src(1));<br>
> +         }<br>
>           break;<br>
>        default:<br>
>           assert(!"bad src1 file");<br>
>           break;<br>
>        }<br>
> -      emitGPR (0x27, insn->src(2));<br>
> +      if (!isLongIMMD)<br>
> +         emitGPR (0x27, insn->src(2));<br>
>        break;<br>
>     case FILE_MEMORY_CONST:<br>
>        emitInsn(0x51800000);<br>
> @@ -1338,11 +1346,20 @@ CodeEmitterGM107::emitFFMA()<br>
>        assert(!"bad src2 file");<br>
>        break;<br>
>     }<br>
> -   emitRND (0x33);<br>
> -   emitSAT (0x32);<br>
> -   emitNEG (0x31, insn->src(2));<br>
> -   emitNEG2(0x30, insn->src(0), insn->src(1));<br>
> -   emitCC  (0x2f);<br>
> +<br>
> +   emitRND(0x33);</p>
<p dir="ltr">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.</p>
<p dir="ltr">> +<br>
> +   if (isLongIMMD) {<br>
> +      emitNEG (0x39, insn->src(2));<br>
> +      emitNEG2(0x38, insn->src(0), insn->src(1));<br>
> +      emitSAT (0x37);<br>
> +      emitCC  (0x34);<br>
> +   } else {<br>
> +      emitSAT (0x32);<br>
> +      emitNEG (0x31, insn->src(2));<br>
> +      emitNEG2(0x30, insn->src(0), insn->src(1));<br>
> +      emitCC  (0x2f);<br>
> +   }<br>
><br>
>     emitFMZ(0x35, 2);<br>
>     emitGPR(0x08, insn->src(0));<br>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp<br>
> index 3c5ded6..5b46012 100644<br>
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp<br>
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp<br>
> @@ -3601,8 +3601,7 @@ bool<br>
>  Program::optimizePostRA(int level)<br>
>  {<br>
>     RUN_PASS(2, FlatteningPass, run);<br>
> -   if (getTarget()->getChipset() < NVISA_GM107_CHIPSET)<br>
> -      RUN_PASS(2, PostRaLoadPropagation, run);<br>
> +   RUN_PASS(2, PostRaLoadPropagation, run);<br>
><br>
>     return true;<br>
>  }<br>
> --<br>
> 2.10.1<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br></p>