]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/xtensa: fix break_dependency for repeated resources
authorMax Filippov <jcmvbkbc@gmail.com>
Fri, 22 Mar 2019 03:22:03 +0000 (20:22 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Fri, 22 Mar 2019 04:47:50 +0000 (21:47 -0700)
break_dependency incorrectly handles the case of dependency on an opcode
that references the same register multiple times. E.g. the following
instruction is translated incorrectly:

  { or a2, a3, a3 ; or a3, a2, a2 }

This happens because resource indices of both dependency graph nodes are
incremented, and a copy for the second instance of the same register in
the ending node is not done.
Only increment resource index of the ending node of the dependency.
Add test.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
target/xtensa/translate.c
tests/tcg/xtensa/test_flix.S

index 77bc04d6b0f685a3ade4f576491d98970e629134..65561d2c49729e7997243023880e8861d7adae64 100644 (file)
@@ -1041,7 +1041,6 @@ static bool break_dependency(struct slot_prop *a,
             copy[n].resource = b->in[j].resource;
             copy[n].arg = b->arg + index;
             ++n;
-            ++i;
             ++j;
             rv = true;
         }
index 7c259e7018977951dcca77944eeee35a21b4db88..7af06b2b8882186bdf86f923b833e8f565ccc1b8 100644 (file)
@@ -55,6 +55,23 @@ test sum
     .previous
 test_end
 
+test rep_dependency
+
+    {
+        movi    a2, 1
+        movi    a3, 2
+        nop
+    }
+    {
+        or      a2, a3, a3
+        or      a3, a2, a2
+        nop
+    }
+    assert  eqi, a2, 2
+    assert  eqi, a3, 1
+
+test_end
+
 #endif
 
 test_suite_end