From patchwork Thu May 11 08:04:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 680888 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp3268850wrs; Thu, 11 May 2023 01:15:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bAKAW4ndjoS9xjN14ZOwKIMLGodSY2S2bTdP0gizUeP2fcHA6CoQO7fm+WyWl7kXnyh82 X-Received: by 2002:a05:6214:62b:b0:621:431e:5409 with SMTP id a11-20020a056214062b00b00621431e5409mr14250106qvx.16.1683792954643; Thu, 11 May 2023 01:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683792954; cv=none; d=google.com; s=arc-20160816; b=svRcdBZHu5fGzJTvMxLB4hB2WGfz8f5hnRBXBO3joZfWDpClR1kLlY/OD805sVJOvt rKdGEFcaEacRsqUY2m0/Df+DYRzlLRPeDPx/HWIulT3+tYIkw6Kr++mWuGJzeiif25om sr/LNwSBCvR9pxJAregjFYu9LWlS6cUQY+4CE4tQUdlPaS8tLW9Cf+uPK3Lhh03BlXim MZKDjxQv4zf+V48GmVdb2wB5XcrQ07irA04836nRMF7R3/rNOyxqIxzDpgSoUu4TB+5l C+vy/AOrfOfsvjlQBA/+Xu59UztWa+KCsF0IBSF4Mcj9iX/YkXwL24Q0fBO1XqzPwwj4 NT5g== 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=gGX1OvBPBJZ0dJTeWQA17dDEsVv5029y7NlB8JCmIAo=; b=eaRmMtg8xFeMqGdeV6oOCB1kfJTo8nDEi8Gfs0GK8GkNZf3OMaq2YKKx3NBbn8Z8hq 014Opeh31NxOom3r5PHbiWsgUpdGO34byjKAGfcVsTSgvSLvLl5TOvWL3n3p6ITGOZkE dnlWI4wsTCLNiXq5Qzkh4bwOYFRVhOrwpqwWpk498qN+m9NCQJ0u3MGuqnmlJNrMlN2i 8ZZWZ2DB1EwBdQ9eqRrkIZkAtm2w8/kr0REYAorb6b7o/L+xx810q6KdVsJaitv0kcoD N9Ti4knA1YZFeKUxAG6vXZcgstYgs4jXBYaN0pVniSr6WpjB2/+DnzrRJMu5SOpjhCeO 3rsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sI/IRxR2"; 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 z10-20020a056214040a00b0061a197b0601si3458119qvx.557.2023.05.11.01.15.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 May 2023 01:15:54 -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="sI/IRxR2"; 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 1px1Is-00071s-7S; Thu, 11 May 2023 04:05:34 -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 1px1Ib-0006PC-6s for qemu-devel@nongnu.org; Thu, 11 May 2023 04:05:17 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1px1IT-0000zl-GB for qemu-devel@nongnu.org; Thu, 11 May 2023 04:05:16 -0400 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-9659c5b14d8so1353011866b.3 for ; Thu, 11 May 2023 01:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683792307; x=1686384307; 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=gGX1OvBPBJZ0dJTeWQA17dDEsVv5029y7NlB8JCmIAo=; b=sI/IRxR2ODrHpeebLZ6menmGfU2l1SS02AUjebBvw3+X8dHVSWTbS7l/ipjq/FDntp NtCEsmWNBifgPtEVxnWcEHvEwKII2ZG8GLvSLWAJ36TxdgPJCUuPS4tygpqk4HkoZWf1 4kpQdNNfG0o5+urs7vOZVzaaVnV/AODcznOBVcOaaMTQkFXwEDeqvvWtA0Hdv+epgQQm P8ehXY9aAr4ERNT5Pt1dUZ2eoQRZklLV5kpzPBSvu0QuHCjHI34+LJyL/wG+Dy8c7D8Y 0dDDMLunA7jys8JB10Ve64JJpYLR9eTzgFUY98LG2oOQgCSLAv/psAxJlg/ZoSEorTwc w4xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683792307; x=1686384307; 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=gGX1OvBPBJZ0dJTeWQA17dDEsVv5029y7NlB8JCmIAo=; b=f0wj/WBf++ws0gRtVOvIbpgx3gu6GvLuo+dDi4Mv3FXRxuN8RY4ClkQ9Bsm1FWaW74 IgSpjTwDMNKiTBq2SYUj8MQhYeixmCXzICVGzJGWW9JS/8giWDWwAyqn6nQTg/lfn2/b Fkyu6wCuKBwPc75p96v0bc7Tb5FnDIdL7XaPsuYlBhmNph3DlUlIcTFmVcdA+X2K4lw4 dqOdHnzPioBHTtU1DNE6nXjSfpc5cyEzJr3Z8LtZPjIa/B02ZCKX3XQTfb9NACM6nNCu 2jcANlwpOw23EcXnHVDs/lMQS41CPVfXQSxgr8dGFpNYYUwtfsFolVt1cxvJ+ZHRTmTf 14lQ== X-Gm-Message-State: AC+VfDxFMdYya3NYU1MaohbGLMro67jrwDFS19REoubEUKt+c/NyS4m2 7U3LDwNJyf+lFiqX7pd3lU4Vz/eckH5jYbW6e/RCWw== X-Received: by 2002:a17:907:96a1:b0:966:a691:678d with SMTP id hd33-20020a17090796a100b00966a691678dmr13271605ejc.51.1683792306637; Thu, 11 May 2023 01:05:06 -0700 (PDT) Received: from stoup.. ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id i12-20020aa7c70c000000b0050bd7267a5csm2662095edq.58.2023.05.11.01.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 May 2023 01:05:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 22/53] tcg/i386: Convert tcg_out_qemu_st_slow_path Date: Thu, 11 May 2023 09:04:19 +0100 Message-Id: <20230511080450.860923-23-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::62c; envelope-from=richard.henderson@linaro.org; helo=mail-ej1-x62c.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 Use tcg_out_st_helper_args. This eliminates the use of a tail call to the store helper. This may or may not be an improvement, depending on the call/return branch prediction of the host microarchitecture. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 57 +++------------------------------------ 1 file changed, 4 insertions(+), 53 deletions(-) diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc index 3508b9cc6c..a01bfad773 100644 --- a/tcg/i386/tcg-target.c.inc +++ b/tcg/i386/tcg-target.c.inc @@ -1854,11 +1854,8 @@ static bool tcg_out_qemu_ld_slow_path(TCGContext *s, TCGLabelQemuLdst *l) */ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) { - MemOpIdx oi = l->oi; - MemOp opc = get_memop(oi); - MemOp s_bits = opc & MO_SIZE; + MemOp opc = get_memop(l->oi); tcg_insn_unit **label_ptr = &l->label_ptr[0]; - TCGReg retaddr; /* resolve label address */ tcg_patch32(label_ptr[0], s->code_ptr - label_ptr[0] - 4); @@ -1866,56 +1863,10 @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) tcg_patch32(label_ptr[1], s->code_ptr - label_ptr[1] - 4); } - if (TCG_TARGET_REG_BITS == 32) { - int ofs = 0; + tcg_out_st_helper_args(s, l, &ldst_helper_param); + tcg_out_branch(s, 1, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]); - tcg_out_st(s, TCG_TYPE_PTR, TCG_AREG0, TCG_REG_ESP, ofs); - ofs += 4; - - tcg_out_st(s, TCG_TYPE_I32, l->addrlo_reg, TCG_REG_ESP, ofs); - ofs += 4; - - if (TARGET_LONG_BITS == 64) { - tcg_out_st(s, TCG_TYPE_I32, l->addrhi_reg, TCG_REG_ESP, ofs); - ofs += 4; - } - - tcg_out_st(s, TCG_TYPE_I32, l->datalo_reg, TCG_REG_ESP, ofs); - ofs += 4; - - if (s_bits == MO_64) { - tcg_out_st(s, TCG_TYPE_I32, l->datahi_reg, TCG_REG_ESP, ofs); - ofs += 4; - } - - tcg_out_sti(s, TCG_TYPE_I32, oi, TCG_REG_ESP, ofs); - ofs += 4; - - retaddr = TCG_REG_EAX; - tcg_out_movi(s, TCG_TYPE_PTR, retaddr, (uintptr_t)l->raddr); - 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); - 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); - - if (ARRAY_SIZE(tcg_target_call_iarg_regs) > 4) { - retaddr = tcg_target_call_iarg_regs[4]; - tcg_out_movi(s, TCG_TYPE_PTR, retaddr, (uintptr_t)l->raddr); - } else { - retaddr = TCG_REG_RAX; - tcg_out_movi(s, TCG_TYPE_PTR, retaddr, (uintptr_t)l->raddr); - tcg_out_st(s, TCG_TYPE_PTR, retaddr, TCG_REG_ESP, - TCG_TARGET_CALL_STACK_OFFSET); - } - } - - /* "Tail call" to the helper, with the return address back inline. */ - tcg_out_push(s, retaddr); - tcg_out_jmp(s, qemu_st_helpers[opc & (MO_BSWAP | MO_SIZE)]); + tcg_out_jmp(s, l->raddr); return true; } #else