diff options
-rw-r--r-- | src/gallium/drivers/nv50/codegen/nv50_ir.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp index d80fc85126a..19a90806c70 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp @@ -815,7 +815,7 @@ Instruction::writesPredicate() const } static bool -insnCheckCommutation(const Instruction *a, const Instruction *b) +insnCheckCommutationDefSrc(const Instruction *a, const Instruction *b) { for (int d = 0; a->defExists(d); ++d) for (int s = 0; b->srcExists(s); ++s) @@ -824,12 +824,22 @@ insnCheckCommutation(const Instruction *a, const Instruction *b) return true; } +static bool +insnCheckCommutationDefDef(const Instruction *a, const Instruction *b) +{ + for (int d = 0; a->defExists(d); ++d) + for (int c = 0; b->defExists(c); ++c) + if (a->getDef(d)->interfers(b->getDef(c))) + return false; + return true; +} + bool Instruction::isCommutationLegal(const Instruction *i) const { - bool ret = true; - ret = ret && insnCheckCommutation(this, i); - ret = ret && insnCheckCommutation(i, this); + bool ret = insnCheckCommutationDefDef(this, i); + ret = ret && insnCheckCommutationDefSrc(this, i); + ret = ret && insnCheckCommutationDefSrc(i, this); return ret; } |