From patchwork Tue May 16 19:41:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 682363 Delivered-To: patch@linaro.org Received: by 2002:a05:6504:558:b0:22d:db33:bb6d with SMTP id w24csp639006ltp; Tue, 16 May 2023 12:43:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4kQyzlXwLU8HfbWJTCaACRcHeFNJ7Q41NWR5/DkZfjfneukX6ND19RERcQkX0IPGJSkExJ X-Received: by 2002:ac8:5c15:0:b0:3f5:230a:44 with SMTP id i21-20020ac85c15000000b003f5230a0044mr15642049qti.61.1684266215461; Tue, 16 May 2023 12:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684266215; cv=none; d=google.com; s=arc-20160816; b=WY/bYKz16kcXqke0DqDbzjZ9Vqcma0zZj36J31RGtKiaCIlV1J0ypeVM9kig+PFgVl X7jqEKfL2MI14KYhfpa9nSWq/frhqKjFz3YRyTI5Yq1r8k8ildF3tTFgyudhpN5r31W2 cqIeNwfq6VSh0Gt6GpU6CxvJh05vgWZ0JKmogyR99iBwU8BQRPbSejfgp+y7mPghMLrv B8nbmxPDUaCXSalv9c/8gM5sfG0iMNCsnzxbfAPjoRLWoYeYwCS6co0gpjENAviVIX4h 4Gwb5eZQgFUAeumaiiu4CgEfTcbgJixYkfbC0zRlpOLTfwM0QV+r4y7EPPOMtdtuqWoz Z27Q== 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=1hA2GUGH30ti8Xg9mqUcD6D2A4Cc3BlkQs5kBCnxI8w=; b=nhfaPGK9dh2+sQUWJxbvieFGshwhembaJ4jVEIopjHQRsLlJN8F/I9VhrTUyEKw985 bT0/ZfEHt5/dsUDYDCQJnKq7mPGT2tn1zl9utwFHqAw7kIhIWjFTDt6fQvZIaq7xzUHb 2FA9hTxjdaueioga2MZVQ3e+1PRkl+IrFhl8FGAQvxlRlVjeC1xd6h/KKzBsMrmeNlgi BgcZMp5wxakh4JKgN7Yk1bKexZXSnmeHWC6dw03Rq2mnyC83tdpPgNtrD/mvkgf6ZV4s 7MZdPS3KUZKJTbFEPhaAS+7Pun5irhtezM6r5N5JDe/xkVw5ov0x5Pkce2PtYxH9p3sX d8sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zNrNJ8Pv; 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 a18-20020ac85b92000000b003f0842d3c40si12040181qta.703.2023.05.16.12.43.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 May 2023 12:43:35 -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=zNrNJ8Pv; 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 1pz0Yw-0006nZ-V0; Tue, 16 May 2023 15:42:22 -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 1pz0Yv-0006nA-Ly for qemu-devel@nongnu.org; Tue, 16 May 2023 15:42:21 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pz0Yt-0002uI-Nd for qemu-devel@nongnu.org; Tue, 16 May 2023 15:42:21 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-64384c6797eso11570566b3a.2 for ; Tue, 16 May 2023 12:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684266138; x=1686858138; 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=1hA2GUGH30ti8Xg9mqUcD6D2A4Cc3BlkQs5kBCnxI8w=; b=zNrNJ8PvJG3zv2inwkyhs3XvNIXnxroA6s+TdPBeZeOZIEoEH5b7EParXxY6fn6MJs Bd4VIt7EDBJmRTK4UNLyFfVe3aJui1kQYnEwyom3hyRdNYeUbf79CHzWzCVZVdHJs5O4 VwStKP6G2hw56CtzKdf6enF+2Z9gmlSxPWpKmHVEtV6HB6eWHQIqO2RMsijiLsz5zI27 JQM/Gisemi9eNuM+fFLYOMKGhbzbeBF6WUx6/nm06djh77J0Sli1NGTZarWHux/K8jGr khsLEZn9hElwt8QUOVq8yl8r/NcPjPM/Q0ZEMjfQMNAoWM3L3jdHd1fudGT6EV+q8auF YGBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684266138; x=1686858138; 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=1hA2GUGH30ti8Xg9mqUcD6D2A4Cc3BlkQs5kBCnxI8w=; b=LK0HDRHy9mJdhlkgbm/uiPQGXs7NOaifF/sVyumKkaJ4DbOZYGtBjG7GY4MTpvMZIJ BjWnkvRoD9528aPWnU1141fIEKSCRfBKvPs/Cs+kSP4yvTg/Evm/xxGW+sGg0wqqUDbZ XKScvLBI/7fvqzdqC5602ab22OqXRbQJNWjRcnWD7YdiTvm6sLfHt52vCEyuGxlTO2Wk DlMqEyQOFIiRIC23LnQBmI3am7fEqCNUZzN7mpHCgXzq4Q5jSfKhPcFf2zVdv9E+0Vay 2CG61j/YbVs04vhigvtrEHGzhnBpEBGcw0BwpKiR4sSCu/5ZeV1yosKyK7S4YlHmFgjQ JbLw== X-Gm-Message-State: AC+VfDx7Vjw/yx7CHssqpNEAThIpWvLka4VC8KL1E53bd97i82Zp02Ws /DnJZhz+7POxpRGUjJXyLTgjRTmhV0OlgnQyATE= X-Received: by 2002:a05:6a00:2194:b0:643:b653:3aa with SMTP id h20-20020a056a00219400b00643b65303aamr46908884pfi.32.1684266138546; Tue, 16 May 2023 12:42:18 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:ec81:440e:33a4:40b9]) by smtp.gmail.com with ESMTPSA id z21-20020aa791d5000000b006260526cf0csm13771165pfa.116.2023.05.16.12.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 12:42:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 35/80] tcg: Merge tcg_out_helper_load_regs into caller Date: Tue, 16 May 2023 12:41:00 -0700 Message-Id: <20230516194145.1749305-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230516194145.1749305-1-richard.henderson@linaro.org> References: <20230516194145.1749305-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.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 Now that tcg_out_helper_load_regs is not recursive, we can merge it into its only caller, tcg_out_helper_load_slots. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- tcg/tcg.c | 89 +++++++++++++++++++++++++------------------------------ 1 file changed, 41 insertions(+), 48 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 5de9380c6b..2b9e032b70 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -5225,12 +5225,50 @@ static int tcg_out_helper_stk_ofs(TCGType type, unsigned slot) return ofs; } -static void tcg_out_helper_load_regs(TCGContext *s, - unsigned nmov, TCGMovExtend *mov, - const TCGLdstHelperParam *parm) +static void tcg_out_helper_load_slots(TCGContext *s, + unsigned nmov, TCGMovExtend *mov, + const TCGLdstHelperParam *parm) { + unsigned i; TCGReg dst3; + /* + * Start from the end, storing to the stack first. + * This frees those registers, so we need not consider overlap. + */ + for (i = nmov; i-- > 0; ) { + unsigned slot = mov[i].dst; + + if (arg_slot_reg_p(slot)) { + goto found_reg; + } + + TCGReg src = mov[i].src; + TCGType dst_type = mov[i].dst_type; + MemOp dst_mo = dst_type == TCG_TYPE_I32 ? MO_32 : MO_64; + + /* The argument is going onto the stack; extend into scratch. */ + if ((mov[i].src_ext & MO_SIZE) != dst_mo) { + tcg_debug_assert(parm->ntmp != 0); + mov[i].dst = src = parm->tmp[0]; + tcg_out_movext1(s, &mov[i]); + } + + tcg_out_st(s, dst_type, src, TCG_REG_CALL_STACK, + tcg_out_helper_stk_ofs(dst_type, slot)); + } + return; + + found_reg: + /* + * The remaining arguments are in registers. + * Convert slot numbers to argument registers. + */ + nmov = i + 1; + for (i = 0; i < nmov; ++i) { + mov[i].dst = tcg_target_call_iarg_regs[mov[i].dst]; + } + switch (nmov) { case 4: /* The backend must have provided enough temps for the worst case. */ @@ -5273,51 +5311,6 @@ static void tcg_out_helper_load_regs(TCGContext *s, } } -static void tcg_out_helper_load_slots(TCGContext *s, - unsigned nmov, TCGMovExtend *mov, - const TCGLdstHelperParam *parm) -{ - unsigned i; - - /* - * Start from the end, storing to the stack first. - * This frees those registers, so we need not consider overlap. - */ - for (i = nmov; i-- > 0; ) { - unsigned slot = mov[i].dst; - - if (arg_slot_reg_p(slot)) { - goto found_reg; - } - - TCGReg src = mov[i].src; - TCGType dst_type = mov[i].dst_type; - MemOp dst_mo = dst_type == TCG_TYPE_I32 ? MO_32 : MO_64; - - /* The argument is going onto the stack; extend into scratch. */ - if ((mov[i].src_ext & MO_SIZE) != dst_mo) { - tcg_debug_assert(parm->ntmp != 0); - mov[i].dst = src = parm->tmp[0]; - tcg_out_movext1(s, &mov[i]); - } - - tcg_out_st(s, dst_type, src, TCG_REG_CALL_STACK, - tcg_out_helper_stk_ofs(dst_type, slot)); - } - return; - - found_reg: - /* - * The remaining arguments are in registers. - * Convert slot numbers to argument registers. - */ - nmov = i + 1; - for (i = 0; i < nmov; ++i) { - mov[i].dst = tcg_target_call_iarg_regs[mov[i].dst]; - } - tcg_out_helper_load_regs(s, nmov, mov, parm); -} - static void tcg_out_helper_load_imm(TCGContext *s, unsigned slot, TCGType type, tcg_target_long imm, const TCGLdstHelperParam *parm)