s390x: Fix stoc direction
authorAlexander Graf <agraf@suse.de>
Wed, 15 Apr 2015 01:45:41 +0000 (03:45 +0200)
committerAlexander Graf <agraf@suse.de>
Wed, 13 May 2015 12:48:54 +0000 (14:48 +0200)
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>
Reviewed-by: Richard Henderson <rth@twiddle.net>
target-s390x/translate.c

index 8784112f4e62a1dc3be8f07cb119d788bb1d157a..fa3e334e4f022ca82d6f7d162fbb561903706ecb 100644 (file)
@@ -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);