From patchwork Thu Feb 4 01:44:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 376204 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp859792jah; Wed, 3 Feb 2021 18:37:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqnEXXmoWKi3KbQYTpZvuNG/yCpbRTBsEJJFVX+L01j6YmB1kZpVXeqqF1RRdcjQcO5CDp X-Received: by 2002:a25:8206:: with SMTP id q6mr9156901ybk.156.1612406223891; Wed, 03 Feb 2021 18:37:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612406223; cv=none; d=google.com; s=arc-20160816; b=JXw9jm5xiDZcQ8HhxBih69WtDWfZOCA9/jTPXp7pRXgMLnCGMSEULBgmoQncPSWrOe t4KvJE1c6WXYqrTDeZlIlPh5pqiuZAznu6OhpHuIFnbZ9GgM8/kPOefEKU8aZmYrnHJy DC+3Nz0948jN5CCXm2lKIEnZ1YvCJjBydAzrATh76XB5IFt53aoRlndRO/8vrXTVY7oK nIqMydB8wWT+Rp/Y5wgtyHLlidRYXhGNdpp3GJTSOa8OzbiFtMAyAgeoKYqHZZX5thwr W5OB6mw4PzA8lHmUERXpE2aMpCTh4hrHtHwzzlTdouN4ndSgPx+/3FoBtVjJXowUTitV CGaA== 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=UyEKP0RbRdcuaRCMbQNvYPLSxHvirN/zRruMy5SEADSdbieJMO1oSw6bXZYExrH5SP Al7lKP+MhtOkibSOv9gq/YKS0aLIxrZ/iQ30lMlDPvJpENs0S6QuaohTrMPUwoW/8Sro j2RCGnQtJnYQdTJzUJhzriOuR6qk6BaaXit+DA2obTTexzYXHtgbkkum+rGdEc/Bxb6W MpPS9gvpkDhgleVd3FYqvzEqe6BhOEZOuL0qHC+6B8a0pzNf5ghLXmYSF70ea1UIZuoZ 7FOSzKwcfQijQxKTc8/NGR3ILoFavphnrxi48UB4XZ8lLnduDIu0lHS/fyI4228H2KuI pcxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mnRk04CM; 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 r22si4806255ybd.26.2021.02.03.18.37.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Feb 2021 18:37:03 -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=mnRk04CM; 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]:59256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7UVz-0006VN-8U for patch@linaro.org; Wed, 03 Feb 2021 21:37:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7Tjs-0006ED-3I for qemu-devel@nongnu.org; Wed, 03 Feb 2021 20:47:20 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:54671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l7Tji-0004B2-E2 for qemu-devel@nongnu.org; Wed, 03 Feb 2021 20:47:18 -0500 Received: by mail-pj1-x1032.google.com with SMTP id m12so771436pjs.4 for ; Wed, 03 Feb 2021 17:47:09 -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=mnRk04CMbYnHsFBpHWCrgFQELbSVEYEkc1At4b3HVFT/dd/Y310CTMBKd3t4a/XGWj 3LdTZdBnt/kmTA8IkwpsL3INoIbWskkKdnkdZTNXFkm+B8YxtCb+ZgKPglF81x9wwdym kgsGyr5g9gAew1qmHlQg2c8aO/h4p6OdnLZTeFfsvA1H+tZFxN8s18CLdwKGOWPoJ8S7 GFyqDC6Bnp20xabjdnRHB7GjGnAzNYc2iHePvdSwCecw6Bqs75xYJCH6jtrr7LiUf4Ph mrNGQ+qi0pDWtaa0U+YCpFO5gRT773LbXmvLEdU4GB+PhjUmMmYDQfyjtArxk+Pks0Db wJCQ== 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=DWGp1wl3RedwyfdjHJ9J9adXgNxPeEI0XDVg5EEScQO9R9FWNoLHQiAPZJN4Oy6YGF 0EWsurARpnVPMpBaQnNwMMp9ZD1CAGTA6Dufst7KcI0vg0Y0xn0+1LGp6qU7QWOz0leS 5C1s0MnxfaGkhNxeErqgm94wPFpY9fFolWemdmGP7NBwgmhb1OUu6zDSNxEtut+8gdCD ocJAKYvdT2eeZqx6YC7oWf4NvTUPERvqDKU2WBwT4yqSrq85Gn5/NHpkLOznzHe/EamE PpZB6PO6fz4PWBmUYdlMKfkQpO3MSbkAUAi9FESI+f6RNV3tBUMY5KB1kZ5zkxK434jc 3lrw== X-Gm-Message-State: AOAM530Bhe59hVoyMHn/00ysN4GSQybNEq2U0HD0OLHq7Os2cGcmyqIF jv5yLWMocGpGRrF+KAUIjDkdwSZ25jqmHQMd X-Received: by 2002:a17:902:b7c7:b029:e1:6cbe:db19 with SMTP id v7-20020a170902b7c7b02900e16cbedb19mr5788454plz.20.1612403228759; Wed, 03 Feb 2021 17:47:08 -0800 (PST) Received: from localhost.localdomain (cpe-66-27-222-29.hawaii.res.rr.com. [66.27.222.29]) by smtp.gmail.com with ESMTPSA id q132sm3835462pfq.171.2021.02.03.17.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 17:47:08 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 67/93] tcg/tci: Split out tcg_out_op_rrs Date: Wed, 3 Feb 2021 15:44:43 -1000 Message-Id: <20210204014509.882821-68-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210204014509.882821-1-richard.henderson@linaro.org> References: <20210204014509.882821-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sw@weilnetz.de 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,