From patchwork Sun Jan 8 02:37:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 640367 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp1520264pvb; Sat, 7 Jan 2023 18:52:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXv4vCnYl9p2BuAL97WyJLleKY63rneMzBdIm3l/GIRy7X4mrhPu4oToGXtDFgcNeY6MUEym X-Received: by 2002:a0c:ea8e:0:b0:532:2d0e:7e3b with SMTP id d14-20020a0cea8e000000b005322d0e7e3bmr539896qvp.37.1673146322540; Sat, 07 Jan 2023 18:52:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673146322; cv=none; d=google.com; s=arc-20160816; b=ATb+VdYR+1SwJVNBvjiPIuYRWyoK2QDwEAjXbGhYf8MvOX+wFIEl1CthdltRI8nlP8 4j7GBK+LjU4jHuvYdJnpC8c1o6v70LnYl3zsBgIjM7r8EU6O2Zpqi07lfsfgXPnWb9fH T96epAd4msxtbU7wV+PK3NogTJ72EC+F+rq80EqwlHreDfbmjB9iICfhGBS3rJwPDXxw Y5T61ga3xppD3YRvZ3zs4LKK0F6DrranY0QgjrmBRjx0DOkYA5vo6lck8Y4gt9WdRqEm BVDS62nDYKKwaQsw5TXwB1Jd/TkfYtUnH0Fn6hezqezFdbx7uLbPX7255Grpi5jlgGkd z7VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9ScRTiCetY4GULFmLSkWpnFNmGzWjdbMDLDjsbqu5fo=; b=Y6SbafDwAdxXh1Hpn2kMeVV3vOVTlrDKFOz856vI0IIpLIiU1cs5TDxTf2nZchzBH9 y0k6QTpopV27O7tRqPP632hirwIfEvBggyyod1G4JMJyGnhzPsHgV7MFeSLvO7p8ToXD cChw3Yc62ohCZqYzLiRDScYYZhLqxSxH5TFSKV2hwQTWCLm5GaYuHbOTTFnZkEfhHsqH rMNeb7y77Hf/gScR8Jz0c9+2LntlU0zRe9UGuSLnrwdEVDsUOoKfefhfrH5wlHVGKJXt yAykBHG8zbrQZMIKrc/0zMSKMy8ZS6gtWylZJcxLZWeQttcOOWGZSRfrZ3c+ULn4S2wi UiYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TOAXi5LN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r13-20020a0562140c8d00b0053191080697si2678550qvr.593.2023.01.07.18.52.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Jan 2023 18:52:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TOAXi5LN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pELai-0006mx-G4; Sat, 07 Jan 2023 21:39:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pELaR-0006Zq-Lh for qemu-devel@nongnu.org; Sat, 07 Jan 2023 21:39:03 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pELZP-0004UT-P7 for qemu-devel@nongnu.org; Sat, 07 Jan 2023 21:39:03 -0500 Received: by mail-pl1-x62d.google.com with SMTP id d9so5859943pll.9 for ; Sat, 07 Jan 2023 18:37:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9ScRTiCetY4GULFmLSkWpnFNmGzWjdbMDLDjsbqu5fo=; b=TOAXi5LNjIeY1nkvmNKr1LLyMMYFpHORFQuq1LndUTcqcW19FupH/WNFkTSqWN4rLE 4wt69j5xi2rQiFDqzem5zig+c29iLZJ3+RjDM4qc0pGvl0RBfz5lt/FgLanpFmqCMnVe PozALU5VBxd7h63o5rnKun4r2UJG/Wy2z0TlXW7JJRWi9wle9q9/gq05rab5xS7J1Gjw 93X6ifPoHPkeQy5TEZmmbUb3P0BufSHolivO079loX6zKFFFQM6E3Uvl4A4rLZ/DhVlz OJbGCtNekzyKOBmqHMtlCB+qWSqO+ZvqbLTVvFBXDigWzanuETn8rNH70KE30/ywiPds AbTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9ScRTiCetY4GULFmLSkWpnFNmGzWjdbMDLDjsbqu5fo=; b=hreBfG2ryoIy1G4Bsow39FG/pWcks8HKiEPQfoVkwnk03pTDnY9uONb0ZMh2//EmOG CzVjlW25ModcKVXIYFIggpT2PQ4nd5fXBiDenQH85aR4cdXy26BQMebkFwSZiR0ZdwCe UQsIY4UfoYqsVfUqLaBV9XvxEgAlePimklh1N9GelA1T5ZfSKHlHGg+TPjIKO5nNeLWr wnSlfZS9jpoAqeJi4E/KCibcmnBVbw4gjDlIBEtaSwilNHJ63fcrl6vF6v8Agp5sb4Jq MWOypkfFKunv5bvva2UJ+3sDDFYmQXmy77LNLqdEN52vbjrf8p27yYw9ljLBUO282tFY hf4w== X-Gm-Message-State: AFqh2kqwiSOqWmVn16gdQ/PGj4rEPjZA0tSd9FVOjcpyYaFn5zXkUfcn LBd+IuAkKNSy3fdWIGNqpsIcAgal3jw6dbLr X-Received: by 2002:a17:902:cf09:b0:191:3e64:a5ff with SMTP id i9-20020a170902cf0900b001913e64a5ffmr83605253plg.68.1673145479006; Sat, 07 Jan 2023 18:37:59 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:8a2d:2011:f402:6f82]) by smtp.gmail.com with ESMTPSA id o17-20020a170902d4d100b00189d4c666c8sm3394775plg.153.2023.01.07.18.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Jan 2023 18:37:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, qemu-riscv@nongnu.org, pbonzini@redhat.com, eduardo@habkost.net Subject: [PATCH v4 34/36] target/i386: Split out gen_cmpxchg8b, gen_cmpxchg16b Date: Sat, 7 Jan 2023 18:37:17 -0800 Message-Id: <20230108023719.2466341-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230108023719.2466341-1-richard.henderson@linaro.org> References: <20230108023719.2466341-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/i386/tcg/translate.c | 48 ++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 7e0b2a709a..a82131d635 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2993,6 +2993,34 @@ static void gen_sty_env_A0(DisasContext *s, int offset, bool align) #include "emit.c.inc" #include "decode-new.c.inc" +static void gen_cmpxchg8b(DisasContext *s, CPUX86State *env, int modrm) +{ + gen_lea_modrm(env, s, modrm); + + if ((s->prefix & PREFIX_LOCK) && + (tb_cflags(s->base.tb) & CF_PARALLEL)) { + gen_helper_cmpxchg8b(cpu_env, s->A0); + } else { + gen_helper_cmpxchg8b_unlocked(cpu_env, s->A0); + } + set_cc_op(s, CC_OP_EFLAGS); +} + +#ifdef TARGET_X86_64 +static void gen_cmpxchg16b(DisasContext *s, CPUX86State *env, int modrm) +{ + gen_lea_modrm(env, s, modrm); + + if ((s->prefix & PREFIX_LOCK) && + (tb_cflags(s->base.tb) & CF_PARALLEL)) { + gen_helper_cmpxchg16b(cpu_env, s->A0); + } else { + gen_helper_cmpxchg16b_unlocked(cpu_env, s->A0); + } + set_cc_op(s, CC_OP_EFLAGS); +} +#endif + /* convert one instruction. s->base.is_jmp is set if the translation must be stopped. Return the next pc value */ static bool disas_insn(DisasContext *s, CPUState *cpu) @@ -3844,28 +3872,14 @@ static bool disas_insn(DisasContext *s, CPUState *cpu) if (!(s->cpuid_ext_features & CPUID_EXT_CX16)) { goto illegal_op; } - gen_lea_modrm(env, s, modrm); - if ((s->prefix & PREFIX_LOCK) && - (tb_cflags(s->base.tb) & CF_PARALLEL)) { - gen_helper_cmpxchg16b(cpu_env, s->A0); - } else { - gen_helper_cmpxchg16b_unlocked(cpu_env, s->A0); - } - set_cc_op(s, CC_OP_EFLAGS); + gen_cmpxchg16b(s, env, modrm); break; } -#endif +#endif if (!(s->cpuid_features & CPUID_CX8)) { goto illegal_op; } - gen_lea_modrm(env, s, modrm); - if ((s->prefix & PREFIX_LOCK) && - (tb_cflags(s->base.tb) & CF_PARALLEL)) { - gen_helper_cmpxchg8b(cpu_env, s->A0); - } else { - gen_helper_cmpxchg8b_unlocked(cpu_env, s->A0); - } - set_cc_op(s, CC_OP_EFLAGS); + gen_cmpxchg8b(s, env, modrm); break; case 7: /* RDSEED */