Skip to content

Commit

Permalink
tcg/tci: Support TCG_COND_TST{EQ,NE}
Browse files Browse the repository at this point in the history
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Feb 5, 2024
1 parent 585b7a4 commit 23c5692
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions tcg/tci.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ static bool tci_compare32(uint32_t u0, uint32_t u1, TCGCond condition)
case TCG_COND_GTU:
result = (u0 > u1);
break;
case TCG_COND_TSTEQ:
result = (u0 & u1) == 0;
break;
case TCG_COND_TSTNE:
result = (u0 & u1) != 0;
break;
default:
g_assert_not_reached();
}
Expand Down Expand Up @@ -270,6 +276,12 @@ static bool tci_compare64(uint64_t u0, uint64_t u1, TCGCond condition)
case TCG_COND_GTU:
result = (u0 > u1);
break;
case TCG_COND_TSTEQ:
result = (u0 & u1) == 0;
break;
case TCG_COND_TSTNE:
result = (u0 & u1) != 0;
break;
default:
g_assert_not_reached();
}
Expand Down Expand Up @@ -1041,6 +1053,8 @@ static const char *str_c(TCGCond c)
[TCG_COND_GEU] = "geu",
[TCG_COND_LEU] = "leu",
[TCG_COND_GTU] = "gtu",
[TCG_COND_TSTEQ] = "tsteq",
[TCG_COND_TSTNE] = "tstne",
};

assert((unsigned)c < ARRAY_SIZE(cond));
Expand Down
2 changes: 1 addition & 1 deletion tcg/tci/tcg-target.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@

#define TCG_TARGET_HAS_qemu_ldst_i128 0

#define TCG_TARGET_HAS_tst 0
#define TCG_TARGET_HAS_tst 1

/* Number of registers available. */
#define TCG_TARGET_NB_REGS 16
Expand Down

0 comments on commit 23c5692

Please sign in to comment.