nvir/gm107: replace SHR+AND+AND with PRMT+PRMT in PFETCH lowering
authorBen Skeggs <bskeggs@redhat.com>
Sat, 6 Jun 2020 23:52:23 +0000 (09:52 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 10 Jun 2020 22:52:41 +0000 (22:52 +0000)
This is more SM70-friendly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5377>

src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_gm107.cpp

index 49a5f3b01f2b3baea82e8015452d8aa361642af5..9fad1dcfe891bab1e1b26640ea1297dd09fbc041 100644 (file)
@@ -239,9 +239,8 @@ GM107LoweringPass::handlePFETCH(Instruction *i)
    Value *tmp1 = bld.getScratch();
    Value *tmp2 = bld.getScratch();
    bld.mkOp1(OP_RDSV, TYPE_U32, tmp0, bld.mkSysVal(SV_INVOCATION_INFO, 0));
-   bld.mkOp2(OP_SHR , TYPE_U32, tmp1, tmp0, bld.mkImm(16));
-   bld.mkOp2(OP_AND , TYPE_U32, tmp0, tmp0, bld.mkImm(0xff));
-   bld.mkOp2(OP_AND , TYPE_U32, tmp1, tmp1, bld.mkImm(0xff));
+   bld.mkOp3(OP_PERMT, TYPE_U32, tmp1, tmp0, bld.mkImm(0x4442), bld.mkImm(0));
+   bld.mkOp3(OP_PERMT, TYPE_U32, tmp0, tmp0, bld.mkImm(0x4440), bld.mkImm(0));
    if (i->getSrc(1))
       bld.mkOp2(OP_ADD , TYPE_U32, tmp2, i->getSrc(0), i->getSrc(1));
    else