From nobody Tue Nov 26 14:32:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1707083079; cv=none; d=zohomail.com; s=zohoarc; b=e0iRTCoKKqKj9JLEf27X9q6bDBY0PK1DxejRAm24HSPPkYrgt112XhSeSXauqEIGHkd2V9xCwPFE2SxUS0t0cHKGI4vim2chMVFKCO++46VZDZpj2CYFn/euqAms0RmNeCfGR6VOb8cs9VEwnnmXXWNdTMRWE3RB+2G0Yte10DM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707083079; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=w7DMJgHEIfczGa+x10sgEDsRXfwUGwOd6p01k71b3vA=; b=kJrWVXxs6FbRkthOn1APWn4ZrEk+JedhaKj1ruwDIZ9mXQoLtikmXd8QXLzt7uEw8kAu1nbgx8xSFMbf5YX2Kf+leIWwNx6o5VJC7VvqsbF4GBvSsbx72mTMNpxRBfhIZqbZxrg4OTIg5I08GVfDDvgESNlHAEJSvLOBPFzL+6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170708307979113.234468755055218; Sun, 4 Feb 2024 13:44:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rWkFd-0003Ow-16; Sun, 04 Feb 2024 16:42:09 -0500 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 1rWkFS-0002t5-Nn for qemu-devel@nongnu.org; Sun, 04 Feb 2024 16:42:00 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rWkFQ-0003b3-Ka for qemu-devel@nongnu.org; Sun, 04 Feb 2024 16:41:58 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1d9b2400910so1721775ad.0 for ; Sun, 04 Feb 2024 13:41:56 -0800 (PST) Received: from stoup.. ([43.252.112.156]) by smtp.gmail.com with ESMTPSA id mf11-20020a170902fc8b00b001d8f5560503sm4953670plb.222.2024.02.04.13.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 13:41:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707082915; x=1707687715; darn=nongnu.org; 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=w7DMJgHEIfczGa+x10sgEDsRXfwUGwOd6p01k71b3vA=; b=HlO9ieAYYe4uZC/h/HF3D/TWoMKTK1/YXtGVoBBEA1p+8roAmbjhGWETFPOUMeQreq ZZ1BOemCAP55GZ8E+uhleKjfbRAfnUG2JZMyuwqJc8ZvP8LQM1d15AG6vM/3BqWkbiWT b0naTO3CfUE6P5hMlcBtTqwkn3uwnl71Vl2/60aHEUJ8+Hq3vBJdZmJQHP2E0qnnjuwI ijJx3t+5P9spkpXDEpyAm8OOIa4mEq70Uk3INY3cvHaX7jbhWjYzlxPvas3SEbiqm85R XM+4k+p9QzrFeLbI/qgdL9TFeCEnmUCe9FGB3atIxhI2cmKylTn63KwbaH+77rfRrS90 WgTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707082915; x=1707687715; 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=w7DMJgHEIfczGa+x10sgEDsRXfwUGwOd6p01k71b3vA=; b=f49TXlGuB8x40f7DtfnxAq14aqB/xO5hOguBjHam4NBFiaMqk1f0xAfW/wsenlr51T q+jXmqJcLPiRApgcVwFfckV9AlvWwOdYuvWTnGn81wzVyUGnrN/de93EdpIRf8XfxPDp LdiGadMLZ6JHsjm+q3jr4AIIHbVDY6mXhT7NON0Pe4gWXzI5SyBwqsr3nJ4bqfAV3FcL u5jGtU+W5pgXXH5y2SJBwTzpCfioXG2piTCfQxsPigkIlcofQSV3S5FM3I2hxK6KtHNV 44zDyeSakM/5+HOTcXHjU/enWztnflV+qlvMQ+RYvdKBfvDKCS0ROoRU0QtsiT81ClIP v+Zw== X-Gm-Message-State: AOJu0YyMSP2vSW5WlM5JxNNmhRh+IkkgWqMVj5+YZ5Rt4sRN7Fi+BkOS eLM4yWqWmSsjcs/uCn1Oex+USUwG5HlmbCTP7e4qbi6uJ+RyD2mOFxXPioY/ZnZGXL5xiIG3F/c bZeg= X-Google-Smtp-Source: AGHT+IHvr13lbzos7CeV9v+NVbxs5FVXKcfkBppDgloL0zZZpuScfeM2mE1lYbfCd4Wn2gJhJekySA== X-Received: by 2002:a17:902:e882:b0:1d9:30e3:ea84 with SMTP id w2-20020a170902e88200b001d930e3ea84mr5965524plg.2.1707082915311; Sun, 04 Feb 2024 13:41:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 28/39] tcg/sparc64: Hoist read of tcg_cond_to_rcond Date: Mon, 5 Feb 2024 07:40:41 +1000 Message-Id: <20240204214052.5639-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240204214052.5639-1-richard.henderson@linaro.org> References: <20240204214052.5639-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1707083080326100002 Use a non-zero value here (an illegal encoding) as a better condition than is_unsigned_cond for when MOVR/BPR is usable. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- tcg/sparc64/tcg-target.c.inc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index ac86b92b75..e16b25e309 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -620,7 +620,7 @@ static const uint8_t tcg_cond_to_bcond[] =3D { [TCG_COND_GTU] =3D COND_GU, }; =20 -static const uint8_t tcg_cond_to_rcond[] =3D { +static const uint8_t tcg_cond_to_rcond[16] =3D { [TCG_COND_EQ] =3D RCOND_Z, [TCG_COND_NE] =3D RCOND_NZ, [TCG_COND_LT] =3D RCOND_LZ, @@ -679,7 +679,8 @@ static void tcg_out_brcond_i64(TCGContext *s, TCGCond c= ond, TCGReg arg1, int32_t arg2, int const_arg2, TCGLabel *l) { /* For 64-bit signed comparisons vs zero, we can avoid the compare. */ - if (arg2 =3D=3D 0 && !is_unsigned_cond(cond)) { + int rcond =3D tcg_cond_to_rcond[cond]; + if (arg2 =3D=3D 0 && rcond) { int off16 =3D 0; =20 if (l->has_value) { @@ -688,7 +689,7 @@ static void tcg_out_brcond_i64(TCGContext *s, TCGCond c= ond, TCGReg arg1, tcg_out_reloc(s, s->code_ptr, R_SPARC_WDISP16, l, 0); } tcg_out32(s, INSN_OP(0) | INSN_OP2(3) | BPR_PT | INSN_RS1(arg1) - | INSN_COND(tcg_cond_to_rcond[cond]) | off16); + | INSN_COND(rcond) | off16); } else { tcg_out_cmp(s, arg1, arg2, const_arg2); tcg_out_bpcc(s, tcg_cond_to_bcond[cond], BPCC_XCC | BPCC_PT, l); @@ -696,11 +697,10 @@ static void tcg_out_brcond_i64(TCGContext *s, TCGCond= cond, TCGReg arg1, tcg_out_nop(s); } =20 -static void tcg_out_movr(TCGContext *s, TCGCond cond, TCGReg ret, TCGReg c= 1, +static void tcg_out_movr(TCGContext *s, int rcond, TCGReg ret, TCGReg c1, int32_t v1, int v1const) { - tcg_out32(s, ARITH_MOVR | INSN_RD(ret) | INSN_RS1(c1) - | (tcg_cond_to_rcond[cond] << 10) + tcg_out32(s, ARITH_MOVR | INSN_RD(ret) | INSN_RS1(c1) | (rcond << 10) | (v1const ? INSN_IMM10(v1) : INSN_RS2(v1))); } =20 @@ -711,9 +711,9 @@ static void tcg_out_movcond_i64(TCGContext *s, TCGCond = cond, TCGReg ret, /* For 64-bit signed comparisons vs zero, we can avoid the compare. Note that the immediate range is one bit smaller, so we must check for that as well. */ - if (c2 =3D=3D 0 && !is_unsigned_cond(cond) - && (!v1const || check_fit_i32(v1, 10))) { - tcg_out_movr(s, cond, ret, c1, v1, v1const); + int rcond =3D tcg_cond_to_rcond[cond]; + if (c2 =3D=3D 0 && rcond && (!v1const || check_fit_i32(v1, 10))) { + tcg_out_movr(s, rcond, ret, c1, v1, v1const); } else { tcg_out_cmp(s, c1, c2, c2const); tcg_out_movcc(s, cond, MOVCC_XCC, ret, v1, v1const); @@ -788,6 +788,8 @@ static void tcg_out_setcond_i32(TCGContext *s, TCGCond = cond, TCGReg ret, static void tcg_out_setcond_i64(TCGContext *s, TCGCond cond, TCGReg ret, TCGReg c1, int32_t c2, int c2const, bool n= eg) { + int rcond; + if (use_vis3_instructions && !neg) { switch (cond) { case TCG_COND_NE: @@ -807,9 +809,10 @@ static void tcg_out_setcond_i64(TCGContext *s, TCGCond= cond, TCGReg ret, =20 /* For 64-bit signed comparisons vs zero, we can avoid the compare if the input does not overlap the output. */ - if (c2 =3D=3D 0 && !is_unsigned_cond(cond) && c1 !=3D ret) { + rcond =3D tcg_cond_to_rcond[cond]; + if (c2 =3D=3D 0 && rcond && c1 !=3D ret) { tcg_out_movi_s13(s, ret, 0); - tcg_out_movr(s, cond, ret, c1, neg ? -1 : 1, 1); + tcg_out_movr(s, rcond, ret, c1, neg ? -1 : 1, 1); } else { tcg_out_cmp(s, c1, c2, c2const); tcg_out_movi_s13(s, ret, 0); --=20 2.34.1