From patchwork Thu Oct 26 04:14: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: 738313 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp618047wrq; Wed, 25 Oct 2023 21:15:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8+AgT9Fmo7QPxKMGkVCSGoOKo0nSR5cGZ1gW7wXHrI3RJqPr7aknqJz83v7ib16S1Bc7K X-Received: by 2002:a05:6214:519e:b0:66d:140a:18f3 with SMTP id kl30-20020a056214519e00b0066d140a18f3mr20462610qvb.45.1698293717782; Wed, 25 Oct 2023 21:15:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698293717; cv=none; d=google.com; s=arc-20160816; b=eZl2+tGH5Tzh72Da8xy8XQe0VKWYDy5PuCjeVy3jFRczXSavzMDxq4LBP3OBa/XjnP KBhz9wdQllqAiHEQUBe/N1p3QcJx6hLLmFU7b4q6Z6e5MFzNXzRWTnKlGDCyBEMIvt7m QRsaY7nmjIRcXnck1GagurvHW/raxZYa3EoVpS1O8ASUuQwwjABs4pUU14oVj9su8jZl gRgoQgQR+hp/QgqJJqTOwa8X/5DpFM6tU96vXleWb4+nf/9LmhQRVxkXfjBonHfcc6kn o+0pmukhx01pV7sxNujy0PD0nCajRzdMtVWh3t0ueR3wQF7qOldJNe1ysV2XEehpuc5g UGFg== 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:to:from :dkim-signature; bh=NWMNJDe+S0+EZdJBo+3dWkXIm0dV/UW0LgPiVtKrpH8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=jxW4P6PiLFFYFFRVma9npsS38eKUJy+V1gCb84Lu0LORDz3TJNGLrhdzjJR/+ScuWH LYrRKtMbJYaCUjYPVGXz49nMDnUsd0sgMvhM40VrzfUF4kpbbRu8sY0RKVCTshfgVMFh JRBzpJeSKMXwHZUWrJa0CEE6PL+8TR+iEU0++9dHzNOpyRCsx1OwtdA6mrY9AUGA0LSd MMI+khO+lMPchLQsi9NQuyqIeQxZE2odhb0Q1c1sVscwGiLJJRjVXsKCXRAKvA64dL8c Ha9bgsp21UPrfNro1lBguk5oHg+zIc8vR3SSgVZ/CK8Ae2C3xryQAvnibrQP8tsGeFgl 2Guw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WTCHf+hf; 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 y11-20020a056214016b00b00668da565494si9059574qvs.162.2023.10.25.21.15.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 21:15:17 -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=WTCHf+hf; 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 1qvrl6-0002Uu-2U; Thu, 26 Oct 2023 00:14:12 -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 1qvrl4-0002Ub-8v for qemu-devel@nongnu.org; Thu, 26 Oct 2023 00:14:10 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvrl2-0000j3-Kt for qemu-devel@nongnu.org; Thu, 26 Oct 2023 00:14:10 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cab2c24ecdso3328445ad.0 for ; Wed, 25 Oct 2023 21:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698293647; x=1698898447; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=NWMNJDe+S0+EZdJBo+3dWkXIm0dV/UW0LgPiVtKrpH8=; b=WTCHf+hf8DmS223zBWjIgTDTxiZFN7FG5muwnZGAPo8g3yy4vYXIj5XssoROy2nknO 5IwgwTon+26AHbpF0bsR1NReewIERr61v2jMS/3dDXZ+HbsVlw4SnLAAub6T4iHOKg4P B9AL1i4kRM/Db5zebjHgDOb4H+OKj4JW6Fl/YZvZu1hW6VgCh6Dkhqjg9qRmDVM/yPVQ 0MDvVd2yeiRRdF7SpaYU200YTP4AKAKilg4gqNjOaZkjKByHmAM37gx82pUY6QK9EDbR GDNAfmFldggSoJfkRl5JuK6HQbP1ymGRSEHGNk+E5bf8NqLKMEbpAkmYGb5vlCsC3QGA CwAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698293647; x=1698898447; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NWMNJDe+S0+EZdJBo+3dWkXIm0dV/UW0LgPiVtKrpH8=; b=keruJ/RdTfWS7Vmnux5qqcuN1QU2t8+ZC834o6k0o3WdKzRJucwZfD0fcW1Akiq3gV V1MrXJHooS+PVyNxr6jWPlyurXjI10mSqZzQzv65HVgwYvenAY/8mlGRzT6D75xGGS5G Y8SLS0GU+3sWbcvdjNkUg9449bnJJk3rvlWnWqZLT6LuaR8vCpmBbP2AI5d19MblomIW IsOHxwwL3DN5tnUNBMuYuHJklI9z6X+KmP0Ef6sDGRaHD2FSev1k86BQNJ1bY2SqXRFg K50wXpB5hcUiUyR6i9m7ywCS7CQrnPHl4+7+luA5ELmef0y0NhiLSOTllAj2GInHRBJo O+Ig== X-Gm-Message-State: AOJu0YwkDLNfoBpVyeejlJl1N3BkrxhhQaVoVfODvyNqbKrcpr8+rpek h2rayQcJW/3P6RszMHjk2bPQxRshPY/h4fxnWgE= X-Received: by 2002:a17:902:ecca:b0:1c7:562d:9b16 with SMTP id a10-20020a170902ecca00b001c7562d9b16mr17295736plh.24.1698293646957; Wed, 25 Oct 2023 21:14:06 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id i12-20020a170902eb4c00b001b8b2b95068sm9953929pli.204.2023.10.25.21.14.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 21:14:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 2/6] tcg/mips: Always implement movcond Date: Wed, 25 Oct 2023 21:14:00 -0700 Message-Id: <20231026041404.1229328-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026041404.1229328-1-richard.henderson@linaro.org> References: <20231026041404.1229328-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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.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 Expand as branch over move if not supported in the ISA. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target.h | 4 ++-- tcg/mips/tcg-target.c.inc | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index c0576f66d7..0a4083f0d9 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -154,7 +154,7 @@ extern bool use_mips32r2_instructions; #endif /* optional instructions detected at runtime */ -#define TCG_TARGET_HAS_movcond_i32 use_movnz_instructions +#define TCG_TARGET_HAS_movcond_i32 1 #define TCG_TARGET_HAS_bswap16_i32 use_mips32r2_instructions #define TCG_TARGET_HAS_deposit_i32 use_mips32r2_instructions #define TCG_TARGET_HAS_extract_i32 use_mips32r2_instructions @@ -169,7 +169,7 @@ extern bool use_mips32r2_instructions; #define TCG_TARGET_HAS_qemu_st8_i32 0 #if TCG_TARGET_REG_BITS == 64 -#define TCG_TARGET_HAS_movcond_i64 use_movnz_instructions +#define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_bswap16_i64 use_mips32r2_instructions #define TCG_TARGET_HAS_bswap32_i64 use_mips32r2_instructions #define TCG_TARGET_HAS_bswap64_i64 use_mips32r2_instructions diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index a5e6fe727b..f9b790ed8a 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -1085,13 +1085,22 @@ static void tcg_out_movcond(TCGContext *s, TCGCond cond, TCGReg ret, if (v2 != 0) { tcg_out_opc_reg(s, OPC_OR, ret, ret, TCG_TMP1); } - } else { + return; + } + + /* This should be guaranteed via constraints */ + tcg_debug_assert(v2 == ret); + + if (use_movnz_instructions) { MIPSInsn m_opc = eqz ? OPC_MOVZ : OPC_MOVN; - tcg_out_opc_reg(s, m_opc, ret, v1, c1); - - /* This should be guaranteed via constraints */ - tcg_debug_assert(v2 == ret); + } else { + /* Invert the condition in order to branch over the move. */ + MIPSInsn b_opc = eqz ? OPC_BNE : OPC_BEQ; + tcg_out_opc_imm(s, b_opc, c1, TCG_REG_ZERO, 2); + tcg_out_nop(s); + /* Open-code tcg_out_mov, without the nop-move check. */ + tcg_out_opc_reg(s, OPC_OR, ret, v1, TCG_REG_ZERO); } }