From nobody Tue Feb 10 06:58:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508543458924392.0695833531695; Fri, 20 Oct 2017 16:50:58 -0700 (PDT) Received: from localhost ([::1]:56105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5h41-0007bE-0m for importer@patchew.org; Fri, 20 Oct 2017 19:50:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5gbI-0006HB-GS for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5gbH-0007oG-8m for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:12 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:51597) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5gbH-0007no-1X for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:11 -0400 Received: by mail-pf0-x243.google.com with SMTP id n14so13059191pfh.8 for ; Fri, 20 Oct 2017 16:21:10 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-165-104.tukw.qwest.net. [97.113.165.104]) by smtp.gmail.com with ESMTPSA id a17sm3532594pfk.173.2017.10.20.16.21.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2017 16:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b2CHv8ZbWwK/h/iHEPhOUtRtKbpIkwlFvDhfeRmqI70=; b=GymWqQJCUaePnWxylESmifGXQlfqiCu3pj/dP+6jgKmXRyE4hO2c2yGts0Ez9NyJfJ iXCoH4gRM5MqG0qhMwDUVUwzQz1e36h03B238OC9OU+nrR4qA8o29CepMlT0E31sGCTk 3mPup2TqXsKfU1/HpkQJKIU4wXp3Pz81MS1Bs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=b2CHv8ZbWwK/h/iHEPhOUtRtKbpIkwlFvDhfeRmqI70=; b=XmjZFqBjiCLeLj8tNh0KR3QfLoddJot0TZEGFAvUpVajY1+RFMpGSPecAeljvJN5pl Hr58eXH7Wv0XV19WpUEWeBa73dtXxEq/9Hn+zq21YZEx0dq651OkH0eM34gyGq2Uo53L R+LFIlU6CChcqBn4fbK78VG1kXRKBLdN9BqIwFU8Ey6oNde3EvrZuLsi58Y3C/OuUq2A CXtd4rXsN85juYuMJyKFdgdJS+Lc82EJfiUSpGFO8I/w9XbzHzrx+t91flYQNVz1tIar Uxyqsa1KSSXmuAz0gyPHoSdn1Zr/ZMSmy/ETOIg3sI+Iy348HUysHnTFZ/wzlt7EDNMk wgaw== X-Gm-Message-State: AMCzsaWfuLJKzkndP1xrMZl3wjdSG34NCep6f8mGcXdDWlFOvfLhg04H gge7z5jhhNqHwbOKKODAFPpg6dVEER0= X-Google-Smtp-Source: ABhQp+QbDZomc8SebKJuqSTjZj5bisc/9ROHBO2N6ip8KkFu0HQfBD1bShoUhUCxGiasyd9AazkyWQ== X-Received: by 10.159.242.137 with SMTP id u9mr5262955plr.243.1508541669484; Fri, 20 Oct 2017 16:21:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 20 Oct 2017 16:20:01 -0700 Message-Id: <20171020232023.15010-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171020232023.15010-1-richard.henderson@linaro.org> References: <20171020232023.15010-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH v7 30/52] target/m68k: check CF_PARALLEL instead of parallel_cpus X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, cota@braap.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Emilio G. Cota" Thereby decoupling the resulting translated code from the current state of the system. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Richard Henderson --- target/m68k/helper.h | 1 + target/m68k/op_helper.c | 33 ++++++++++++++++++++------------- target/m68k/translate.c | 12 ++++++++++-- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/target/m68k/helper.h b/target/m68k/helper.h index 475a1f2186..eebe52dae5 100644 --- a/target/m68k/helper.h +++ b/target/m68k/helper.h @@ -11,6 +11,7 @@ DEF_HELPER_2(set_sr, void, env, i32) DEF_HELPER_3(movec, void, env, i32, i32) DEF_HELPER_4(cas2w, void, env, i32, i32, i32) DEF_HELPER_4(cas2l, void, env, i32, i32, i32) +DEF_HELPER_4(cas2l_parallel, void, env, i32, i32, i32) =20 #define dh_alias_fp ptr #define dh_ctype_fp FPReg * diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 7b5126c88d..63089511cb 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -361,6 +361,7 @@ void HELPER(divsll)(CPUM68KState *env, int numr, int re= gr, int32_t den) env->dregs[numr] =3D quot; } =20 +/* We're executing in a serial context -- no need to be atomic. */ void HELPER(cas2w)(CPUM68KState *env, uint32_t regs, uint32_t a1, uint32_t= a2) { uint32_t Dc1 =3D extract32(regs, 9, 3); @@ -374,17 +375,11 @@ void HELPER(cas2w)(CPUM68KState *env, uint32_t regs, = uint32_t a1, uint32_t a2) int16_t l1, l2; uintptr_t ra =3D GETPC(); =20 - if (parallel_cpus) { - /* Tell the main loop we need to serialize this insn. */ - cpu_loop_exit_atomic(ENV_GET_CPU(env), ra); - } else { - /* We're executing in a serial context -- no need to be atomic. */ - l1 =3D cpu_lduw_data_ra(env, a1, ra); - l2 =3D cpu_lduw_data_ra(env, a2, ra); - if (l1 =3D=3D c1 && l2 =3D=3D c2) { - cpu_stw_data_ra(env, a1, u1, ra); - cpu_stw_data_ra(env, a2, u2, ra); - } + l1 =3D cpu_lduw_data_ra(env, a1, ra); + l2 =3D cpu_lduw_data_ra(env, a2, ra); + if (l1 =3D=3D c1 && l2 =3D=3D c2) { + cpu_stw_data_ra(env, a1, u1, ra); + cpu_stw_data_ra(env, a2, u2, ra); } =20 if (c1 !=3D l1) { @@ -399,7 +394,8 @@ void HELPER(cas2w)(CPUM68KState *env, uint32_t regs, ui= nt32_t a1, uint32_t a2) env->dregs[Dc2] =3D deposit32(env->dregs[Dc2], 0, 16, l2); } =20 -void HELPER(cas2l)(CPUM68KState *env, uint32_t regs, uint32_t a1, uint32_t= a2) +static void do_cas2l(CPUM68KState *env, uint32_t regs, uint32_t a1, uint32= _t a2, + bool parallel) { uint32_t Dc1 =3D extract32(regs, 9, 3); uint32_t Dc2 =3D extract32(regs, 6, 3); @@ -416,7 +412,7 @@ void HELPER(cas2l)(CPUM68KState *env, uint32_t regs, ui= nt32_t a1, uint32_t a2) TCGMemOpIdx oi; #endif =20 - if (parallel_cpus) { + if (parallel) { /* We're executing in a parallel context -- must be atomic. */ #ifdef CONFIG_ATOMIC64 uint64_t c, u, l; @@ -470,6 +466,17 @@ void HELPER(cas2l)(CPUM68KState *env, uint32_t regs, u= int32_t a1, uint32_t a2) env->dregs[Dc2] =3D l2; } =20 +void HELPER(cas2l)(CPUM68KState *env, uint32_t regs, uint32_t a1, uint32_t= a2) +{ + do_cas2l(env, regs, a1, a2, false); +} + +void HELPER(cas2l_parallel)(CPUM68KState *env, uint32_t regs, uint32_t a1, + uint32_t a2) +{ + do_cas2l(env, regs, a1, a2, true); +} + struct bf_data { uint32_t addr; uint32_t bofs; diff --git a/target/m68k/translate.c b/target/m68k/translate.c index fdc26268d0..d751faed7c 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -2312,7 +2312,11 @@ DISAS_INSN(cas2w) (REG(ext1, 6) << 3) | (REG(ext2, 0) << 6) | (REG(ext1, 0) << 9)); - gen_helper_cas2w(cpu_env, regs, addr1, addr2); + if (tb_cflags(s->tb) & CF_PARALLEL) { + gen_helper_exit_atomic(cpu_env); + } else { + gen_helper_cas2w(cpu_env, regs, addr1, addr2); + } tcg_temp_free(regs); =20 /* Note that cas2w also assigned to env->cc_op. */ @@ -2358,7 +2362,11 @@ DISAS_INSN(cas2l) (REG(ext1, 6) << 3) | (REG(ext2, 0) << 6) | (REG(ext1, 0) << 9)); - gen_helper_cas2l(cpu_env, regs, addr1, addr2); + if (tb_cflags(s->tb) & CF_PARALLEL) { + gen_helper_cas2l_parallel(cpu_env, regs, addr1, addr2); + } else { + gen_helper_cas2l(cpu_env, regs, addr1, addr2); + } tcg_temp_free(regs); =20 /* Note that cas2l also assigned to env->cc_op. */ --=20 2.13.6