From patchwork Wed Oct 25 07:26:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737847 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp150193wrq; Wed, 25 Oct 2023 00:32:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMUrAo2u+YCcS+p37K3CmbkNGE6fQ7X0KsFpyzcV5WtTTGddxowIr1K8DbSnNUFKnO5MVc X-Received: by 2002:a05:622a:cb:b0:41b:7774:96bc with SMTP id p11-20020a05622a00cb00b0041b777496bcmr18089634qtw.10.1698219131319; Wed, 25 Oct 2023 00:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698219131; cv=none; d=google.com; s=arc-20160816; b=zoYFJq8f9HDZtRdJx6XHsyF7gKx7XD1RGD3dEfvmXYt76k1ufh+a/E2WFBUNStMiXI U+VcoiXSGIxgRqao5x70/MsiAfZysIAC3jDj7fMlCahOMlygbmCswHMTHm6gwniIn3nf RHclbL5wdVTzzlcCzEuBTWJ4OShMs5NvZgl+fnR8jBu1zbCfT0nOCN4+xDJA10InVeHV LyMK4yy8QUeL750vxtgbnJs6fKDaSIXsme/W4Za7XP1n2ACCHzEk9ygqch3YJx6c4r+p 47kUIXKIQMCjDmPgULB6EnAGQG6FGyfu2nbRgiHWixYuTpBiHj8ENqAfySeL0NEmiIJb cyvA== 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:cc:to :from:dkim-signature; bh=d+t3wVy/FdNCvxU+M502QkXc3hNFmFswkh6xHioaLL8=; fh=ycigHkwOPieh2u5PmcA89sNk/qPD1ZkdDlL8Mchfvw8=; b=Z5o9HR3Pyu+0Rm+89gv0W1DeIePJQXU8x2AC5bAi0fw4Xieoj0HORcZl1sOSoz1X3r xQu4ON24Ws/1ye+Y0cWbP1iTRsBM44lWikmcpFbUr5mBJaAgEVszMsgagTs3/NXBaloJ McEUywNSrOmoPVIDI14Nry7jMIzPuwX7Tu+ATDpQgArniZAZkZbW3BHCZK+q1rWJEOr3 c78J+bjIUccKhO1Iqmh8cmdzOX9nc5hnmxFSVzIocaSxNDxBUN81FbEWzQi5TK1aMXlZ A/k1pMB1PmxTAs3DeHkeposM1UtqG2awdPYhjRAObzO0U4gS3EElAtWVOKpgdWLIaxNq 9QyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bHde3aHT; 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 p11-20020a05622a13cb00b00419859dfdc6si8220744qtk.788.2023.10.25.00.32.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 00:32:11 -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=bHde3aHT; 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 1qvYIf-0000JP-Bv; Wed, 25 Oct 2023 03:27:33 -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 1qvYIe-0000IS-86 for qemu-devel@nongnu.org; Wed, 25 Oct 2023 03:27:32 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvYIb-0004iR-AT for qemu-devel@nongnu.org; Wed, 25 Oct 2023 03:27:32 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1c9bf22fe05so35212195ad.2 for ; Wed, 25 Oct 2023 00:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698218848; x=1698823648; 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=d+t3wVy/FdNCvxU+M502QkXc3hNFmFswkh6xHioaLL8=; b=bHde3aHTOCa3haLP/BOAgb6EcO0WAnStlYunKJJiUUnF8H0fpsPfRpqpErC4XjV4vb NHVOE7sunCR4KNOeryaQ0lcNBQ8uaR6ZkTNyVRdm9yoFb8n2MnbdC5m/K+dldcju19wF Oy041UDiPNJxoF/1t0+CRBaag1slEBoxXLmg6M+YEYPEAveXnciCTDRykQlojm5UBIEP 1Omkq+Xw7TPxZWjU3nrhtukmbVR+BhVpY1XxGaTj+BJbECmn9gfoiMvgyKrNDPaDrB3c RkRO9aHtiG1R+aRjss67RDAhLQ4rBeeh/OH2vlADLt3t/VWvSaZiVLS7rPeIs6VpMuSl 7EdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698218848; x=1698823648; 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=d+t3wVy/FdNCvxU+M502QkXc3hNFmFswkh6xHioaLL8=; b=mzXnh3CRpWj1YmZoNynn17AI/sRe9xBtMqTmEhe1hS49x5ry6/2lEiO4w9Y242InKG AFWRl3MqwfaVLE/gWIS2buaCd1ta5s9jMlhlNICapoFEZZEI6psFdxbbRl0sZmx37dvm yK+kyAW2GOZffA9Uf7ch1alKt/Zdf0u3zAnxBBtDESDX4kgHtVJMpfje5FvE6I8shfqv XfrLY+PP+gIn/Mt+vG9VPurys+sdFE7muz5SH/DKAVK5zQXGqb9fWcXkVqsPo2e+9Jeg j/NW7ne3I7Vib+L/oVkFCfUJxLQcRXU7q/JMULXuHquwZQG0s747fbYmHMRK59UpDP+5 kWew== X-Gm-Message-State: AOJu0YwRQ7NMAR4UcxnqUsqov5ALuldv6/wSQQq74fQ9gwagtgKFK0ih tnXwYehJ3Qa3RzJswfAMkswaKq06r7yz01ZbfFY= X-Received: by 2002:a17:902:ea0f:b0:1c8:9bc6:2a09 with SMTP id s15-20020a170902ea0f00b001c89bc62a09mr14134842plg.15.1698218848144; Wed, 25 Oct 2023 00:27:28 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ji5-20020a170903324500b001b06c106844sm8578661plb.151.2023.10.25.00.27.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 00:27:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org Subject: [PATCH 20/29] tcg/sparc64: Support TCG_COND_TST{EQ,NE} Date: Wed, 25 Oct 2023 00:26:58 -0700 Message-Id: <20231025072707.833943-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231025072707.833943-1-richard.henderson@linaro.org> References: <20231025072707.833943-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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 Signed-off-by: Richard Henderson --- tcg/sparc64/tcg-target.c.inc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tcg/sparc64/tcg-target.c.inc b/tcg/sparc64/tcg-target.c.inc index e958e3c242..feeb318c39 100644 --- a/tcg/sparc64/tcg-target.c.inc +++ b/tcg/sparc64/tcg-target.c.inc @@ -606,9 +606,11 @@ static void tcg_out_div32(TCGContext *s, TCGReg rd, TCGReg rs1, uns ? ARITH_UDIV : ARITH_SDIV); } -static const uint8_t tcg_cond_to_bcond[] = { +static const uint8_t tcg_cond_to_bcond[16] = { [TCG_COND_EQ] = COND_E, [TCG_COND_NE] = COND_NE, + [TCG_COND_TSTEQ] = COND_E, + [TCG_COND_TSTNE] = COND_NE, [TCG_COND_LT] = COND_L, [TCG_COND_GE] = COND_GE, [TCG_COND_LE] = COND_LE, @@ -648,7 +650,8 @@ static void tcg_out_bpcc(TCGContext *s, int scond, int flags, TCGLabel *l) static void tcg_out_cmp(TCGContext *s, TCGCond cond, TCGReg c1, int32_t c2, int c2const) { - tcg_out_arithc(s, TCG_REG_G0, c1, c2, c2const, ARITH_SUBCC); + tcg_out_arithc(s, TCG_REG_G0, c1, c2, c2const, + is_tst_cond(cond) ? ARITH_ANDCC : ARITH_SUBCC); } static void tcg_out_brcond_i32(TCGContext *s, TCGCond cond, TCGReg arg1, @@ -743,6 +746,15 @@ static void tcg_out_setcond_i32(TCGContext *s, TCGCond cond, TCGReg ret, cond = (cond == TCG_COND_EQ ? TCG_COND_GEU : TCG_COND_LTU); break; + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + /* Transform to inequality vs zero. */ + tcg_out_arithc(s, TCG_REG_T1, c1, c2, c2const, ARITH_AND); + c1 = TCG_REG_G0; + c2 = TCG_REG_T1, c2const = 0; + cond = (cond == TCG_COND_TSTEQ ? TCG_COND_GEU : TCG_COND_LTU); + break; + case TCG_COND_GTU: case TCG_COND_LEU: /* If we don't need to load a constant into a register, we can