* [Qemu-devel] [PATCH] target-mips: fix conditional moves off fp condition codes
@ 2009-08-25 15:20 Nathan Froyd
2009-08-25 16:07 ` [Qemu-devel] " Aurelien Jarno
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Froyd @ 2009-08-25 15:20 UTC (permalink / raw)
To: qemu-devel; +Cc: aurelien
Conditional moves off fp condition codes were using the result of
get_fp_bit to isolate and test the relevant condition code. However,
get_fp_bit returns the bit number of the condition code, not a
bitmask. (Compare the use of get_fp_bit in gen_compute_branch1, for
instance.)
Fixed by shifting a bitmask into place using the result of get_fp_bit in
the relevant functions (gen_mov{ci,cf_s,cf_d,cf_ps}).
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
---
target-mips/translate.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 6a1273f..a2b2edb 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -5896,7 +5896,7 @@ static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf)
l1 = gen_new_label();
t0 = tcg_temp_new_i32();
- tcg_gen_andi_i32(t0, fpu_fcr31, get_fp_bit(cc));
+ tcg_gen_andi_i32(t0, fpu_fcr31, 1 << get_fp_bit(cc));
tcg_gen_brcondi_i32(cond, t0, 0, l1);
tcg_temp_free_i32(t0);
if (rs == 0) {
@@ -5918,7 +5918,7 @@ static inline void gen_movcf_s (int fs, int fd, int cc, int tf)
else
cond = TCG_COND_NE;
- tcg_gen_andi_i32(t0, fpu_fcr31, get_fp_bit(cc));
+ tcg_gen_andi_i32(t0, fpu_fcr31, 1 << get_fp_bit(cc));
tcg_gen_brcondi_i32(cond, t0, 0, l1);
gen_load_fpr32(t0, fs);
gen_store_fpr32(t0, fd);
@@ -5938,7 +5938,7 @@ static inline void gen_movcf_d (DisasContext *ctx, int fs, int fd, int cc, int t
else
cond = TCG_COND_NE;
- tcg_gen_andi_i32(t0, fpu_fcr31, get_fp_bit(cc));
+ tcg_gen_andi_i32(t0, fpu_fcr31, 1 << get_fp_bit(cc));
tcg_gen_brcondi_i32(cond, t0, 0, l1);
tcg_temp_free_i32(t0);
fp0 = tcg_temp_new_i64();
@@ -5960,13 +5960,13 @@ static inline void gen_movcf_ps (int fs, int fd, int cc, int tf)
else
cond = TCG_COND_NE;
- tcg_gen_andi_i32(t0, fpu_fcr31, get_fp_bit(cc));
+ tcg_gen_andi_i32(t0, fpu_fcr31, 1 << get_fp_bit(cc));
tcg_gen_brcondi_i32(cond, t0, 0, l1);
gen_load_fpr32(t0, fs);
gen_store_fpr32(t0, fd);
gen_set_label(l1);
- tcg_gen_andi_i32(t0, fpu_fcr31, get_fp_bit(cc+1));
+ tcg_gen_andi_i32(t0, fpu_fcr31, 1 << get_fp_bit(cc+1));
tcg_gen_brcondi_i32(cond, t0, 0, l2);
gen_load_fpr32h(t0, fs);
gen_store_fpr32h(t0, fd);
--
1.6.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] Re: [PATCH] target-mips: fix conditional moves off fp condition codes
2009-08-25 15:20 [Qemu-devel] [PATCH] target-mips: fix conditional moves off fp condition codes Nathan Froyd
@ 2009-08-25 16:07 ` Aurelien Jarno
0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2009-08-25 16:07 UTC (permalink / raw)
To: Nathan Froyd; +Cc: qemu-devel
Nathan Froyd a écrit :
> Conditional moves off fp condition codes were using the result of
> get_fp_bit to isolate and test the relevant condition code. However,
> get_fp_bit returns the bit number of the condition code, not a
> bitmask. (Compare the use of get_fp_bit in gen_compute_branch1, for
> instance.)
>
> Fixed by shifting a bitmask into place using the result of get_fp_bit in
> the relevant functions (gen_mov{ci,cf_s,cf_d,cf_ps}).
>
Thanks, applied to both master and stable.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-08-25 16:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-25 15:20 [Qemu-devel] [PATCH] target-mips: fix conditional moves off fp condition codes Nathan Froyd
2009-08-25 16:07 ` [Qemu-devel] " Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).