qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] s390x: Fix stoc direction
@ 2015-04-15  1:45 Alexander Graf
  2015-05-05 23:41 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Graf @ 2015-04-15  1:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: afaerber, rth

The store conditional instruction wants to store when the condition
is fulfilled, so we should branch out when it's not true.

The code today branches out when the condition is true, clearly
reversing the logic. Fix it up by negating the condition.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-s390x/translate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index 4f82edd..8ae4912 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -3082,6 +3082,10 @@ static ExitStatus op_soc(DisasContext *s, DisasOps *o)
 
     disas_jcc(s, &c, get_field(s->fields, m3));
 
+    /* We want to store when the condition is fulfilled, so branch
+       out when it's not */
+    c.cond = tcg_invert_cond(c.cond);
+
     lab = gen_new_label();
     if (c.is_64) {
         tcg_gen_brcond_i64(c.cond, c.u.s64.a, c.u.s64.b, lab);
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] s390x: Fix stoc direction
  2015-04-15  1:45 [Qemu-devel] [PATCH] s390x: Fix stoc direction Alexander Graf
@ 2015-05-05 23:41 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2015-05-05 23:41 UTC (permalink / raw)
  To: Alexander Graf, qemu-devel; +Cc: afaerber

On 04/14/2015 06:45 PM, Alexander Graf wrote:
> The store conditional instruction wants to store when the condition
> is fulfilled, so we should branch out when it's not true.
> 
> The code today branches out when the condition is true, clearly
> reversing the logic. Fix it up by negating the condition.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  target-s390x/translate.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/target-s390x/translate.c b/target-s390x/translate.c
> index 4f82edd..8ae4912 100644
> --- a/target-s390x/translate.c
> +++ b/target-s390x/translate.c
> @@ -3082,6 +3082,10 @@ static ExitStatus op_soc(DisasContext *s, DisasOps *o)
>  
>      disas_jcc(s, &c, get_field(s->fields, m3));
>  
> +    /* We want to store when the condition is fulfilled, so branch
> +       out when it's not */
> +    c.cond = tcg_invert_cond(c.cond);

Doh.

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-05 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-15  1:45 [Qemu-devel] [PATCH] s390x: Fix stoc direction Alexander Graf
2015-05-05 23:41 ` Richard Henderson

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).