qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

target/xtensa: fix break_dependency for repeated resources

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>

+17 -1
-1
target/xtensa/translate.c
··· 1041 1041 copy[n].resource = b->in[j].resource; 1042 1042 copy[n].arg = b->arg + index; 1043 1043 ++n; 1044 - ++i; 1045 1044 ++j; 1046 1045 rv = true; 1047 1046 }
+17
tests/tcg/xtensa/test_flix.S
··· 55 55 .previous 56 56 test_end 57 57 58 + test rep_dependency 59 + 60 + { 61 + movi a2, 1 62 + movi a3, 2 63 + nop 64 + } 65 + { 66 + or a2, a3, a3 67 + or a3, a2, a2 68 + nop 69 + } 70 + assert eqi, a2, 2 71 + assert eqi, a3, 1 72 + 73 + test_end 74 + 58 75 #endif 59 76 60 77 test_suite_end