[Mesa-dev] [PATCH v2 2/6] gm107/ir: add LIMM form of mad

Samuel Pitoiset samuel.pitoiset at gmail.com
Wed Oct 26 17:20:12 UTC 2016



On 10/09/2016 11:04 AM, Karol Herbst wrote:
> v2: renamed commit
>     reordered modifiers
>     add assert(dst == src2)
>
> Signed-off-by: Karol Herbst <karolherbst at gmail.com>
> ---
>  .../drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp | 35 ++++++++++++++++------
>  1 file changed, 26 insertions(+), 9 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 3fedafd..5729615 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_gm107.cpp
> @@ -1306,7 +1306,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()) {
> @@ -1319,14 +1319,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));

Because def(0) == src(2), you can eventually drop that check and call 
emitGPR() even for the LIMM form.

>        break;
>     case FILE_MEMORY_CONST:
>        emitInsn(0x51800000);
> @@ -1337,11 +1345,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);
> +
> +   if (isLongIMMD) {
> +      emitSAT (0x37);
> +      emitNEG (0x39, insn->src(2));
> +      emitNEG2(0x38, insn->src(0), insn->src(1));
> +      emitCC  (0x34);

Order:
0x39
0x38
0x37
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));
>


More information about the mesa-dev mailing list