diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-26 19:11:07 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-05-26 19:11:07 +0000 |
commit | f3f478a7efe9dc76325d0c774ca2e728d465bbe0 (patch) | |
tree | 0491616950e7de7efb5be130384359ed57f4649f /tcg/ppc | |
parent | ef28fd86736f948625207c1015604e45939c0894 (diff) | |
download | hqemu-f3f478a7efe9dc76325d0c774ca2e728d465bbe0.zip hqemu-f3f478a7efe9dc76325d0c774ca2e728d465bbe0.tar.gz |
Fix signed/unsigned issues of immediate version of brcond (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4588 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tcg/ppc')
-rw-r--r-- | tcg/ppc/tcg-target.c | 59 |
1 files changed, 48 insertions, 11 deletions
diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c index 13f0fe5..4bbedba 100644 --- a/tcg/ppc/tcg-target.c +++ b/tcg/ppc/tcg-target.c @@ -866,18 +866,55 @@ static void tcg_out_brcond(TCGContext *s, int cond, int imm; uint32_t op; - imm = const_arg2 ? ((int16_t) arg2 == arg2) : 0; switch (cond) { - case TCG_COND_EQ: op = imm ? CMPLI : CMPL; break; - case TCG_COND_NE: op = imm ? CMPLI : CMPL; break; - case TCG_COND_LT: op = imm ? CMPI : CMP; break; - case TCG_COND_GE: op = imm ? CMPI : CMP; break; - case TCG_COND_LE: op = imm ? CMPI : CMP; break; - case TCG_COND_GT: op = imm ? CMPI : CMP; break; - case TCG_COND_LTU: op = imm ? CMPLI : CMPL; break; - case TCG_COND_GEU: op = imm ? CMPLI : CMPL; break; - case TCG_COND_LEU: op = imm ? CMPLI : CMPL; break; - case TCG_COND_GTU: op = imm ? CMPLI : CMPL; break; + case TCG_COND_EQ: + case TCG_COND_NE: + if (const_arg2) { + if ((int16_t) arg2 == arg2) { + op = CMPI; + imm = 1; + break; + } + else if ((uint16_t) arg2 == arg2) { + op = CMPLI; + imm = 1; + break; + } + } + op = CMPL; + imm = 0; + break; + + case TCG_COND_LT: + case TCG_COND_GE: + case TCG_COND_LE: + case TCG_COND_GT: + if (const_arg2) { + if ((int16_t) arg2 == arg2) { + op = CMPI; + imm = 1; + break; + } + } + op = CMP; + imm = 0; + break; + + case TCG_COND_LTU: + case TCG_COND_GEU: + case TCG_COND_LEU: + case TCG_COND_GTU: + if (const_arg2) { + if ((uint16_t) arg2 == arg2) { + op = CMPLI; + imm = 1; + break; + } + } + op = CMPL; + imm = 0; + break; + default: tcg_abort (); } |