From patchwork Wed Feb 17 20:20:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 383880 Delivered-To: patch@linaro.org Received: by 2002:a02:c80e:0:0:0:0:0 with SMTP id p14csp3126341jao; Wed, 17 Feb 2021 12:52:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2Y+w9AfhxCHjDFcVeuVeyIMdNLhn7qNNWPv1mCe+O4OhrnbV0wGHhw7KrcH4b5qHpP6su X-Received: by 2002:a25:c7c6:: with SMTP id w189mr1735454ybe.323.1613595133543; Wed, 17 Feb 2021 12:52:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613595133; cv=none; d=google.com; s=arc-20160816; b=BFVsk2SUdrVBusATKjH/G1rPLGx8RwJCK4fwxXpRkIGNu7fB32Fjboq8FKBVtv9G5g 0RBwl+2IDWXwysUGWReyWA+XqVncTakWas+UBhuCUReHTP98RzCt1GAKCIXkkSbMOt79 xUbjD06e888chHaqL5u9bgPVBeBnU5UxeHQAvlkcOAIeKuqg6TMtHhr3S8VyXraYUqKz Rjf0Y8EpJMkUFFG4/ZAFWg9/G8SN8dU4M9P2g5ykHwg+WDsDetToG8bdcT+/sij3MZI8 vwC9PRNPazTHVJGPZozGjbjndCJzkQ105n2W5ZjRlg3d+kVWqn0gfOm+NsL4JvrS69H9 dYug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=r51gde6XQroUTuOp18Wacrk/m6aRKZagEOpI8SD7K0E=; b=G8Yc+6blneTCZYwTlpftxE/wp9jfzvy4u43Zwhy2yEEwIBde+ET3qe/0hCmcAoUjKy izS2wotXb+5e5IPnop89ERPhliy1hGj0luw4nvvszVQ1m6/ZdmbenPYMAvTYyUAX10F4 u5o5yhEgO8f0VvfHqixUbKiuCM/QTf2uslc4ZvV0HLkuf1YR7PPj3a4N7/KJkuVPhflX Q7I4ZTpw82s6mZf5EJWDq9lRKYPistxXqSnCUIATmYJiP5znvpfEOrnkUn/ByVi6gt5f tX8y/26P+fK6+Bw10CQrQz+Ur7bCAgUYEPtZKgjVol1Myg/OpVOwfG4KI3NKddOuV8Ft XkJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=gMJKM5xx; 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=fail (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 q18si1754274ybp.447.2021.02.17.12.52.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Feb 2021 12:52:13 -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=fail header.i=@linaro.org header.s=google header.b=gMJKM5xx; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lCTnw-0002s2-W0 for patch@linaro.org; Wed, 17 Feb 2021 15:52:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lCTMR-00010h-LX for qemu-devel@nongnu.org; Wed, 17 Feb 2021 15:23:47 -0500 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:46417) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lCTMQ-0007bW-1d for qemu-devel@nongnu.org; Wed, 17 Feb 2021 15:23:47 -0500 Received: by mail-pf1-x433.google.com with SMTP id k13so9144029pfh.13 for ; Wed, 17 Feb 2021 12:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r51gde6XQroUTuOp18Wacrk/m6aRKZagEOpI8SD7K0E=; b=gMJKM5xxoAO5xKzRTST23meGQ1BWzUpYhJdmo08aZlV3VfcgB9Wy5O6lQxSthdCESx ByHomRWmbgYq/wARDW4INOoxIg1W838OT+nXgy7isIW3SWe3rDgUclyAsGtAPHwKpkYb MjuXGivFkTxmLQumKIxbCssRqtkXGtPnMoyGMDRx1qeVB7rLYQC6VkbybB5u1HSuWYYZ YrkV1sd26LY/pFfej55HT5Gr/0IRqiWp26sXWwR/WJrnMmGxlHwzJNs3aMIGTxziVUsK VU7V9roN2q6gh9X+1mHzmkO97V4P5RPndNRZXq6PbTWX6/y86jrBM3a572CxpUyBPkeI 56Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r51gde6XQroUTuOp18Wacrk/m6aRKZagEOpI8SD7K0E=; b=QWgpJoK3hGH1bEqdKXv7fkf3KdBz2+RX/FZbdkuWfk7W+ah2fA1zhaHIAiGiBIYNUW Ju/L5TluxBspeefQqzD/N4APNFyXZFgByoqfvM7SAf+RGNkWq7pV6qMuSAzCniiDtArs QQCXhAezXCkJEkAFX3cPf3e1P/na/TPKyf6dtp9DkYrB3CnZ0v186isI0FaG6grQk0td gEybhfWCikZ16gQ3Dc55KycML/ohLhCzGnsu0R385lCfIWXJLGmReH29E+cDs6HrvHO8 f8o/QE3d+O+ekS0uIUoD1ffDXRfHTiuq27N5e7pKB3RFu4QCGKiTX96veCoDdDW8JF37 EYbw== X-Gm-Message-State: AOAM532HdvFGQ9+/mgVu1u4DqbUVjNcuD9I/tudnSLGgHKn/lOZqh8Kx 5Z3C/euxdhQPPegRYTPDbgLcgZAjdppNYw== X-Received: by 2002:a63:ef53:: with SMTP id c19mr1002845pgk.78.1613593424749; Wed, 17 Feb 2021 12:23:44 -0800 (PST) Received: from localhost.localdomain (047-051-160-125.biz.spectrum.com. [47.51.160.125]) by smtp.gmail.com with ESMTPSA id v126sm3232038pfv.163.2021.02.17.12.23.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 12:23:44 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 42/71] tcg/tci: Split out tcg_out_op_rrs Date: Wed, 17 Feb 2021 12:20:07 -0800 Message-Id: <20210217202036.1724901-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210217202036.1724901-1-richard.henderson@linaro.org> References: <20210217202036.1724901-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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sw@weilnetz.de, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- tcg/tci/tcg-target.c.inc | 84 +++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 45 deletions(-) -- 2.25.1 diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc index 050d514853..707f801099 100644 --- a/tcg/tci/tcg-target.c.inc +++ b/tcg/tci/tcg-target.c.inc @@ -283,32 +283,38 @@ static void stack_bounds_check(TCGReg base, target_long offset) } } -static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg1, - intptr_t arg2) +static void tcg_out_op_rrs(TCGContext *s, TCGOpcode op, + TCGReg r0, TCGReg r1, intptr_t i2) { uint8_t *old_code_ptr = s->code_ptr; - stack_bounds_check(arg1, arg2); - if (type == TCG_TYPE_I32) { - tcg_out_op_t(s, INDEX_op_ld_i32); - tcg_out_r(s, ret); - tcg_out_r(s, arg1); - tcg_out32(s, arg2); - } else { - tcg_debug_assert(type == TCG_TYPE_I64); -#if TCG_TARGET_REG_BITS == 64 - tcg_out_op_t(s, INDEX_op_ld_i64); - tcg_out_r(s, ret); - tcg_out_r(s, arg1); - tcg_debug_assert(arg2 == (int32_t)arg2); - tcg_out32(s, arg2); -#else - TODO(); -#endif - } + tcg_out_op_t(s, op); + tcg_out_r(s, r0); + tcg_out_r(s, r1); + tcg_debug_assert(i2 == (int32_t)i2); + tcg_out32(s, i2); + old_code_ptr[1] = s->code_ptr - old_code_ptr; } +static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg val, TCGReg base, + intptr_t offset) +{ + stack_bounds_check(base, offset); + switch (type) { + case TCG_TYPE_I32: + tcg_out_op_rrs(s, INDEX_op_ld_i32, val, base, offset); + break; +#if TCG_TARGET_REG_BITS == 64 + case TCG_TYPE_I64: + tcg_out_op_rrs(s, INDEX_op_ld_i64, val, base, offset); + break; +#endif + default: + g_assert_not_reached(); + } +} + static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) { uint8_t *old_code_ptr = s->code_ptr; @@ -444,12 +450,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, CASE_64(st32) CASE_64(st) stack_bounds_check(args[1], args[2]); - tcg_out_op_t(s, opc); - tcg_out_r(s, args[0]); - tcg_out_r(s, args[1]); - tcg_debug_assert(args[2] == (int32_t)args[2]); - tcg_out32(s, args[2]); - old_code_ptr[1] = s->code_ptr - old_code_ptr; + tcg_out_op_rrs(s, opc, args[0], args[1], args[2]); break; CASE_32_64(add) @@ -597,29 +598,22 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args, } } -static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1, - intptr_t arg2) +static void tcg_out_st(TCGContext *s, TCGType type, TCGReg val, TCGReg base, + intptr_t offset) { - uint8_t *old_code_ptr = s->code_ptr; - - stack_bounds_check(arg1, arg2); - if (type == TCG_TYPE_I32) { - tcg_out_op_t(s, INDEX_op_st_i32); - tcg_out_r(s, arg); - tcg_out_r(s, arg1); - tcg_out32(s, arg2); - } else { - tcg_debug_assert(type == TCG_TYPE_I64); + stack_bounds_check(base, offset); + switch (type) { + case TCG_TYPE_I32: + tcg_out_op_rrs(s, INDEX_op_st_i32, val, base, offset); + break; #if TCG_TARGET_REG_BITS == 64 - tcg_out_op_t(s, INDEX_op_st_i64); - tcg_out_r(s, arg); - tcg_out_r(s, arg1); - tcg_out32(s, arg2); -#else - TODO(); + case TCG_TYPE_I64: + tcg_out_op_rrs(s, INDEX_op_st_i64, val, base, offset); + break; #endif + default: + g_assert_not_reached(); } - old_code_ptr[1] = s->code_ptr - old_code_ptr; } static inline bool tcg_out_sti(TCGContext *s, TCGType type, TCGArg val,