diff mbox

[3/3] target/s390x: implement serialization in BRANCH CONDITION

Message ID 20170509082800.10756-4-aurelien@aurel32.net (mailing list archive)
State New, archived
Headers show

Commit Message

Aurelien Jarno May 9, 2017, 8:28 a.m. UTC
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 target/s390x/translate.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Richard Henderson May 9, 2017, 2:16 p.m. UTC | #1
On 05/09/2017 01:28 AM, Aurelien Jarno wrote:
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
>   target/s390x/translate.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
> 
> diff --git a/target/s390x/translate.c b/target/s390x/translate.c
> index c58c27f8e9..2f07ce2be9 100644
> --- a/target/s390x/translate.c
> +++ b/target/s390x/translate.c
> @@ -1517,6 +1517,21 @@ static ExitStatus op_bc(DisasContext *s, DisasOps *o)
>       int imm = is_imm ? get_field(s->fields, i2) : 0;
>       DisasCompare c;
>   
> +    /* BCR with R2 = 0 causes no branching */
> +    if (have_field(s->fields, r2) && get_field(s->fields, r2) == 0) {
> +        if (m1 == 14) {
> +            /* Perform serialization */
> +            /* FIXME: check for fast-BCR-serialization facility */
> +            tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC);
> +        }
> +        if (m1 == 15) {
> +            /* Perform serialization */
> +            /* FIXME: perform checkpoint-synchronisation */

I don't know if we'll ever need to do anything with this side effect, but I 
guess it's good to document.

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


r~
diff mbox

Patch

diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index c58c27f8e9..2f07ce2be9 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -1517,6 +1517,21 @@  static ExitStatus op_bc(DisasContext *s, DisasOps *o)
     int imm = is_imm ? get_field(s->fields, i2) : 0;
     DisasCompare c;
 
+    /* BCR with R2 = 0 causes no branching */
+    if (have_field(s->fields, r2) && get_field(s->fields, r2) == 0) {
+        if (m1 == 14) {
+            /* Perform serialization */
+            /* FIXME: check for fast-BCR-serialization facility */
+            tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC);
+        }
+        if (m1 == 15) {
+            /* Perform serialization */
+            /* FIXME: perform checkpoint-synchronisation */
+            tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC);
+        }
+        return NO_EXIT;
+    }
+
     disas_jcc(s, &c, m1);
     return help_branch(s, &c, is_imm, imm, o->in2);
 }