From patchwork Fri Dec 9 02:05:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 632211 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp589182pvb; Thu, 8 Dec 2022 18:08:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf7dlfahdgomz5vxEZ+r9u9wgMMflhthw8fk7QDhYdr7qu88NZ78gNLNvIIf+NZainR4Uhp2 X-Received: by 2002:ac8:5756:0:b0:3a6:8700:b471 with SMTP id 22-20020ac85756000000b003a68700b471mr8188771qtx.38.1670551690984; Thu, 08 Dec 2022 18:08:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670551690; cv=none; d=google.com; s=arc-20160816; b=qXc6iooK/AwOD9igrrnRuZNN304801wBGBHu6JwU7YG3I9h/SU2UQgzSjoPb0KRHm1 FvYjVCXbLQfrhbhiy2dTZ68pCbTsNWrps7cwfT+dLYF9x4T2sgu+bozk5ht943YXt8sP LtyIKH2Id9qsOe/k9Awev4Lzks71tYqScZwZ2oE98OhDj6BehL3f8xywuslkwEN/fvTT zy8ZD2S6ZQd4Ekv7hQzBEtjMRFuqhHKpd7z+2HeoB9WwIjEoUvWNDNal9pabc+bGutsL bkBqPlHsnTLUPnWPPgnASVz5b+oZiiWRpLeZRyFqnJhccX4UAzuNzDYAB5GTz3N57LVu LIQQ== 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=PkPgZIG6hTGADlV8624tJVDsas/W4HyH9r53h6RELE4=; b=TDsJ9+UAbgpG8/LyqAX1OORX/v41ShSbSLYIm/Hj8nKRuBfqZ1TV+z48jrvyg8gc3g b4u4j5083M+ZY6wD8MrYimdzTV0BZXS95V9swWaGoO0G/+8anOy00Bdd/JJ+JxnX3Zi3 gQindmCqZpBm2aCdu5FIokjlu68o+Xs3LCINpWj9p9o2/0UwS0Wjk8lqIc+mNjQugaeZ JhNp9b1X81FoDTbfdSkPX0qh7RTi6n4Gtla5yOX1K6amtS8Xg2g6v+Ke3mJaafDP32He hf2pelMnjAcPIslp+IUdZsDGEEnkis9mJxebfJMV+FEw/9QkB6ksqfAodcemlEC4OHH5 Cosw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FZf4cd5A; 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 h10-20020ac8714a000000b003a689460852si18052qtp.449.2022.12.08.18.08.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Dec 2022 18:08:10 -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=FZf4cd5A; 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 1p3Smf-0006RR-Rv; Thu, 08 Dec 2022 21:06:44 -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 1p3SmA-00065E-94 for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:10 -0500 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Sm7-0001zY-6M for qemu-devel@nongnu.org; Thu, 08 Dec 2022 21:06:09 -0500 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-144bd860fdbso4108835fac.0 for ; Thu, 08 Dec 2022 18:06:02 -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=PkPgZIG6hTGADlV8624tJVDsas/W4HyH9r53h6RELE4=; b=FZf4cd5A7Ju3h1L1d5KZ+Mial6RHkWgdF/7ffcRASU5oWvRGYRLgRkX22v9uXSJj3u ujIb0pCbFrIi3WOpeQXAmJvdUmlzG3CVHljVR5RUvyZZYZslmxFPJ9hxQQU+MAIR8Wi4 JJPPk+Pr2+JjQGVaI7R+wQx9dV0e7z06+ThDN4k/pooyLX+bOCSyjJGm1s8ipHy4UMdU CsrvItBnxWK/AYSaPIEjhMtZ0EZ4qA4pCfO5ZoENi3rSeSkl9DI4dv12nL3PxEHR5MjN pFNmOVL8Qkdzp6bbLOgUOe/6/d/kMgPHGffuFYUDo/Tya/iDlWrUKcb4CZPTG4uxxnMr gY/Q== 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=PkPgZIG6hTGADlV8624tJVDsas/W4HyH9r53h6RELE4=; b=ttnw+T/XryvJWIp+lSmeTl2ihb3jO4X6vizQSenXdX70CNft9IeBKnAlwFMJ92vUef XzL/Ov0oy4Y53IrlvVlxRdeLAJfLfOr0xa29+0qSBItLCwuEKBYEXgcY3qqH8+NMdOwQ EH617u8BEFnTXQODvT0AL/J5AhOqO4hiy0BWYMBgZB2XVf8TrE2KMsN8Y57uXpYjBehS yXmCXDQin4qxZdLFcdo0FzJ65WleGFqKV5KqVdyFe+iKwYlG5pNYR8HIPtpCUKHWi/xt jqLqGqy+L1eOopRfCyEH1ZhekpGVadb03s+QhJQAgSsjgj9037E7Kjkeh1winzhp6Uw9 Ui+w== X-Gm-Message-State: ANoB5pmXOSDnwlSLBCu9+U1rLc+BW2y9oJhtbVfsW/f0j847dll6+E+E J5Jqok6p2brFWmbtDg0cW8m6riKGGx6Oggb8M4g= X-Received: by 2002:a05:6870:3c13:b0:144:ebb9:9ea with SMTP id gk19-20020a0568703c1300b00144ebb909eamr1811846oab.48.1670551561868; Thu, 08 Dec 2022 18:06:01 -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.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 18:06:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: thuth@redhat.com, iii@linux.ibm.com Subject: [PATCH v4 25/27] tcg/s390x: Tighten constraints for 64-bit compare Date: Thu, 8 Dec 2022 20:05:28 -0600 Message-Id: <20221209020530.396391-26-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=2001:4860:4864:20::2f; envelope-from=richard.henderson@linaro.org; helo=mail-oa1-x2f.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 Give 64-bit comparison second operand a signed 33-bit immediate. This is the smallest superset of uint32_t and int32_t, as used by CLGFI and CGFI respectively. The rest of the 33-bit space can be loaded into TCG_TMP0. Drop use of the constant pool. Signed-off-by: Richard Henderson Reviewed-by: Ilya Leoshkevich --- tcg/s390x/tcg-target-con-set.h | 3 +++ tcg/s390x/tcg-target.c.inc | 27 ++++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tcg/s390x/tcg-target-con-set.h b/tcg/s390x/tcg-target-con-set.h index baf3bc9037..15f1c55103 100644 --- a/tcg/s390x/tcg-target-con-set.h +++ b/tcg/s390x/tcg-target-con-set.h @@ -13,6 +13,7 @@ C_O0_I1(r) C_O0_I2(L, L) C_O0_I2(r, r) C_O0_I2(r, ri) +C_O0_I2(r, rA) C_O0_I2(v, r) C_O1_I1(r, L) C_O1_I1(r, r) @@ -24,6 +25,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, rA) C_O1_I2(r, r, rI) C_O1_I2(r, r, rJ) C_O1_I2(r, r, rK) @@ -35,6 +37,7 @@ C_O1_I2(v, v, r) C_O1_I2(v, v, v) C_O1_I3(v, v, v, v) C_O1_I4(r, r, ri, rI, r) +C_O1_I4(r, r, rA, rI, r) C_O2_I2(o, m, 0, r) C_O2_I2(o, m, r, r) C_O2_I3(o, m, 0, 1, r) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index c0434fa2f8..4d113139e5 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1249,22 +1249,20 @@ static int tgen_cmp2(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, tcg_out_insn_RIL(s, op, r1, c2); goto exit; } + + /* + * Constraints are for a signed 33-bit operand, which is a + * convenient superset of this signed/unsigned test. + */ if (c2 == (is_unsigned ? (TCGArg)(uint32_t)c2 : (TCGArg)(int32_t)c2)) { op = (is_unsigned ? RIL_CLGFI : RIL_CGFI); tcg_out_insn_RIL(s, op, r1, c2); goto exit; } - /* Use the constant pool, but not for small constants. */ - if (maybe_out_small_movi(s, type, TCG_TMP0, c2)) { - c2 = TCG_TMP0; - /* fall through to reg-reg */ - } else { - op = (is_unsigned ? RIL_CLGRL : RIL_CGRL); - tcg_out_insn_RIL(s, op, r1, 0); - new_pool_label(s, c2, R_390_PC32DBL, s->code_ptr - 2, 2); - goto exit; - } + /* Load everything else into a register. */ + tcg_out_movi(s, TCG_TYPE_I64, TCG_TMP0, c2); + c2 = TCG_TMP0; } if (type == TCG_TYPE_I32) { @@ -3105,8 +3103,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_rotr_i32: case INDEX_op_rotr_i64: case INDEX_op_setcond_i32: - case INDEX_op_setcond_i64: return C_O1_I2(r, r, ri); + case INDEX_op_setcond_i64: + return C_O1_I2(r, r, rA); case INDEX_op_clz_i64: return C_O1_I2(r, r, rI); @@ -3154,8 +3153,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I2(r, r, ri); case INDEX_op_brcond_i32: - case INDEX_op_brcond_i64: return C_O0_I2(r, ri); + case INDEX_op_brcond_i64: + return C_O0_I2(r, rA); case INDEX_op_bswap16_i32: case INDEX_op_bswap16_i64: @@ -3196,8 +3196,9 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) return C_O1_I2(r, rZ, r); case INDEX_op_movcond_i32: - case INDEX_op_movcond_i64: return C_O1_I4(r, r, ri, rI, r); + case INDEX_op_movcond_i64: + return C_O1_I4(r, r, rA, rI, r); case INDEX_op_div2_i32: case INDEX_op_div2_i64: