aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-26 19:11:07 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2008-05-26 19:11:07 +0000
commitf3f478a7efe9dc76325d0c774ca2e728d465bbe0 (patch)
tree0491616950e7de7efb5be130384359ed57f4649f
parentef28fd86736f948625207c1015604e45939c0894 (diff)
downloadqemu-f3f478a7efe9dc76325d0c774ca2e728d465bbe0.zip
qemu-f3f478a7efe9dc76325d0c774ca2e728d465bbe0.tar.gz
qemu-f3f478a7efe9dc76325d0c774ca2e728d465bbe0.tar.bz2
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
-rw-r--r--tcg/ppc/tcg-target.c59
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 ();
}