CR16C: fix incorrect comparison behavior for CMP

evaluation of conditions for flags L and N was swapped around. Programmer's reference:
"PSR.L is set to 1 if src1 is greater than src2 (unsigned comparison)"
"PSR.N is set to 1 if src1 is greater than src2 (signed comparison)"
This commit is contained in:
fridtjof 2026-05-13 15:07:24 +02:00
parent b19e4e7977
commit 3d9c95541b

View file

@ -699,8 +699,8 @@ static bool trans_MACSW(DisasContext *ctx, arg_MACSW *a) {
static void gen_cmp(TCGv_i32 src1, TCGv_i32 src2) {
tcg_gen_setcond_i32(TCG_COND_EQ, psr_z, src1, src2);
tcg_gen_setcond_i32(TCG_COND_GT, psr_l, src1, src2);
tcg_gen_setcond_i32(TCG_COND_GTU, psr_n, src1, src2);
tcg_gen_setcond_i32(TCG_COND_GTU, psr_l, src1, src2);
tcg_gen_setcond_i32(TCG_COND_GT, psr_n, src1, src2);
}
static bool trans_CMP_imm(DisasContext *ctx, arg_CMP_imm *a) {