[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/12] target-lm32: fix cmpgui and cmpgeui opcodes
From: |
Michael Walle |
Subject: |
[Qemu-devel] [PATCH 07/12] target-lm32: fix cmpgui and cmpgeui opcodes |
Date: |
Wed, 6 Mar 2013 23:00:04 +0100 |
For unsigned compares the immediate has to be zero extended.
Signed-off-by: Michael Walle <address@hidden>
---
target-lm32/translate.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index f51ffc5..e885bb3 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -324,10 +324,20 @@ static inline void gen_compare(DisasContext *dc, int cond)
int rX = (dc->format == OP_FMT_RR) ? dc->r2 : dc->r1;
int rY = (dc->format == OP_FMT_RR) ? dc->r0 : dc->r0;
int rZ = (dc->format == OP_FMT_RR) ? dc->r1 : -1;
+ int i;
if (dc->format == OP_FMT_RI) {
- tcg_gen_setcondi_tl(cond, cpu_R[rX], cpu_R[rY],
- sign_extend(dc->imm16, 16));
+ switch (cond) {
+ case TCG_COND_GEU:
+ case TCG_COND_GTU:
+ i = zero_extend(dc->imm16, 16);
+ break;
+ default:
+ i = sign_extend(dc->imm16, 16);
+ break;
+ }
+
+ tcg_gen_setcondi_tl(cond, cpu_R[rX], cpu_R[rY], i);
} else {
tcg_gen_setcond_tl(cond, cpu_R[rX], cpu_R[rY], cpu_R[rZ]);
}
@@ -373,7 +383,7 @@ static void dec_cmpgeu(DisasContext *dc)
{
if (dc->format == OP_FMT_RI) {
LOG_DIS("cmpgeui r%d, r%d, %d\n", dc->r0, dc->r1,
- sign_extend(dc->imm16, 16));
+ zero_extend(dc->imm16, 16));
} else {
LOG_DIS("cmpgeu r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1);
}
@@ -385,7 +395,7 @@ static void dec_cmpgu(DisasContext *dc)
{
if (dc->format == OP_FMT_RI) {
LOG_DIS("cmpgui r%d, r%d, %d\n", dc->r0, dc->r1,
- sign_extend(dc->imm16, 16));
+ zero_extend(dc->imm16, 16));
} else {
LOG_DIS("cmpgu r%d, r%d, r%d\n", dc->r2, dc->r0, dc->r1);
}
--
1.7.2.5
- [Qemu-devel] [PATCH 02/12] lm32-dis: fix NULL pointer dereference, (continued)
- [Qemu-devel] [PATCH 02/12] lm32-dis: fix NULL pointer dereference, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 01/12] target-lm32: fix debug memory access, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 03/12] milkymist-uart: fix receive buffering, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 04/12] lm32_uart: fix receive buffering, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 05/12] target-lm32: don't log cpu state in translation, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 09/12] target-lm32: flush tlb after clearing env, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 08/12] target-lm32: remove dead code, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 06/12] tests: tcg: lm32: add more test cases, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 12/12] configure: rename OpenGL feature to GLX, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 11/12] configure: proper OpenGL/GLX probe, Michael Walle, 2013/03/06
- [Qemu-devel] [PATCH 07/12] target-lm32: fix cmpgui and cmpgeui opcodes,
Michael Walle <=
- [Qemu-devel] [PATCH 10/12] target-lm32: use HELPER() macro, Michael Walle, 2013/03/06