From patchwork Tue Sep 21 02:25:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514386 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2639756jao; Mon, 20 Sep 2021 19:29:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq14GUCA3a7e4fbvlntMEWpiZMQ+JrCV79ABnE3bO74B3ewFeDyH3eDWtzJbYMtXUGSo/6 X-Received: by 2002:a5d:9708:: with SMTP id h8mr20862618iol.170.1632191358034; Mon, 20 Sep 2021 19:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632191358; cv=none; d=google.com; s=arc-20160816; b=vBQDZTlBvyDNW/Z0dJQ0s5yfVdKPdqonzJ9BVccPI+Xb20vGy07z18UYj+Sh1Yn5OB PLfU+zJacb7LS183v5N80b74N23pp9rLJmAKfjJxFgdGj8X7DN6ErlB0BbJigNvoPqic cfg3OTVJF4bQlxWotQoPqEuFrJe40kjA3kbzybfYhegnp3i67XxknVY/6aZIfxOwmJqM Lf2fJ2Dkw7KGJwqHhtNAoHUIJTMj8xMvlHiR38MW0FWLSL1Fpot8huWOiNaZzmWa1qVm b5BDxQZEdUAi/TVW4hR4g0ohQwYLD1Q7MWC4rxc7dLKSg/WmR+7XpZ1CkhVDUmNByil3 Whig== 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=PdcS/QGFTvc6ZKaUfNXcEO6hRsowcjhW++K3hiiKcz0=; b=1KCl53KQAibQHYV6PswmSaDG9BcJtU8jZZfupGVI+AhuZEvBVgMGdPwIx1CgIphYtz Mpo0npeYChXQEsI9sjaUcADkadDwJYfYpsG+APPF0MxrVNnFD5amQ/zGjUgOYlAYQBio 2YMWoy3DdTDunPOfWzYU+4jpBdOhHJwdlP1K9Q9K5t9FJgWPgqtlcDArk8jXj8X97LjV hb2di6xrlwrjvPriIkJT9O1yrHcfLylInsOa0gp1NqDXc+M3xrgwhMRTNBQfSoGhMJp3 BMK5z1wWmgA9NLKJReoy4pQKh3kOnwoWW9yKGZhWBT8JQfLgGUlPleMYwddbRRGQKDQg urrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qYCIdRpZ; 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 q9si19098873ilo.171.2021.09.20.19.29.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Sep 2021 19:29:18 -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=qYCIdRpZ; 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]:39752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSVX3-0002nb-EN for patch@linaro.org; Mon, 20 Sep 2021 22:29:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSVTf-0005et-TV for qemu-devel@nongnu.org; Mon, 20 Sep 2021 22:25:47 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:35423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mSVTc-0006IB-7D for qemu-devel@nongnu.org; Mon, 20 Sep 2021 22:25:47 -0400 Received: by mail-pl1-x636.google.com with SMTP id bb10so12369032plb.2 for ; Mon, 20 Sep 2021 19:25:42 -0700 (PDT) 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=PdcS/QGFTvc6ZKaUfNXcEO6hRsowcjhW++K3hiiKcz0=; b=qYCIdRpZD5bLyZ/GEl//0zGQATUB/YWch1QuVh60GMir7zYSHTgFOO2SikZZC1jkr0 iOUN6r9d3Y8KDud6ZmV9j3DEbvDayTqNdWVDl0h1PnOIuCtrAG2p/r0btO6FSPae9kys r1IThSTI2GHFBG/ePk4wYl5qGzhAsxW7yoPuzuHMF669UHCjfC+JKupS4aTO9vKOgm9m lUziIF8ryVHgZUnjCKjkFIZmRBAKJiSSFh5U9IX9ySipvT47Yceu6AJGPnyoS3NGmXYi Gph89n1TQ9KK9o8SImgCQ9oNqVoHNhjg0HAjA9dgE/GYFlzvNfw2eBRGE+n3i3h2SrkE HXUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PdcS/QGFTvc6ZKaUfNXcEO6hRsowcjhW++K3hiiKcz0=; b=vvzZQQU9gIpeIOVFtTTxigTN227Z8KBsmaEfT/XLDKEJWKUHnZvU0iKFKAf/ILEzbO JXlgLsXOEcl6o0gSvYAnLey0FUSBFs/PvcgIIWGilhc0a0bitSKIa4YdlRpiYxWYLXf9 Je7B/sqlfCBL4c7XJNIBJL0DDGEoEj7SsLRB14KrTQeaRFHL3pSImAsrnBnci73zblTv nnJghy1pS3xFaD0lnqMzPWNzRtWJJJQ/BUFklRk+XkJ+nISceB7aPOx3WpDNNbEsihPy chTNxmXlCY7vF+UspLZAFxZLWZJDHUbNVhnh6IiXofrmfLz3cvThzcnY/nHQhOVVr9wi FR+Q== X-Gm-Message-State: AOAM530Zi0VKaEZ9DyBGQusTR4w5uS0pNVNGdOefy70Hz7IcdX19WBDH 8lQNIoKvFYmw+sdsbFOuligW+yUjwvLZtQ== X-Received: by 2002:a17:902:e88d:b0:13b:8ed2:9f42 with SMTP id w13-20020a170902e88d00b0013b8ed29f42mr25118460plg.67.1632191142015; Mon, 20 Sep 2021 19:25:42 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id n9sm15297621pff.37.2021.09.20.19.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 19:25:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/10] tcg/sparc: Introduce tcg_out_mov_delay Date: Mon, 20 Sep 2021 19:25:32 -0700 Message-Id: <20210921022534.365291-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210921022534.365291-1-richard.henderson@linaro.org> References: <20210921022534.365291-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This version of tcg_out_mov is emits a nop to fill the delay slot if the move is not required. The only current use, for INDEX_op_goto_ptr, will always require the move but properly documents the delay slot. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/sparc/tcg-target.c.inc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc index 1763253edd..9720d76abd 100644 --- a/tcg/sparc/tcg-target.c.inc +++ b/tcg/sparc/tcg-target.c.inc @@ -362,6 +362,11 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) } } +static void tcg_out_nop(TCGContext *s) +{ + tcg_out32(s, NOP); +} + static void tcg_out_arith(TCGContext *s, TCGReg rd, TCGReg rs1, TCGReg rs2, int op) { @@ -389,6 +394,15 @@ static bool tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg) return true; } +static void tcg_out_mov_delay(TCGContext *s, TCGReg ret, TCGReg arg) +{ + if (ret != arg) { + tcg_out_arith(s, ret, arg, TCG_REG_G0, ARITH_OR); + } else { + tcg_out_nop(s); + } +} + static void tcg_out_sethi(TCGContext *s, TCGReg ret, uint32_t arg) { tcg_out32(s, SETHI | INSN_RD(ret) | ((arg & 0xfffffc00) >> 10)); @@ -551,11 +565,6 @@ static void tcg_out_div32(TCGContext *s, TCGReg rd, TCGReg rs1, uns ? ARITH_UDIV : ARITH_SDIV); } -static void tcg_out_nop(TCGContext *s) -{ - tcg_out32(s, NOP); -} - static const uint8_t tcg_cond_to_bcond[] = { [TCG_COND_EQ] = COND_E, [TCG_COND_NE] = COND_NE, @@ -1349,7 +1358,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_goto_ptr: tcg_out_arithi(s, TCG_REG_G0, a0, 0, JMPL); if (USE_REG_TB) { - tcg_out_arith(s, TCG_REG_TB, a0, TCG_REG_G0, ARITH_OR); + tcg_out_mov_delay(s, TCG_REG_TB, a0); } else { tcg_out_nop(s); }