s390x: Fix stoc direction
diff mbox

Message ID 1429062341-59863-1-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf April 15, 2015, 1:45 a.m. UTC
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(+)

Comments

Richard Henderson May 5, 2015, 11:41 p.m. UTC | #1
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~

Patch
diff mbox

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