[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 3/7] target-ppc: Fix Floating Point Move Instructions
From: |
Tom Musta |
Subject: |
[Qemu-ppc] [PATCH 3/7] target-ppc: Fix Floating Point Move Instructions That Set CR1 |
Date: |
Mon, 3 Nov 2014 14:01:13 -0600 |
The Floating Point Move instructions (fmr., fabs., fnabs., fneg.,
and fcpsgn.) incorrectly copy FPSCR[FPCC] instead of [FX,FEX,VX,OX].
Furthermore, the current code does this via a call to gen_compute_fprf,
which is awkward since these instructions do not actually set FPRF.
Change the code to use the newly added gen_set_cr1_from_fpscr
utility.
Signed-off-by: Tom Musta <address@hidden>
---
target-ppc/translate.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 7775bf4..9653ba9 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -2393,7 +2393,9 @@ static void gen_fabs(DisasContext *ctx)
}
tcg_gen_andi_i64(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rB(ctx->opcode)],
~(1ULL << 63));
- gen_compute_fprf(cpu_fpr[rD(ctx->opcode)], 0, Rc(ctx->opcode) != 0);
+ if (unlikely(Rc(ctx->opcode))) {
+ gen_set_cr1_from_fpscr();
+ }
}
/* fmr - fmr. */
@@ -2405,7 +2407,9 @@ static void gen_fmr(DisasContext *ctx)
return;
}
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rB(ctx->opcode)]);
- gen_compute_fprf(cpu_fpr[rD(ctx->opcode)], 0, Rc(ctx->opcode) != 0);
+ if (unlikely(Rc(ctx->opcode))) {
+ gen_set_cr1_from_fpscr();
+ }
}
/* fnabs */
@@ -2418,7 +2422,9 @@ static void gen_fnabs(DisasContext *ctx)
}
tcg_gen_ori_i64(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rB(ctx->opcode)],
1ULL << 63);
- gen_compute_fprf(cpu_fpr[rD(ctx->opcode)], 0, Rc(ctx->opcode) != 0);
+ if (unlikely(Rc(ctx->opcode))) {
+ gen_set_cr1_from_fpscr();
+ }
}
/* fneg */
@@ -2431,7 +2437,9 @@ static void gen_fneg(DisasContext *ctx)
}
tcg_gen_xori_i64(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rB(ctx->opcode)],
1ULL << 63);
- gen_compute_fprf(cpu_fpr[rD(ctx->opcode)], 0, Rc(ctx->opcode) != 0);
+ if (unlikely(Rc(ctx->opcode))) {
+ gen_set_cr1_from_fpscr();
+ }
}
/* fcpsgn: PowerPC 2.05 specification */
@@ -2444,7 +2452,9 @@ static void gen_fcpsgn(DisasContext *ctx)
}
tcg_gen_deposit_i64(cpu_fpr[rD(ctx->opcode)], cpu_fpr[rA(ctx->opcode)],
cpu_fpr[rB(ctx->opcode)], 0, 63);
- gen_compute_fprf(cpu_fpr[rD(ctx->opcode)], 0, Rc(ctx->opcode) != 0);
+ if (unlikely(Rc(ctx->opcode))) {
+ gen_set_cr1_from_fpscr();
+ }
}
static void gen_fmrgew(DisasContext *ctx)
--
1.7.1
- [Qemu-ppc] [PATCH 0/7] target-ppc: Assorted Floating Point Bugs and Cleanup, Tom Musta, 2014/11/03
- [Qemu-ppc] [PATCH 1/7] target-ppc: VXSQRT Should Not Be Set for NaNs, Tom Musta, 2014/11/03
- [Qemu-ppc] [PATCH 6/7] target-ppc: Eliminate set_fprf Argument From gen_compute_fprf, Tom Musta, 2014/11/03
- [Qemu-ppc] [PATCH 4/7] target-ppc: mffs. Should Set CR1 from FPSCR Bits, Tom Musta, 2014/11/03
- [Qemu-ppc] [PATCH 5/7] target-ppc: Fully Migrate to gen_set_cr1_from_fpscr, Tom Musta, 2014/11/03
- [Qemu-ppc] [PATCH 3/7] target-ppc: Fix Floating Point Move Instructions That Set CR1,
Tom Musta <=
- [Qemu-ppc] [PATCH 7/7] target-ppc: Eliminate set_fprf Argument From helper_compute_fprf, Tom Musta, 2014/11/03
- Re: [Qemu-ppc] [PATCH 0/7] target-ppc: Assorted Floating Point Bugs and Cleanup, Paolo Bonzini, 2014/11/04