From patchwork Sat Jan 7 07:51:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 640084 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp1180847pvb; Sat, 7 Jan 2023 00:15:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXv/M1TM9j0z0xjQoJRkKClEKjinjq5eIJiyuQxi7KCih8Z+yzPbrdLhroxqpNlmTz40bOBN X-Received: by 2002:ac8:5191:0:b0:3a6:93cf:7dec with SMTP id c17-20020ac85191000000b003a693cf7decmr80204063qtn.48.1673079345407; Sat, 07 Jan 2023 00:15:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673079345; cv=none; d=google.com; s=arc-20160816; b=E9fQWao8GkTLnPChIeZdiNEgIsBfVFTdq5msoq12Fr2xqkFWTLxU3I/SDplSdaZA3U JGtyDg/7elEUI6lu8x6mrZo6IFRdJS1+YLktE2KhZ4c8r8VOnKjgEpwKWZ6NL6jMsCmb 5/8ceYdNvlxtq7GuEVdzOZC0hLM4w3H6mZV/r3ItZX3TI+jPz3I4RZPJiNxSsyucLaOp VDh8zf0pPjOtYo7lY5pLtHXcyxkuQ+eMrkg/J6320jTVgPhl8ifn3EL+XhoYgE4ZWW/3 KJbAJbREN5vXZ2vsMM2U0ImKfgAC1AQrlJaP/lvX6NovWg4MAM+/0OkPzn4NJmDRcsoj kqZQ== 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=B5jDJMmfOUFUvRhY/+KbOD6glYKKCBpS5QjZ3owLPjMm3jtXLh29mt2GXyOpXfg1iy GaY8QEZBFKi8MghpSaMdtUd8Qb8M4kkthRDivOdrRcHjiAM3millOY3IkRvAe99iGeIu WxvspjIFi+2s8S7D+abZOrPaBSi0A+VwZ6esiW6hDHi6XAIAoaQPElF7RLMDNshDv+ex wBX5ggZTLKBN0r4g/mAnF1MuoUM2qInoa34nuUZLWbrHdKrMALNpxQsxUA2QY1rj7WyZ R8PSEjWIQUaSAbJ5FgAbF5X3lDvwNjvn7wlX216wxdxsJ0FeOzcZCqCNr0GC8XZvqHvD /GCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zz63YDRY; 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 p3-20020ac84603000000b003ab626dd418si1925746qtn.680.2023.01.07.00.15.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Jan 2023 00:15:45 -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=Zz63YDRY; 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 1pE3za-0003q7-P4; Sat, 07 Jan 2023 02:51:50 -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 1pE3zR-0003ii-FQ for qemu-devel@nongnu.org; Sat, 07 Jan 2023 02:51:41 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pE3zP-0004FX-OY for qemu-devel@nongnu.org; Sat, 07 Jan 2023 02:51:41 -0500 Received: by mail-pj1-x102d.google.com with SMTP id v13-20020a17090a6b0d00b00219c3be9830so4130362pjj.4 for ; Fri, 06 Jan 2023 23:51:39 -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=Zz63YDRYq8ZFIwJ6T/E8iNuuZXxCW+VHmapBatfcRFILS8WSy9V+cWib8KfG+0HOwn Kn15uauALlgYQc6cbqI39rZdtmzoGO6qvnTP6TmGCDTnZhe5qLnuZ8nEm/BgwovJW34U pwbCXSjHADCGD7jQ9ZzIIkAQrcBEg095kMXKvcFkUnHTSwgrEtnwzkd6+T/sA4yFfW5l 13wDSByxVIGGBoxLkSNJkB1/H33wLsQeF95DOQmwzT3BwWgpFpFyDwjRLXxOYcpDlBOO nDsMFh6+qbyMEb5vl+D9NiWKrGeOs5wenDVmbTi7yKQEu9uaN3FLNMs4KYzglz5MtQjZ MUuw== 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=Nohae2QCh2D9tQSVKjptF3/0ytxhMckTSKiucSlecsRx8NgWLLOLsR8uYy4vsfj1FM GdkMG6ONDJdjlsHUwNVt7JS8KBPayv0lbS5JEl2d1fcK2404uadUwkcK7/TYSxP1Gl6G 8H3jxHiWLRdp4Tne0j6L5+Ii/IKMF8sqsKQV2+dx8NBKIk+IwfiBeyYQARu4fyJhWqdM yAqrTp+quLb64rjMZqU4faZK9nH33cRSpuj8KEzRhm6wbsqYLJC4j4O67+P/+jaEO+hq hkz4dwSDNroCEDLQWHK8yL/4jci4v4LnfIT70qD/37Xm2nEuM41OwcUl9kkejiPcjqi9 hJpg== X-Gm-Message-State: AFqh2kpGc0lx7ha8bO4br2OFNzI09CDSCBYiSVhB/3BNnwWx2IarliYh aUM5CcP5vK4n5yYEwjCgcxztzENIrSXucKkP X-Received: by 2002:a05:6a20:158b:b0:af:6cc0:5b3d with SMTP id h11-20020a056a20158b00b000af6cc05b3dmr85463709pzj.7.1673077898475; Fri, 06 Jan 2023 23:51:38 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 23:51:38 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PULL 20/27] tcg/s390x: Create tgen_cmp2 to simplify movcond Date: Fri, 6 Jan 2023 23:51:11 -0800 Message-Id: <20230107075118.1814503-21-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::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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 {