Skip to content

Commit

Permalink
target/xtensa: fix break_dependency for repeated resources
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jcmvbkbc committed Mar 22, 2019
1 parent 62a172e commit b9ec521
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 0 additions & 1 deletion target/xtensa/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
17 changes: 17 additions & 0 deletions tests/tcg/xtensa/test_flix.S
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b9ec521

Please sign in to comment.