From patchwork Wed Oct 25 07:27:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737835 Delivered-To: patch@linaro.org Received: by 2002:adf:f842:0:b0:32d:baff:b0ca with SMTP id d2csp149182wrq; Wed, 25 Oct 2023 00:29:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaurVJxpz2YNfvmvhZ7c0KxF6UhkY4m3OgpsoDP0OWPew17fF6Tvj9T2810PEdqKU6TvRD X-Received: by 2002:a05:600c:1d8a:b0:406:54e4:359c with SMTP id p10-20020a05600c1d8a00b0040654e4359cmr11272553wms.19.1698218949385; Wed, 25 Oct 2023 00:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698218949; cv=none; d=google.com; s=arc-20160816; b=SRgRVTv1BCI/Nsa/16sons4ygbvraiAOLrxIlIpbXnpBEbg2XHEfrqiJgJs8K80bCQ 7PesubOn8JiCuRzqJOH4/+dGKP+6nBTVLvYfuFnEFxRX1ubgPdJBEk5uANSoDc9IGeEl IBYR3LQ3j1rbaI81rmR3SA14AjkjrSJPSFw/+Me7uQbZ7Cng+4hhkVsY+FUMhF42Ob3r zIDWK1PA7Srnt2+Tt+Q0vJvW8CeT5Oin+KvREkB8mwh85dYYVSxGgHzzJ6huXjmcKK3Q qUz8D2jPaEnx4LlBUXyxbymk4TUtFnUcv8X03eak2m97jzTYhrqm9n9ZqNN45FanVFqC 64JQ== 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=BFVGCMOltQrt8RNTWYZyEMkY4e7wb1/f4QxWVOJact4=; fh=ycigHkwOPieh2u5PmcA89sNk/qPD1ZkdDlL8Mchfvw8=; b=hJNU/6nFATnJSS5EGi0deZD6xKzYl+pREsjTZmtLFW+lWXgPjsrYdOZrAsFzgHZj/Z 1ihYwGyGX0avO9G337NJF7+iThA8fUT8hUiUMKOk+Fk2Zt0It5FPHoraOjRf25luUcbV sa7U5oj1+EtKv59SYzobya3TlvYE6Vs2sruQq2JUWuJ1Y3FMZo7H/sMSb2fPh5bg/Ix/ W9ZyNhkM2i5BXWZR0DnG2Ua9gxGu3dxNjkdrBwvpKronN8bz/d5QxMWLOSzgnXWIYNej SOHH8my1qwczFCworUQoBw2A/t87vusvMb9DMMkZoZF1NfnWtpCDpTpkwobRBR+YQ2+C imtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="tr+v0/IR"; 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 e7-20020a05600c218700b0040478341128si10521271wme.101.2023.10.25.00.29.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2023 00:29:09 -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="tr+v0/IR"; 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 1qvYIl-0000LD-0K; Wed, 25 Oct 2023 03:27:39 -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 1qvYIi-0000Ke-6B for qemu-devel@nongnu.org; Wed, 25 Oct 2023 03:27:36 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvYIf-0004je-CN for qemu-devel@nongnu.org; Wed, 25 Oct 2023 03:27:35 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c9bf22fe05so35212635ad.2 for ; Wed, 25 Oct 2023 00:27:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698218852; x=1698823652; 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=BFVGCMOltQrt8RNTWYZyEMkY4e7wb1/f4QxWVOJact4=; b=tr+v0/IRtpvjGFAC3j5X1C/NV372+pMb3PSuUewyXV2MbZ9u9CIzfiWUOrptDDZbE7 mbXP//NuClKKTvgYHnTA2XOAcl7HcHzN55k+GiA8T60zOBPWpJLPmXMp+RiHKeaSFlQF PMZek/buh+yfUh0N9DrcB8aoAADQa7bhORT9lkJgRam9q1Sn6EfphC8ZttUMFk+T6FR3 9J31Mvs6+W/G/e64f4ru5uEzDYLCUhAXyk99oDcqTOsr0oLu8RE7I9Y7fS4JvF/yImkW pBnJzlsVd9InUr2hPDTPMzYRljHb/wL7sg1O63gSXccictIROdrGcwcri5dLgmzH7KbM szfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698218852; x=1698823652; 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=BFVGCMOltQrt8RNTWYZyEMkY4e7wb1/f4QxWVOJact4=; b=ZJIt6GgCFpwYFpSXJhIZgKeftKbQlriYFKUOJsk7HPFQjYqXmAYipgNJbpAcW5BrJs N3XSnvZDIEMgNLYgxwPcg9Uy32hxedHmfISbQLN+EYCdjbB2OpCLuCFgnQdHgPJETOxF ceReNb4Rjr2iMLJVcbisCJwkJa9o7J5gvpzLiTotALC/JVZO8C/FN3/qgE0rGvFNjo63 GfEIHACBafRc6D1JTHEgUoz8GvuLE6mSRvYMD997gA4IlBJjIld415B3LEKk1vFg1Wy1 F1KPxWZLb7EAHpLsKWq74X0Ii+bDQQ8M8x2ue479ZizaaVhEyXG2k8BYZ17yQ2j3O6CQ ehfA== X-Gm-Message-State: AOJu0YxNmR45SsWb5XfHW1UhgUE5l8bAobApQd/Qvrfa3n+KBm/ph9lR 325sXCRamCoJfgkS8V9EFdlqOrM+2146nL5a/Q0= X-Received: by 2002:a17:903:284b:b0:1ca:82ef:4d7f with SMTP id kq11-20020a170903284b00b001ca82ef4d7fmr9213484plb.67.1698218851925; Wed, 25 Oct 2023 00:27:31 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id ji5-20020a170903324500b001b06c106844sm8578661plb.151.2023.10.25.00.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 00:27:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org Subject: [PATCH 24/29] tcg/ppc: Support TCG_COND_TST{EQ,NE} Date: Wed, 25 Oct 2023 00:27:02 -0700 Message-Id: <20231025072707.833943-25-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::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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/ppc/tcg-target.c.inc | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc index fe141a26f9..5a316f364d 100644 --- a/tcg/ppc/tcg-target.c.inc +++ b/tcg/ppc/tcg-target.c.inc @@ -669,9 +669,11 @@ enum { CR_SO }; -static const uint32_t tcg_to_bc[] = { +static const uint32_t tcg_to_bc[16] = { [TCG_COND_EQ] = BC | BI(0, CR_EQ) | BO_COND_TRUE, [TCG_COND_NE] = BC | BI(0, CR_EQ) | BO_COND_FALSE, + [TCG_COND_TSTEQ] = BC | BI(0, CR_EQ) | BO_COND_TRUE, + [TCG_COND_TSTNE] = BC | BI(0, CR_EQ) | BO_COND_FALSE, [TCG_COND_LT] = BC | BI(0, CR_LT) | BO_COND_TRUE, [TCG_COND_GE] = BC | BI(0, CR_LT) | BO_COND_FALSE, [TCG_COND_LE] = BC | BI(0, CR_GT) | BO_COND_FALSE, @@ -683,9 +685,11 @@ static const uint32_t tcg_to_bc[] = { }; /* The low bit here is set if the RA and RB fields must be inverted. */ -static const uint32_t tcg_to_isel[] = { +static const uint32_t tcg_to_isel[16] = { [TCG_COND_EQ] = ISEL | BC_(0, CR_EQ), [TCG_COND_NE] = ISEL | BC_(0, CR_EQ) | 1, + [TCG_COND_TSTEQ] = ISEL | BC_(0, CR_EQ), + [TCG_COND_TSTNE] = ISEL | BC_(0, CR_EQ) | 1, [TCG_COND_LT] = ISEL | BC_(0, CR_LT), [TCG_COND_GE] = ISEL | BC_(0, CR_LT) | 1, [TCG_COND_LE] = ISEL | BC_(0, CR_GT) | 1, @@ -1699,6 +1703,12 @@ static void tcg_out_cmp(TCGContext *s, int cond, TCGArg arg1, TCGArg arg2, imm = 0; break; + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + tcg_debug_assert(cr == 0); + tcg_out_and_rc(s, type, TCG_REG_R0, arg1, arg2, const_arg2, true); + return; + case TCG_COND_LT: case TCG_COND_GE: case TCG_COND_LE: @@ -1909,6 +1919,16 @@ static void tcg_out_setcond(TCGContext *s, TCGType type, TCGCond cond, tcg_out_setcond_ne0(s, type, arg0, arg1, neg); break; + case TCG_COND_TSTEQ: + tcg_out_and_rc(s, type, TCG_REG_R0, arg1, arg2, const_arg2, false); + tcg_out_setcond_eq0(s, type, arg0, TCG_REG_R0, neg); + break; + + case TCG_COND_TSTNE: + tcg_out_and_rc(s, type, TCG_REG_R0, arg1, arg2, const_arg2, false); + tcg_out_setcond_ne0(s, type, arg0, TCG_REG_R0, neg); + break; + case TCG_COND_LE: case TCG_COND_LEU: inv = true; @@ -2081,6 +2101,13 @@ static void tcg_out_cmp2(TCGContext *s, const TCGArg *args, tcg_out32(s, op | BT(0, CR_EQ) | BA(6, CR_EQ) | BB(7, CR_EQ)); break; + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + tcg_out_and_rc(s, TCG_TYPE_I32, TCG_REG_R0, al, bl, blconst, false); + tcg_out_and_rc(s, TCG_TYPE_I32, TCG_REG_TMP1, ah, bh, bhconst, false); + tcg_out32(s, OR | SAB(TCG_REG_R0, TCG_REG_R0, TCG_REG_TMP1) | 1); + break; + case TCG_COND_LT: case TCG_COND_LE: case TCG_COND_GT: