nv50/ir: fix cas lowering for 64 bit
authorKarol Herbst <kherbst@redhat.com>
Sat, 7 Mar 2020 15:55:19 +0000 (16:55 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 1 Sep 2020 18:47:30 +0000 (18:47 +0000)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6433>

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

index 52106cb931fd10644f3b6a6d7f45b839e3b8d20c..0e69f25ca28e581a912f2735cd315eaf566b8ff7 100644 (file)
@@ -1734,9 +1734,10 @@ NVC0LoweringPass::handleCasExch(Instruction *cas, bool needCctl)
       // happen elsewhere in the universe.
       // Also, it sometimes returns the new value instead of the old one
       // under mysterious circumstances.
-      Value *dreg = bld.getSSA(8);
+      DataType ty = typeOfSize(typeSizeof(cas->dType) * 2);
+      Value *dreg = bld.getSSA(typeSizeof(ty));
       bld.setPosition(cas, false);
-      bld.mkOp2(OP_MERGE, TYPE_U64, dreg, cas->getSrc(1), cas->getSrc(2));
+      bld.mkOp2(OP_MERGE, ty, dreg, cas->getSrc(1), cas->getSrc(2));
       cas->setSrc(1, dreg);
       cas->setSrc(2, dreg);
    }