From patchwork Fri Dec 9 02:05:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632218 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp590726pvb; Thu, 8 Dec 2022 18:12:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf6zVIb6/NTmvD4w5YmHNoCu0UQmft/XPWM913pHpEVhxB8Qrmz4Ni7Cmy+3rdAlb49u1u2X X-Received: by 2002:ad4:4709:0:b0:4c7:629e:7a70 with SMTP id qb9-20020ad44709000000b004c7629e7a70mr6213217qvb.44.1670551943676; Thu, 08 Dec 2022 18:12:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551943; cv=none; d=google.com; s=arc-20160816; b=Kar1xPObWVQbdfPt1e82iAoMqnNX2B6q+u2LBFhURXgzwlWJBi11VghgGoWsk9nds5 fESHqA3yz/CIiMwrNn3YpXulZDby5MAjBVMvqojzsfKkBk4SoeshbZvBaTTIANIAo7iC omO7/9KNPvQBh6da5DvCV3Veu4qnvco/YQ2MLbbmfPeJksLX6s8X1ajGoq8LKChDgjOu avXbSC3Cf3PNEkOXMmWQ5tSloIlWW5M7qe7AjEv+v/70K4l05NH0XxueghqzAwOgoHRy JKTng9pGC7r76E2JnkCHRKQNflwYx6FjHDTfCUBIxq/qt+u+YdXuMZibQvtCgxajaEEk uBgg== 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=CJ/9NJKojCTI8IsyXCxUEUWPG0r5aG42tVuV9K2OrB0=; b=AbqjZAaLoBQhSPiJsBQQBG4yWKq/5bIW6lzRm5D8qMXN3uQ9mc0/37ImgeYLC2JGyP NSwty7yXoTkWiNCd/C/ex9Nl3TSeQUQtRd/GyhM0s0WQupPX9c20k6GKJakR5m/hYyNG ggBbAyjVpg1AIZyUmMIUqYIBfsh2+wbma6zFrqSmum7eEITx/+i3XMxNvoKUCeomzcRW +GueNE1F186IhFu85p4iFQfCbLMxp5n88AL17h9INGHp722u3UWkrxFbqlWsEIBrLDmW iYCG1Q3lY7u+VdRZfOj7p5KIvIuZbJConzknHDp00sVxsz30eQBZzDM/49Q5hj5p4WXG KyHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IeikftGK; 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 k27-20020a05620a139b00b006e3fcaa9da4si64880qki.41.2022.12.08.18.12.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:12:23 -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=IeikftGK; 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 1p3Sm7-00063t-A0; Thu, 08 Dec 2022 21:06:07 -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 1p3Sly-00060f-9i for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:58 -0500 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Slw-0001sD-Lf for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:05:58 -0500 Received: by mail-oi1-x231.google.com with SMTP id c129so3306889oia.0 for ; Thu, 08 Dec 2022 18:05:56 -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=CJ/9NJKojCTI8IsyXCxUEUWPG0r5aG42tVuV9K2OrB0=; b=IeikftGKxmM+kN5WW2muamkPWmZCrd2qWF5R1W+bymjPgcBXQVQhmKsTdvt5PqfonY JXi+IjuSRUbFS+fiiDkpTEMwqvpIYuAAQVqGhpDtdxAL0uAXpi7jLB+fIRQvSuAVW9Uo fbBsVnboZtaga+s/8f6SxEQDT7oLzPhEr3jnEUvmP7qGnW4/NuaVpwMqODBpcZRHhTfh /GfGQBUh+AfPUsp7z2t0asgxyZ6ChmTU5YgThxm7ONsDH6kXHmL2XIyN9xU0R7iqdB/W l+J6wLreGVWM6h7xjk0vcY7o1Adf7ul2wxhZuKXWw98YP8wHtKZuoH88adqNtKsHnQK4 7dAg== 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=CJ/9NJKojCTI8IsyXCxUEUWPG0r5aG42tVuV9K2OrB0=; b=x38APZ1ZiO11AOOQ4IVP+J7sdbyplTcqs6t8kEFgIW2qvZtZdIKQUZqodo9IcQRFtL XSDTK1yZ6KxGSF6WG0BJ2pOA7Zl0a+3j939T6G5t456hmoxO/uTkgP/OWzccgMrrkxI/ arRfJITXTibwcLI3aw15osn5r3sQ/JlxqJoutYphR8lvMA7nRUrwjtRCzdSufp2UvgeZ tNgnC8zqbI4lxd4Ioggo89jX5pPAVdQ+FnWhJAfaN/G6Hy7viIBTR8y1F2PintHQB1L4 F/v1jJ1FQE8z/7fbiw4UdIaOOAMtK5d1I0xRQ5ODz+92BKe9LWPeFoqLYtY4MqhxfTY3 Hymg== X-Gm-Message-State: ANoB5pkm5pbxxvnUyTH1Dt97jHX6Dx3WAupBzo5+D3bhIwcRJ2BrhIla DO6zmHaztR//+uJjJQPN7KNSEfVwCqPq4gNdsbY= X-Received: by 2002:a05:6808:3009:b0:355:1de9:6546 with SMTP id ay9-20020a056808300900b003551de96546mr2345954oib.40.1670551555966; Thu, 08 Dec 2022 18:05:55 -0800 (PST) Received: from stoup.. ([2806:102e:18:2efc:d298:de6f:2ed:87a4]) by smtp.gmail.com with ESMTPSA id s14-20020a05683004ce00b0066f7e1188f0sm53531otd.68.2022.12.08.18.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:05:55 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 20/27] tcg/s390x: Create tgen_cmp2 to simplify movcond Date: Thu, 8 Dec 2022 20:05:23 -0600 Message-Id: <20221209020530.396391-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221209020530.396391-1-richard.henderson@linaro.org> References: <20221209020530.396391-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::231; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x231.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 Return both regular and inverted condition codes from tgen_cmp2. This lets us choose after the fact which comparision we want. Reviewed-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index bab2d679c2..a9e3b4a9b9 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1207,10 +1207,11 @@ static void tgen_xori(TCGContext *s, TCGReg dest, uint64_t val) } } -static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, - TCGArg c2, bool c2const, bool need_carry) +static int tgen_cmp2(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, + TCGArg c2, bool c2const, bool need_carry, int *inv_cc) { bool is_unsigned = is_unsigned_cond(c); + TCGCond inv_c = tcg_invert_cond(c); S390Opcode op; if (c2const) { @@ -1221,6 +1222,7 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, } else { tcg_out_insn(s, RRE, LTGR, r1, r1); } + *inv_cc = tcg_cond_to_ltr_cond[inv_c]; return tcg_cond_to_ltr_cond[c]; } } @@ -1263,9 +1265,17 @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, } exit: + *inv_cc = tcg_cond_to_s390_cond[inv_c]; return tcg_cond_to_s390_cond[c]; } +static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, + TCGArg c2, bool c2const, bool need_carry) +{ + int inv_cc; + return tgen_cmp2(s, type, c, r1, c2, c2const, need_carry, &inv_cc); +} + static void tgen_setcond(TCGContext *s, TCGType type, TCGCond cond, TCGReg dest, TCGReg c1, TCGArg c2, int c2const) { @@ -1348,7 +1358,10 @@ static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest, TCGReg c1, TCGArg c2, int c2const, TCGArg v3, int v3const) { - int cc = tgen_cmp(s, type, c, c1, c2, c2const, false); + int cc, inv_cc; + + cc = tgen_cmp2(s, type, c, c1, c2, c2const, false, &inv_cc); + if (v3const) { tcg_out_insn(s, RIEg, LOCGHI, dest, v3, cc); } else {