nv50/ir: convert an ATOM.EXCH without a destination into a store
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 10 Feb 2017 06:55:08 +0000 (01:55 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 12 Feb 2017 01:25:26 +0000 (20:25 -0500)
On SM35 there does not appear to be a way to emit a ATOM.EXCH with a
null destination. This should be functionally equivalent to a plain
store however, so just do that.

Fixes GL45-CTS.compute_shader.atomic-case2 on SM35.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp

index d79e87dc9f6a26f4f94e51865018b617ee7734bb..79403c93dfd2ed6f14c261924a50fcb82700d8f9 100644 (file)
@@ -3549,6 +3549,11 @@ DeadCodeElim::visit(BasicBlock *bb)
              i->op == OP_SUREDP ||
              i->op == OP_SUREDB) {
             i->setDef(0, NULL);
+            if (i->op == OP_ATOM && i->subOp == NV50_IR_SUBOP_ATOM_EXCH) {
+               i->cache = CACHE_CV;
+               i->op = OP_STORE;
+               i->subOp = 0;
+            }
          } else if (i->op == OP_LOAD && i->subOp == NV50_IR_SUBOP_LOAD_LOCKED) {
             i->setDef(0, i->getDef(1));
             i->setDef(1, NULL);