From patchwork Sat Nov 12 07:56:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 624223 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1248070pvb; Fri, 11 Nov 2022 23:57:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf7rIUTHrbLbHecXsPi1CTVSkqI/xYpeLbWPRCvNFRKDQfsh4jLsvx9JRlEGR5j+9VCftdrn X-Received: by 2002:a37:4117:0:b0:6f9:810e:13e9 with SMTP id o23-20020a374117000000b006f9810e13e9mr4038782qka.229.1668239834805; Fri, 11 Nov 2022 23:57:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668239834; cv=none; d=google.com; s=arc-20160816; b=B4pPrPBk4hcb80drdXk2J1lXQE2KK5cYimO8lWgbYR8IsHOm8iLu5g72CMqq5u3IMK ATm3KqDLbNCb4Fbf0uSKO7X7Q3jZoq6u7obQfz7aM2JglEzL6AorSOSor3u8A0sHFjpp vcQ78gY9G8sbMQjhs76+T415ELBIlwfmPuY9bbY3Wxl/JJWIXEPZQHQe8J0p/1Rv8O4C krIdsCfydz5SrrKSuT1bku+ZSWs/h1PupZlswU6yF/FYCw4FB39/v++6xch8PIt67Qd0 ZcCFnGWLVX1kdF67xxNwanKsw1HaVknTxal9JDjLHy2Q0WF3jxgbR1COMQ0x+3WntWpf bERQ== 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=qw1tQpgpqGjwOWEsHHDVfFOA6fud/wYsdJ0Bljtybvo=; b=DxTx1ofjM0O6OHWsDcUr6T40/IDED9miYzm9S3TDkpVgp8h1U4spN7yHkWsiiH3J/R 00gqfKnL0ngM5k/FDRRGPDnnbInmIG+YlgL4s7kVRT23n3Hn3Cl0XwbC7VdWmcraZXtz 1ek6lIvbjy7RXoWXnXFh4n+7HQ2GHiHaRmzSs+OeNYuGwIbJxIxPbFXunf2ayymi0mEu snwRA0P+h1oC6YCzNvLjxa6RqTRgBhm893+w3caiD1CR3MzYm+8hwk/kJzLeuMaA5b5/ OrnNdRqrVhHJBrzUPFsshxI8+wlQU5VeqPOS2VWA7NBY3g9gv+8qB6yWhPAj94yAA9CW IryA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yPdh0Jqb; 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 br17-20020a05622a1e1100b003a4ee891306si2406961qtb.725.2022.11.11.23.57.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Nov 2022 23:57:14 -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=yPdh0Jqb; 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 1otlNt-0006AA-6V; Sat, 12 Nov 2022 02:57:01 -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 1otlNp-00069i-HJ for qemu-devel@nongnu.org; Sat, 12 Nov 2022 02:56:57 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otlNn-0008Bg-OX for qemu-devel@nongnu.org; Sat, 12 Nov 2022 02:56:57 -0500 Received: by mail-pj1-x1032.google.com with SMTP id d13-20020a17090a3b0d00b00213519dfe4aso6501779pjc.2 for ; Fri, 11 Nov 2022 23:56:55 -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=qw1tQpgpqGjwOWEsHHDVfFOA6fud/wYsdJ0Bljtybvo=; b=yPdh0JqbVJqLF4ge0ZEF8z/Mvj46uHEhEmBxWuT7G3YCb4yrBVHy+qaiBsM9kxxWmR vvW1zbCvumKq6ZHeKe02yHDAUP9r+3nOs8+gPFMvV+wtZblCBaE/x6YVpap8w4zwIVYx Iyhu/qk/pfWd2WRk+2voqE2cP4e4FEqpNteMVVCbQsiMGIHnEEK9RB9JYzkNIa1pX+5v 065PlYokLlA7R6a5ZILy13hRX80zhtQETGryjwywrF10VsU3ComkbPY/1Dinnmx5STxb Qt+r8lhIxmit7FZ7qkW7GJmCsjr9pBcOhd1y/xvPdfsluIFT/uvPSugHyxNXcrqjqXb+ Yaig== 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=qw1tQpgpqGjwOWEsHHDVfFOA6fud/wYsdJ0Bljtybvo=; b=tyc6FvSVdKJW7lPnbBQQ1zpnnys3pIvodZ8F4p/bgog+bWF80ZuH0/4CNIQqCpr92A cStd3mih29ZP7nzJ1I9Ey1hI7Q8fLqqTrlSRSub+6lnAAKnG9N1g5ATyV4upAoqz99A0 ct4vY3+xqMdGcHIU4IAUqfgGo8JYyVz3N+YefsQCIQbhw05TUouYrDy9VcRKspvpCc+V UPlUgDFoLaS4yyJghgRtgUn2VOyzvbKxhnCQkHdWTKP3ZXsW6FM9gU4aiAzqCGYAaIZu 2qd/HyfnxXjlBZV8iRNFyi4N0JNpKPZTztOoxEbOxPJB6ULhEpc1fFKw2ETI8aJlYZLA DqIw== X-Gm-Message-State: ANoB5pkL+PpMUqbtjBqpJqANoZd0kjQnLOdRzelZkg9OQ3vu0sUiUcYb DUseMVa9AWqNnAszQSuuYox1nNsVzDjeohAj X-Received: by 2002:a17:902:d64f:b0:186:6381:f180 with SMTP id y15-20020a170902d64f00b001866381f180mr5726125plh.100.1668239814279; Fri, 11 Nov 2022 23:56:54 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-8228-b676-fb42-ee07.static.ipv6.internode.on.net. [2001:44b8:2176:c800:8228:b676:fb42:ee07]) by smtp.gmail.com with ESMTPSA id m8-20020a17090a71c800b00213d08fa459sm2743062pjs.17.2022.11.11.23.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 23:56:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, eduardo@habkost.net Subject: [PATCH for-8.0 1/3] target/i386: Split out gen_cmpxchg8b, gen_cmpxchg16b Date: Sat, 12 Nov 2022 17:56:43 +1000 Message-Id: <20221112075645.2850679-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221112075645.2850679-1-richard.henderson@linaro.org> References: <20221112075645.2850679-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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=ham 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 --- 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 28a4e6dc1d..1175540a2c 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -2974,6 +2974,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) @@ -3814,28 +3842,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 */