From patchwork Fri Dec 2 06:51:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 630243 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp742853pvb; Thu, 1 Dec 2022 22:58:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf6CEw+8egvbnR7z4FzN56h46d88dOiGKzMFkPGPNdbbtqh8nd0gszy+0AvdIVW/8odYbTPp X-Received: by 2002:a05:622a:1f09:b0:3a5:b3cf:8e5b with SMTP id ca9-20020a05622a1f0900b003a5b3cf8e5bmr65451182qtb.302.1669964317066; Thu, 01 Dec 2022 22:58:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669964317; cv=none; d=google.com; s=arc-20160816; b=oPefCSPNfEe51kJ1lbi6tSTMmyjSZ2nlCf15vgxUc7zPUY9b91eqG+vmGULanlRX8k 3hLFZs/kRHn57tE5+PAqIbzwGFTB8PFOPdPCAY0VFbwG8R60YwjYYaWIaiOXQz6Cehbc g8yT6EhE9lT3U2PcaAB99C/70/l5IBFvPsakkvu09UdvMVMeJzwn5Fp1SjS7IJJpQBBA k4TNmLfA39kxN/sFTOVX4WnqKYabnoC2x5AXS61AejW4I8j3uHC90YCuXVr72OEZLyNk kLTHR2dipai1jYjzc9BG8brebZ+2wAh3Tq9uSjLt2/rSZ0PiYfuAQGBfd0rbtsy43zHr 2Shg== 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=4sFX9yZOyM3r1MgjgBiirAQT8v3uQu+8pCAPlCWzIFM=; b=v666Uu2p0AhyUmoC53E2Kd5SIX5eJSatt+2ISCFdT1+MsZpM5yOzGxBDuz1Z4gekfP 7Bly3DuTwz2yE+DAgRqNyNM48OxY6cZ2Dcy2VREANgNmb86qlPo4av30BKgKFyNia8zs rL/aR6bBPTMoL9vQMnWvyvGPi+uQp+dqT0j51AhHnFmEL4DK3jrXz0SAmumXZ1uFzRtC bx3UQAe0sZ71Bnu0FkvX8skKzVpeYt9OxsCbf0JVc407C9zUhD5Go/Z+q2r08ciu0fyq 2/6LE4pCFXbtuk8gZgyHY+jIspsrO8YqqPyRQDatD7tWmMDvZnUQng9bsuPpIcI6j5Ib 2ekw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ra5DsSlW; 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 c68-20020a379a47000000b006fa32ca491fsi3213142qke.46.2022.12.01.22.58.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Dec 2022 22:58:37 -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=ra5DsSlW; 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 1p0zuA-0007ay-VZ; Fri, 02 Dec 2022 01:52:14 -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 1p0zu9-0007Zr-5K for qemu-devel@nongnu.org; Fri, 02 Dec 2022 01:52:14 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0zu7-0003ha-I7 for qemu-devel@nongnu.org; Fri, 02 Dec 2022 01:52:12 -0500 Received: by mail-pg1-x52b.google.com with SMTP id 82so3706292pgc.0 for ; Thu, 01 Dec 2022 22:52:11 -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=4sFX9yZOyM3r1MgjgBiirAQT8v3uQu+8pCAPlCWzIFM=; b=ra5DsSlWn/fRtlIkOKx5G1zuEUQd7IvkZzAb4bfpcN6vchWZoI/1n7RXKAS6YTNdM5 QnmDHSBI0tZMsu4+3RyZ/NJHsyMkfA7r6x6q+aqywFXENFI3xctJeHGQ1E3fwc3fQDoG kfoAlT4sgzDwkt+uiYA1JfxyPQzNQYhoXLMTvzorlH3tuHUTx/O7C4Lwwo8rQfTiuoN0 nRKErH7J4DD8vU0bH8zwzizGQOfNcwcmRVAt/hDAhmHvPbVdQkutc+zW/myOMFgHYJEw ocymuwgv8Dal8YCsmNk/1bmWOq2mcSfOMMURJBgw2PFo9NON/rV/WesyPeRhUvn3Krwi Gbng== 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=4sFX9yZOyM3r1MgjgBiirAQT8v3uQu+8pCAPlCWzIFM=; b=Elw2CSfAH0KJQcWxf1JRMUC+THoVijAhMYQDDgOFiP+AHYH+GSRx3xijkFPMcd2jsN lF3zBWVhOlvVFMnFacCuwmZfPzkS7wrl4dg8L4LbYMoP5ngFb9FUKvM4zA7NTk0h9PXz +mzNyeHhhvXYryQa3saKDp0vuXq1l+2sSDDJx0RbMhQ8uoo0uhWIJT919fHcJFBW0hR5 HVYyro3KSWmMlpF6fKQnRgjYqLqwphVrH/UOQsxpCuJc18kKiNHhE/piNDYh8uZku69a zWBzReMEWBROMRkbe3xHazV14K56v+y5F3rTiiqw8KY0L04HWton0cqy3MztEYvNNTq2 vROQ== X-Gm-Message-State: ANoB5pkLExQ2++i46WNQWA1G2omJXnko1uuj9126jCksw8AmnivGi5eq KtLsLejSfkBDeci7aDr0CWSDIAqGi7lRyCj8 X-Received: by 2002:a05:6a00:216e:b0:56e:7b62:bba with SMTP id r14-20020a056a00216e00b0056e7b620bbamr50992281pff.55.1669963930247; Thu, 01 Dec 2022 22:52:10 -0800 (PST) Received: from stoup.. ([2602:47:d48a:1201:e3cc:2e37:17d4:f1d5]) by smtp.gmail.com with ESMTPSA id q61-20020a17090a17c300b00218d894fac3sm6056649pja.3.2022.12.01.22.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 22:52:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v3 09/13] tcg/s390x: Create tgen_cmp2 to simplify movcond Date: Thu, 1 Dec 2022 22:51:56 -0800 Message-Id: <20221202065200.224537-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221202065200.224537-1-richard.henderson@linaro.org> References: <20221202065200.224537-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target.c.inc | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index 4dcdad04c5..fad86f01f3 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1288,10 +1288,11 @@ static void tgen_xori(TCGContext *s, TCGType type, 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) { @@ -1302,6 +1303,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]; } } @@ -1352,9 +1354,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) { @@ -1455,20 +1465,19 @@ static void tgen_movcond(TCGContext *s, TCGType type, TCGCond c, TCGReg dest, TCGReg c1, TCGArg c2, int c2const, TCGArg v3, int v3const) { - int cc; + int cc, inv_cc; + + cc = tgen_cmp2(s, type, c, c1, c2, c2const, false, &inv_cc); + if (HAVE_FACILITY(LOAD_ON_COND)) { - cc = tgen_cmp(s, type, c, c1, c2, c2const, false); if (v3const) { tcg_out_insn(s, RIEg, LOCGHI, dest, v3, cc); } else { tcg_out_insn(s, RRFc, LOCGR, dest, v3, cc); } } else { - c = tcg_invert_cond(c); - cc = tgen_cmp(s, type, c, c1, c2, c2const, false); - /* Emit: if (cc) goto over; dest = r3; over: */ - tcg_out_insn(s, RI, BRC, cc, (4 + 4) >> 1); + tcg_out_insn(s, RI, BRC, inv_cc, (4 + 4) >> 1); tcg_out_insn(s, RRE, LGR, dest, v3); } }