summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2012-04-08 23:38:55 +0200
committerChristoph Bumiller <[email protected]>2012-04-14 21:54:03 +0200
commitf8c3212cbb0cddbfcf1853b55e954de31e0ff555 (patch)
treebe566277589c828faa0d7e4a89202a0337db99f4 /src/gallium/drivers/nv50
parent93508b5b0d0a2b1e966973f1d0119b32d2ccf729 (diff)
nv50/ir: fix Instruction::isCommutationLegal for WAW
Diffstat (limited to 'src/gallium/drivers/nv50')
-rw-r--r--src/gallium/drivers/nv50/codegen/nv50_ir.cpp18
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;
}