diff options
author | Ilia Mirkin <[email protected]> | 2016-02-03 18:16:04 -0500 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2016-02-03 18:40:38 -0500 |
commit | edd494ddf0d6649800c4e83dbc3cc6cd97ce56f7 (patch) | |
tree | 6853863c0673820d51f256cb20d00cc927975d30 /src | |
parent | a9d5c64c34b48a3e2f93b7c9f48f4735f9bb0d8b (diff) |
nv50/ir: make sure to fetch all sources before creating instruction
We must fetch all sources into the instruction stream before generating
the instruction that uses them. Otherwise we'll define values after
using them, which won't work so well.
Signed-off-by: Ilia Mirkin <[email protected]>
Tested-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp index 3da6099b5ff..52ac198221d 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp @@ -2428,19 +2428,22 @@ Converter::handleATOM(Value *dst0[4], DataType ty, uint16_t subOp) continue; Instruction *insn; - Value *off = fetchSrc(1, c); + Value *off = fetchSrc(1, c), *off2 = NULL; Value *sym; if (tgsi.getSrc(1).getFile() == TGSI_FILE_IMMEDIATE) sym = makeSym(TGSI_FILE_BUFFER, r, -1, c, tgsi.getSrc(1).getValueU32(c, info)); else sym = makeSym(TGSI_FILE_BUFFER, r, -1, c, 0); - insn = mkOp2(OP_ATOM, ty, dst, sym, fetchSrc(2, c)); + if (tgsi.getSrc(0).isIndirect(0)) + off2 = fetchSrc(tgsi.getSrc(0).getIndirect(0), 0, 0); if (subOp == NV50_IR_SUBOP_ATOM_CAS) - insn->setSrc(2, fetchSrc(3, 0)); + insn = mkOp3(OP_ATOM, ty, dst, sym, fetchSrc(2, c), fetchSrc(3, c)); + else + insn = mkOp2(OP_ATOM, ty, dst, sym, fetchSrc(2, c)); if (tgsi.getSrc(1).getFile() != TGSI_FILE_IMMEDIATE) insn->setIndirect(0, 0, off); - if (tgsi.getSrc(0).isIndirect(0)) - insn->setIndirect(0, 1, fetchSrc(tgsi.getSrc(0).getIndirect(0), 0, 0)); + if (off2) + insn->setIndirect(0, 1, off2); insn->subOp = subOp; } for (int c = 0; c < 4; ++c) |