Signed-off-by: Taylor Simpson <[email protected]>
---
target/hexagon/translate.h | 12 +++++++++++-
target/hexagon/translate.c | 9 +++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/target/hexagon/translate.h b/target/hexagon/translate.h
index 964e6ce0b7..9ee5f25365 100644
--- a/target/hexagon/translate.h
+++ b/target/hexagon/translate.h
@@ -70,6 +70,8 @@ typedef struct DisasContext {
DECLARE_BITMAP(vregs_select, NUM_VREGS);
DECLARE_BITMAP(predicated_future_vregs, NUM_VREGS);
DECLARE_BITMAP(predicated_tmp_vregs, NUM_VREGS);
+ DECLARE_BITMAP(vregs_multi_write, NUM_VREGS);
+ DECLARE_BITMAP(vregs_uncond, NUM_VREGS);
DECLARE_BITMAP(insn_vregs_read, NUM_VREGS);
int qreg_log[NUM_QREGS];
int qreg_log_idx;
@@ -218,7 +220,11 @@ static inline void ctx_log_vreg_write(DisasContext *ctx,
ctx->has_hvx_overlap = true;
}
}
- set_bit(rnum, ctx->vregs_written);
+ if (!test_bit(rnum, ctx->vregs_written)) {
+ set_bit(rnum, ctx->vregs_written);
+ } else {
+ set_bit(rnum, ctx->vregs_multi_write);
+ }
if (type != EXT_TMP) {
if (!test_bit(rnum, ctx->vregs_updated)) {
ctx->vreg_log[ctx->vreg_log_idx] = rnum;
@@ -229,6 +235,8 @@ static inline void ctx_log_vreg_write(DisasContext *ctx,
set_bit(rnum, ctx->vregs_updated);
if (is_predicated) {
set_bit(rnum, ctx->predicated_future_vregs);
+ } else {
+ set_bit(rnum, ctx->vregs_uncond);
}
}
if (type == EXT_NEW) {
@@ -238,6 +246,8 @@ static inline void ctx_log_vreg_write(DisasContext *ctx,
set_bit(rnum, ctx->vregs_updated_tmp);
if (is_predicated) {
set_bit(rnum, ctx->predicated_tmp_vregs);
+ } else {
+ set_bit(rnum, ctx->vregs_uncond);
}
}
}
diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
index 60441dc309..ca22bae28f 100644
--- a/target/hexagon/translate.c
+++ b/target/hexagon/translate.c
@@ -589,6 +589,8 @@ static void clear_pkt_ctx(DisasContext *ctx)
bitmap_zero(ctx->vregs_updated, NUM_VREGS);
bitmap_zero(ctx->vregs_select, NUM_VREGS);
bitmap_zero(ctx->predicated_future_vregs, NUM_VREGS);
+ bitmap_zero(ctx->vregs_multi_write, NUM_VREGS);
+ bitmap_zero(ctx->vregs_uncond, NUM_VREGS);
bitmap_zero(ctx->predicated_tmp_vregs, NUM_VREGS);
bitmap_zero(ctx->qregs_written, NUM_QREGS);
ctx->qreg_log_idx = 0;
@@ -608,6 +610,7 @@ static void clear_pkt_ctx(DisasContext *ctx)
static bool pkt_has_write_conflict(DisasContext *ctx)
{
DECLARE_BITMAP(gpr_conflict, TOTAL_PER_THREAD_REGS);
+ DECLARE_BITMAP(vregs_conflict, NUM_VREGS);
bitmap_and(gpr_conflict, ctx->gpr_multi_write, ctx->gpr_uncond,
TOTAL_PER_THREAD_REGS);
@@ -615,6 +618,12 @@ static bool pkt_has_write_conflict(DisasContext *ctx)
return true;
}
+ bitmap_and(vregs_conflict, ctx->vregs_multi_write, ctx->vregs_uncond,
+ NUM_VREGS);
+ if (!bitmap_empty(vregs_conflict, NUM_VREGS)) {
+ return true;
+ }
+
return false;
}
--
2.43.0