From patchwork Thu May 11 08:04:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 680899 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp3269334wrs; Thu, 11 May 2023 01:17:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4fPam4bnmGjrRuPC4cJ4OH0UfhstMUbhCxcBPa02IAEXPvkEG64BPgelTGF2/W99C8WqJV X-Received: by 2002:a05:622a:194:b0:3ef:231c:cee7 with SMTP id s20-20020a05622a019400b003ef231ccee7mr36235981qtw.7.1683793040805; Thu, 11 May 2023 01:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683793040; cv=none; d=google.com; s=arc-20160816; b=LE+nz03Djnp8GCGt7gIJ0q4DBZifKS804rxlSMc0bUPXJfxTBcm88FgVa+/6Eq5jkS pSYpkui3QbCWnUlXwkSdCsyR1xsN7bx/D/BXIqTtamfi5E86JQx8cVspxtTnCBhrHUMw 3B/rkuIaJOMyqt3FMaLVzxv9k93ZdtW+jpJY7r+rC58gFTU8VLZTWE7Zj5B2vNSauZte d2EJYt3DExwKceC3uWnlyHKMz53NcP9+7BPocUau8E7A1NIflj2oMhpJ5K8y7B8/+0Wk VvGGV6oj491K+RgKHlIhoZiVZi3Pj1Km1hs2vIDCqZN/A496Yzc8c+G2T4qjdK1FjrM/ 4oJA== 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=f+t7z0FUWlRAicpheOk0qlu8uMDwmd02otcOLGaJHHo=; b=yyGO0ZRmDwVOxZz5sv172LpjUnrWrXgX5gZqnq6D9kpLsneNRQ7rszazCFHsYxssxC 7z+wTGCMKTmDvaopmmL7SOc9ZpyzCJZCFimeNGJfPIV3xr3api0J96UC4+A771ZTQLbx m+zyU+oYrju/4XptQ0b/dqtr/yVCWoqbpLKeXLHo/w1DHsPS0H2P92IpB31xNBqcIgt3 ETB/iIurb50G8C/JMnw/5jzS+ijVM5DMmHhJJehdgezf3wnSGqN1VA4PuS1sU+xWOCQf juatRH27I9tcmWDcSWykFdlrrhGjPhtIdJn7KpvJxRetSHrG27latjQzMzWXqXuRiqD4 GZJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jeqC4jRk; 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 u22-20020a05622a199600b003ef37306816si2923721qtc.791.2023.05.11.01.17.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 May 2023 01:17:20 -0700 (PDT) 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=jeqC4jRk; 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 1px1Id-0006QK-Fk; Thu, 11 May 2023 04:05:19 -0400 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 1px1IO-0006JV-Vs for qemu-devel@nongnu.org; Thu, 11 May 2023 04:05:05 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1px1IN-0000xo-7j for qemu-devel@nongnu.org; Thu, 11 May 2023 04:05:04 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-50b383222f7so12306458a12.3 for ; Thu, 11 May 2023 01:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683792300; x=1686384300; 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=f+t7z0FUWlRAicpheOk0qlu8uMDwmd02otcOLGaJHHo=; b=jeqC4jRk0QcrBRdjHPZkwrbUJWqkXxwkBfrjklNpfMmAdfFFYBU2JqUPfGvHeSMTQI BxLAhGtTyCNsTqlkqBrk/CDv9kBFzbCxqjmOg5ezpm559ytSPj8a0Uh515KihZDfHwIT p+dKAzGyIX3wWj1eBcdRQH0YxTbx5x5JY/2r77lbP8j2bRBJwKiuL7DIbnFfJecxwxMs DNVRlQcPmg7NU9T8QoOsKBT/9OjawYEKB/aO7SAk9+MBvLVE4uBfWV+8veeuCmQtrGNl AtNK6M6I5Up/e220Wk8bP2szB1+EWJSBQcHSTpj74nUi7tGE/6WXK9iJhBBEyj6d0Jfc nJeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683792300; x=1686384300; 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=f+t7z0FUWlRAicpheOk0qlu8uMDwmd02otcOLGaJHHo=; b=Gjb6xE4Wpd7L/NUGKwIpjCz1YVQaE9vEXc2xsQCAPTTsfXL1bigpLK0R59LTki9NQb /EyZXjF1DcfqIscqZC6PA3aUp1NEDqOKB+mrARKCPJTEWKi3UM0nhLHPXPkeO9bLBvIc NX3I/Gz+Y7PRiL84T1CXnaRu+4VQ3BTE7S6yxFpmktBB779G2rpYCzRkJ/Hmuhh5WYiW tj9spCghTHuPdIaT02ZHAqloiRcxXcZllhB5da2TA9ajv8DmokqDSHBXgjsaGriYvSmz XqK8BBaIzi4uO0LA4ewiQbtqHVzhCFrPehRM9GDsInDxBiq3VkVPe8rkRPcxeyAb10y9 Pzzg== X-Gm-Message-State: AC+VfDyrzcivnmGQmyHhsJi741T7SIILvH3OO6KiTh39ZjwuQbeMzv2E 9F7Ivy4CuHikh/xnYazHm26v8qD3tlxzfRhF/kjVRQ== X-Received: by 2002:aa7:ca46:0:b0:50d:8991:d1b9 with SMTP id j6-20020aa7ca46000000b0050d8991d1b9mr15099009edt.8.1683792300489; Thu, 11 May 2023 01:05:00 -0700 (PDT) Received: from stoup.. ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id i12-20020aa7c70c000000b0050bd7267a5csm2662095edq.58.2023.05.11.01.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 01:05:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 12/53] tcg/i386: Use indexed addressing for softmmu fast path Date: Thu, 11 May 2023 09:04:09 +0100 Message-Id: <20230511080450.860923-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230511080450.860923-1-richard.henderson@linaro.org> References: <20230511080450.860923-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-ed1-x534.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Since tcg_out_{ld,st}_helper_args, the slow path no longer requires the address argument to be set up by the tlb load sequence. Use a plain load for the addend and indexed addressing with the original input address register. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 5d702b69ac..18b0e7997d 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1837,7 +1837,8 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) tcg_out_sti(s, TCG_TYPE_PTR, (uintptr_t)l->raddr, TCG_REG_ESP, ofs); } else { tcg_out_mov(s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[0], TCG_AREG0); - /* The second argument is already loaded with addrlo. */ + tcg_out_mov(s, TCG_TYPE_TL, tcg_target_call_iarg_regs[1], + l->addrlo_reg); tcg_out_movi(s, TCG_TYPE_I32, tcg_target_call_iarg_regs[2], oi); tcg_out_movi(s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[3], (uintptr_t)l->raddr); @@ -1910,7 +1911,8 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) tcg_out_st(s, TCG_TYPE_PTR, retaddr, TCG_REG_ESP, ofs); } else { tcg_out_mov(s, TCG_TYPE_PTR, tcg_target_call_iarg_regs[0], TCG_AREG0); - /* The second argument is already loaded with addrlo. */ + tcg_out_mov(s, TCG_TYPE_TL, tcg_target_call_iarg_regs[1], + l->addrlo_reg); tcg_out_mov(s, (s_bits == MO_64 ? TCG_TYPE_I64 : TCG_TYPE_I32), tcg_target_call_iarg_regs[2], l->datalo_reg); tcg_out_movi(s, TCG_TYPE_I32, tcg_target_call_iarg_regs[3], oi); @@ -2085,16 +2087,6 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, tcg_out_modrm_offset(s, OPC_CMP_GvEv + trexw, TCG_REG_L1, TCG_REG_L0, cmp_ofs); - /* - * Prepare for both the fast path add of the tlb addend, and the slow - * path function argument setup. - */ - *h = (HostAddress) { - .base = TCG_REG_L1, - .index = -1 - }; - tcg_out_mov(s, ttype, h->base, addrlo); - /* jne slow_path */ tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); ldst->label_ptr[0] = s->code_ptr; @@ -2111,10 +2103,13 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, } /* TLB Hit. */ + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_L0, TCG_REG_L0, + offsetof(CPUTLBEntry, addend)); - /* add addend(TCG_REG_L0), TCG_REG_L1 */ - tcg_out_modrm_offset(s, OPC_ADD_GvEv + hrexw, h->base, TCG_REG_L0, - offsetof(CPUTLBEntry, addend)); + *h = (HostAddress) { + .base = addrlo, + .index = TCG_REG_L0, + }; #else if (a_bits) { ldst = new_ldst_label(s);