From patchwork Sat Jan 7 07:51:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 640062 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp1174233pvb; Fri, 6 Jan 2023 23:52:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXufI3xVunLnoNpaenvgmOfQK4b+dNFK4kGW2pyA+4mBp0wAsanzjL0/AuHRa8c6onPyQQnF X-Received: by 2002:ac8:7401:0:b0:3a8:31f5:a0a with SMTP id p1-20020ac87401000000b003a831f50a0amr78427612qtq.64.1673077940799; Fri, 06 Jan 2023 23:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673077940; cv=none; d=google.com; s=arc-20160816; b=T0/Y5nFdfsmRVA0Rulga0ghB/m6vXVVP4r9CNCDcZX0lVGsxM0BxjySj5cNAoAkPGA CoqDKPlaBg5DW1AT6wL9S+er45dmT1srWrmRMvTeCQ1w2UsOvJZIW9/9add5OTXyr0bQ BSBBGG8mTSSwwymGFU0bHoNFvd7k9xoByhw5yOfYVVYJ2kkWGngjPi24KFV5P0HAr3x0 BiGYHvJjLLtD6vACWYtCMLb9sWno/BShwI47UgjWPDMfvjDoVO57SdHjSIJTyS3n3IG+ OBSY015Cbm0CoU9lhaMwpvAIjoTTIfUXIxrUjKgsFfdjlzCemV2+ysUdU2SVWGpIQj6C o4zw== 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=r0wyYihsWPXw8Yqko2NtqMR1/ytj9ZC8grnAJG95FjU=; b=WqdLUeeOcHh+B2z9aiqSENK4o6v7r+TVaTvuVDYmccrMBdZjc5afyAu5diNwPEopba ScQdexJ5jEdhFSskz69tRGgVzBjQk2zZNIOAdUeEMhjPCUKDtSW1T+trXBp9rTH1ESZN z6oxnL2H0uIT+eQV0S9J36AtiXuFHjT+2Is3wOwSfd5NoHhaINDBl62Vl/p2H31JEA/m aTxaR1qXN7ujj0KYlXmR9xLbXq8YJPDPCusI4gEASHo3lHqq7QGp7jYpy71FQ+jWIU2P EkwwVave+gCZFZGKXDAYDcj2qy0VGRHiK12RwRRsetIMGDuLhd7Twt+jHjaOuHMA07oF X8tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EnxeAfDw; 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 bq5-20020a05622a1c0500b003a7ea2c8381si1960516qtb.775.2023.01.06.23.52.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Jan 2023 23:52:20 -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=EnxeAfDw; 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 1pE3zV-0003lZ-TN; Sat, 07 Jan 2023 02:51:46 -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 1pE3zU-0003ke-7E for qemu-devel@nongnu.org; Sat, 07 Jan 2023 02:51:44 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pE3zS-0004GI-Jx for qemu-devel@nongnu.org; Sat, 07 Jan 2023 02:51:43 -0500 Received: by mail-pl1-x632.google.com with SMTP id jl4so4063042plb.8 for ; Fri, 06 Jan 2023 23:51:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=r0wyYihsWPXw8Yqko2NtqMR1/ytj9ZC8grnAJG95FjU=; b=EnxeAfDwKPYZYM9PxTjlO4WL/9IMiofhbvkIvSqds0qpzwm8FfT5I5EovuhyB7hHN4 gbliX4/ZyNtS5yBuEIfVguFSuXJJERnRsvQuqEupFF64WmtiX8AvT9/9TBGAnW/x2jjq /iEkMGY8w5VyYSJogocYUgCPVgMlLMOXlPUgQnQgGkNkRXqbDoaYHJaGv0F8Cdkoavi+ YeO0RgB7Ts9wNkKfC1B+4NnX+BMiGy1Ir3PtXfjKNYhOTfrCK0LTyNwGBfzOcJOOpEZD KlNNda3IFO7E8DHb/sikgACX9WUXPfntDk6R2sZcSd+5FwTf+ISNfmaIAm46YkY6yJ3p ZzgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=r0wyYihsWPXw8Yqko2NtqMR1/ytj9ZC8grnAJG95FjU=; b=RWjUKypAZdn6aoRVh0glCDXLP5ybEcBB4EmmwzIXHHrDmnrqNMPxve+oQXw9xYKFHa 11djcCVKYDpaouEfoja/FEvA4iUwf9e6v4ZfSzkPEe3/gOpV2I3jCKugZKNuQSVQR6BF Byqez8XH5czNu/CcbkHrbLzAm+B71GvoQ+sRBG0DSWy7HVwTeGdNIojaZP4Lq8ddkZXd dclq0zmRcuFMgOq2hNqvGN45PX+i9apUqS2pM0J8cjPBFQklPhFhlKUxo9KWp9vhpDw9 E2QN0MX7csRNfe8LLPWdDIG2mkHaj627k3UODaRdBklQIwK5RZcOuJ78TtP/IKXmxYam q7Zg== X-Gm-Message-State: AFqh2kpq1DT8WtHpho1vK9FiD6AQ27Rwbsoq4nW72WPRfOT0ziEGIq/W 71hukgkWGdJWFgpHd+wzFMzAu+Kl7ZiYbZ/i X-Received: by 2002:a17:90a:3985:b0:226:df9e:9147 with SMTP id z5-20020a17090a398500b00226df9e9147mr5422045pjb.38.1673077901373; Fri, 06 Jan 2023 23:51:41 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:9d81:5b04:51d7:acae]) by smtp.gmail.com with ESMTPSA id bj5-20020a17090b088500b00212e5068e17sm1945119pjb.40.2023.01.06.23.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 23:51:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 23/27] tcg/s390x: Use tgen_movcond_int in tgen_clz Date: Fri, 6 Jan 2023 23:51:14 -0800 Message-Id: <20230107075118.1814503-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230107075118.1814503-1-richard.henderson@linaro.org> References: <20230107075118.1814503-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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 Reuse code from movcond to conditionally copy a2 to dest, based on the condition codes produced by FLOGR. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-con-set.h | 1 + tcg/s390x/tcg-target.c.inc | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index 8cf8ed4dff..baf3bc9037 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -24,6 +24,7 @@ C_O1_I2(r, 0, rI) C_O1_I2(r, 0, rJ) C_O1_I2(r, r, r) C_O1_I2(r, r, ri) +C_O1_I2(r, r, rI) C_O1_I2(r, r, rJ) C_O1_I2(r, r, rK) C_O1_I2(r, r, rKR) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index ab1fb45cc2..8254f9f650 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1424,15 +1424,15 @@ static void tgen_clz(TCGContext *s, TCGReg dest, TCGReg a1, if (a2const && a2 == 64) { tcg_out_mov(s, TCG_TYPE_I64, dest, TCG_REG_R0); - } else { - if (a2const) { - tcg_out_movi(s, TCG_TYPE_I64, dest, a2); - } else { - tcg_out_mov(s, TCG_TYPE_I64, dest, a2); - } - /* Emit: if (one bit found) dest = r0. */ - tcg_out_insn(s, RRFc, LOCGR, dest, TCG_REG_R0, 2); + return; } + + /* + * Conditions from FLOGR are: + * 2 -> one bit found + * 8 -> no one bit found + */ + tgen_movcond_int(s, TCG_TYPE_I64, dest, a2, a2const, TCG_REG_R0, 8, 2); } static void tgen_deposit(TCGContext *s, TCGReg dest, TCGReg src, @@ -3070,11 +3070,13 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_rotl_i64: case INDEX_op_rotr_i32: case INDEX_op_rotr_i64: - case INDEX_op_clz_i64: case INDEX_op_setcond_i32: case INDEX_op_setcond_i64: return C_O1_I2(r, r, ri); + case INDEX_op_clz_i64: + return C_O1_I2(r, r, rI); + case INDEX_op_sub_i32: case INDEX_op_sub_i64: case INDEX_op_and_i32: