From patchwork Wed Nov 8 14:52:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 742231 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:110f:b0:32d:baff:b0ca with SMTP id z15csp343162wrw; Wed, 8 Nov 2023 07:10:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKyRJ3o25QA4uj99FtPfJaIhtSmnXczDecp702ZqX4q0yFpxZyTrDk0PZINdfVLzlL9YCw X-Received: by 2002:ad4:4ea1:0:b0:66d:6af7:4571 with SMTP id ed1-20020ad44ea1000000b0066d6af74571mr2475102qvb.17.1699456257497; Wed, 08 Nov 2023 07:10:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699456257; cv=none; d=google.com; s=arc-20160816; b=zO7+MlQfhoinX7OKrswyAGQtR8cuXmUA97ubgII96KhABvJAiK4MUhjD1R9HlMSgX1 jIO57qEhfplLFdjuU4tXc9alHRpOKhqPbQa/7Rt/lnWuWADYGqIIqpxwdPuSUut61tfK RQ7HSAuT/93K0Ruedv1uNQBooojP4+utJE6BIkI2rtNyeL2dr01nZPSaWlsl49anCuM4 RjTPQkGUZZN/foYJ2Uj1UvmLoFSgxG619kWqE+onZIihIeAofdvwHCIMbxG+7NHmvSnD 5Vay52crBGggbDf66fRiuYSQClgDXDlmeHWU/iq307Oztoq8guKwnmb2xxS8nu3dWwKL ChbA== 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=NVFDT+R54Bka3Z7J05tSdo0rO45X1nMnKArEtpE1spQ=; fh=OVkFVJuMUg9q4Kx7dkC+KxU7Oz3EsIEY+aUQ9DXP/MI=; b=u4n9/zIgt+e82LjZXkuCPITdlmgiGmuxz9p2N2wpfTzNbD2ae90FFNLi43NZ3EepKz fg0Gyxos9wcNBbEjftRZQvcMO3s0q3yzdwtA1OGaF6zOm4/8f2ZDqzeY/DHXUjORjEY1 0e1iP0VChPbGsIehzjwjfpD5nZCz1Tgej0PUqtyHUx55WAHvdIWE+B6PhLbCEZAFrv13 /vrITEXrlu3xJz42If9mkDAzzSz7T9zMq7X/H6p8s7+dwxR5cJZ9re6aJAPqv7bSCpS8 Y5RzOVRzvlYntd2VttQnSqXJEfceA4xg12AR6BqL9nfOxWjrRTGiSW6hsAFlDETs7THe 1gIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QeK9is+Z; 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 ez3-20020ad45903000000b0065623cd1f57si1395765qvb.464.2023.11.08.07.10.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Nov 2023 07:10:57 -0800 (PST) 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=QeK9is+Z; 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 1r0jvN-0001T7-Su; Wed, 08 Nov 2023 09:52:57 -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 1r0jvM-0001ST-0q for qemu-devel@nongnu.org; Wed, 08 Nov 2023 09:52:56 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0jvJ-0002FW-S5 for qemu-devel@nongnu.org; Wed, 08 Nov 2023 09:52:55 -0500 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-9dd5879a126so832104166b.3 for ; Wed, 08 Nov 2023 06:52:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699455172; x=1700059972; 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=NVFDT+R54Bka3Z7J05tSdo0rO45X1nMnKArEtpE1spQ=; b=QeK9is+Zc7cAbTsHAnGrdr9wOp1AtUbUenY3Js1Qg4nbzxxScPAaRm729pYhDrQjt0 Cq1OD48tizbalsmHeT/Urx1A8hNpHliGzEZwFNtqVAjXO8eRtWvAd06IozEZE1jMvy2M QlKTQa1+rA0/LTJYCVKVAptxlm/rCf0S/7R649kegvsd398txZCaVpT8dLPCYkRJCjA8 bweXTsQSS4AS6p7WKmllNunG4Z4PcRXQeS8g8p0drejTob3IfAY7eEzSVMR7fKfpHYeT 5PX8nyj0rO3H3sgTq6sIVM/qQP8fvJ3LP4yz5XLb8u8pUBVnsB6XIhcJgDRcgF4TEJo0 QMgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699455172; x=1700059972; 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=NVFDT+R54Bka3Z7J05tSdo0rO45X1nMnKArEtpE1spQ=; b=Hh9LSWRHuZWBqHe5D4xKaOfEnWQp2vJbXsjvuHFySqj3KY7berfU0UGZcYGwDRybqp lqCzBupWSC9sEwAHszU5SKiEtxa7+xr1drP/x+eUJdh+k1h4SMLr1owEY9rUem0g/PwH M2HVKMH1u+wR0bhNzF/sA9LZsrzBVvW9hpr+iq0RYzhU6wr6Xzgdny7s3iblnJXPDWAc oO4lYFlEvlsRbqWzYs6xslNdLsoAM9FnYSuZO0gwgfNLo+3IOysLBiISjvcjVDPm+7Uh 2jWzWMOf2MhlBuDZ9GRW6eHuIeznLvZ+DvT8f1qlEfTvEpmmAGghhEx4ZBVkMKDdQsAB qonw== X-Gm-Message-State: AOJu0YzAfYSj6dL6fnGc4xff5aKqr6dJD7lwBnjfALSyA6YNPRtMKJ+W c8ceD26gerdekya3RIN2vTpWJyy2umSescwLGcs= X-Received: by 2002:a17:907:e88:b0:9ae:588e:142 with SMTP id ho8-20020a1709070e8800b009ae588e0142mr1794162ejc.67.1699455171905; Wed, 08 Nov 2023 06:52:51 -0800 (PST) Received: from m1x-phil.lan ([176.187.199.60]) by smtp.gmail.com with ESMTPSA id t15-20020a1709064f0f00b0099bcf9c2ec6sm1163516eju.75.2023.11.08.06.52.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 Nov 2023 06:52:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 11/35 2/2] tcg/arm: Support TCG_COND_TST{EQ,NE} Date: Wed, 8 Nov 2023 15:52:43 +0100 Message-ID: <20231108145244.72421-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231028194522.245170-12-richard.henderson@linaro.org> References: <20231028194522.245170-12-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=philmd@linaro.org; helo=mail-ej1-x62c.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=unavailable 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 From: Richard Henderson Signed-off-by: Richard Henderson Message-Id: <20231028194522.245170-12-richard.henderson@linaro.org> [PMD: Split from bigger patch, part 2/2] Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Philippe Mathieu-Daudé --- tcg/arm/tcg-target.c.inc | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 66d71af8bf..0fc7273b16 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1194,7 +1194,27 @@ static void tcg_out_mb(TCGContext *s, TCGArg a0) static TCGCond tcg_out_cmp(TCGContext *s, TCGCond cond, TCGReg a, TCGArg b, int b_const) { - tcg_out_dat_rIN(s, COND_AL, ARITH_CMP, ARITH_CMN, 0, a, b, b_const); + if (!is_tst_cond(cond)) { + tcg_out_dat_rIN(s, COND_AL, ARITH_CMP, ARITH_CMN, 0, a, b, b_const); + return cond; + } + + cond = tcg_tst_eqne_cond(cond); + if (b_const) { + int imm12 = encode_imm(b); + + /* + * The compare constraints allow rIN, but TST does not support N. + * Be prepared to load the constant into a scratch register. + */ + if (imm12 >= 0) { + tcg_out_dat_imm(s, COND_AL, ARITH_TST, 0, a, imm12); + return cond; + } + tcg_out_movi32(s, COND_AL, TCG_REG_TMP, b); + b = TCG_REG_TMP; + } + tcg_out_dat_reg(s, COND_AL, ARITH_TST, 0, a, b, SHIFT_IMM_LSL(0)); return cond; } @@ -1225,6 +1245,13 @@ static TCGCond tcg_out_cmp2(TCGContext *s, const TCGArg *args, tcg_out_dat_rI(s, COND_EQ, ARITH_CMP, 0, al, bl, const_bl); return cond; + case TCG_COND_TSTEQ: + case TCG_COND_TSTNE: + /* Similar, but with TST instead of CMP. */ + tcg_out_dat_rI(s, COND_AL, ARITH_TST, 0, ah, bh, const_bh); + tcg_out_dat_rI(s, COND_EQ, ARITH_TST, 0, al, bl, const_bl); + return tcg_tst_eqne_cond(cond); + case TCG_COND_LT: case TCG_COND_GE: /* We perform a double-word subtraction and examine the result.