From patchwork Thu Jan 2 18:06:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 854746 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7909487wrq; Thu, 2 Jan 2025 10:28:38 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWlG8c7nVZWm3rygXj3+nxDcKVdIufMrDu+QGY9ACxtmjIYZXdemBj6NQ8VKl2BaOpe119lVg==@linaro.org X-Google-Smtp-Source: AGHT+IEyWfKMAGDT6Mg23/ceevspq+ZAQB9jE1MTp4jVbU+BwxLvgx+Dnr2Uk/1WYKpai1K1gfZg X-Received: by 2002:a05:6214:403:b0:6d8:8d87:e5b4 with SMTP id 6a1803df08f44-6dd23337818mr748544986d6.19.1735842518561; Thu, 02 Jan 2025 10:28:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1735842518; cv=none; d=google.com; s=arc-20240605; b=EC7ds7MDC6CQw+9mKM8vw2FYXT8xRbybIknmR9vE2Sp8pUxvvdE6y6G6vGXHJVTmpp twRt8KkgO5KffGAVeu9JibW0S09lJ3DwnrbnvF2y0GdymLB7pt9PuWm7m2X1AnvGKFU3 3Qf++fnh3TvqD4PdblfC2X1yUdIJreltg4RvdQ/4GLASkgHpGmdl3CLc3BexdckKRycc 2BqmiwLROqGbAkLQ0tmdEuwWC1AaIMUpfMtUK1msrIXANKIP0wfaEO9qBVGnpzsLwIbE IyRVpltq9RlyVzspA9Eb1+u6/VrGYyRZfQX800sXwbe9281Wvq9ie7L52cM2i+m6Os09 OKUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=sJBllHRTariSKVJFq4nQzWD9/YyYxC7DfXmWwXeSyE8=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=iqbnqpsH9ZhsyAJCH2Fehv6EPmC1ul0OgUStoAaWLWMGqZp2JNUm0ld2IecH+9c63f exre6qFBOSCy4nkiIHo6RaFweqOQnJQSB8VsEIdOVWJH5Bf5+jlD2IIrg8LVITZfFt+/ /TDOof6N8bW9b5VJwFUi5utc4n/PAdBrVR9XUMCt9Au9KF1Ku2RlOxzv1sHAtBql+X0p /LM7Zs6IzoMtEMgT/8spNpehko8KKosRGGmo43FHNBift6JC8ncIkpXIHmpR9VfockBe obxVfrNtJYTcDMzwOR2CwHiNRFBM+wsfb+XXUUAQzOPEbgEpddBa/giubEFGPS22qr3W CkEw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="ptArcnv/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6dd1835d1c1si365219336d6.475.2025.01.02.10.28.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jan 2025 10:28:38 -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=fail header.i=@linaro.org header.s=google header.b="ptArcnv/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTPen-0007Vs-Q6; Thu, 02 Jan 2025 13:10:54 -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 1tTPeP-0007Cy-Lc for qemu-devel@nongnu.org; Thu, 02 Jan 2025 13:10:32 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTPeO-0006CG-0a for qemu-devel@nongnu.org; Thu, 02 Jan 2025 13:10:29 -0500 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-216426b0865so154999845ad.0 for ; Thu, 02 Jan 2025 10:10:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735841427; x=1736446227; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sJBllHRTariSKVJFq4nQzWD9/YyYxC7DfXmWwXeSyE8=; b=ptArcnv/EzTjQPWciyasHGuguqg3CTeVfN+T9sqTItTJEfQajX3ugz1SbAzhz8dbUp 17LvBIHBOCL8Y16J12vPgpyj8Qp5O+MWfawKFaaV0GmmtfMbjN3OlCztwcd1t30X4QBv e7KWd9AUgaXFzVZ7npuMSX6w4TQOHeFyTNvbW4K8zlqyE1DOtOElEuzWVt4bXK8c05I3 Vb+OCRD1gWIjiu13DaE401Xc+r/hllCLCJShgqUdRXmysfCJqGXxMQz3VIMNiMlZ99BB S5hjps2e3pOz2V3aNcUbfwFNiWqTivz/OIhE11ODgV3HgrETbZZRVYxqREAUSENATQMz WqYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735841427; x=1736446227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sJBllHRTariSKVJFq4nQzWD9/YyYxC7DfXmWwXeSyE8=; b=Pftl7X3AEwdM2Jf4DUyhVEZSTQxmmH2fm1+ZGOfkx3iaRYEpy6CKGSM5BIbMDEC1vQ SPesYn0gyudWuETo52QAlBvYbg4Bpcs2TKbvUvt+rPEnB/JgWYeGiEKrzriT/LeXGhr5 lZ6bhofGycIuiMWo0xK/OOTR8D4m3rKyhS0bBbdBnJH0eKW6XQGOgWLJR7N9bsnom8Z0 FFjlGZUq+gwtzkSRCBJWrfd+uyksouUj4/sNo80pXLID1rI9gbLhGt9RNqztntbBXULL 5R/SHkoOJmHg9kaWtM5x5+cCaxF1ZIKWE0XgUaN5o29VX8NeGEFE6Eo4AUfjQ5O28drk iNBw== X-Gm-Message-State: AOJu0YwNQgS5bcSND4x2R+c19+1s1AhGvGrWva7nifh7JGoxCAgrB2B7 80DHIWDmFiiNPhIJnSUB6j/1PtG8z3Hjz8yu6dIeQd9m1F7vXGUxCyU/M2vONSo0BESEUxaEzQx 9 X-Gm-Gg: ASbGnctohGgiI3l4URAjAe4Mr0TrEMJF1yXRImr1Q785GI2zwEvPBPsBgXhR8s4/T4c ShQn8fIUp3uEPyk+AP0vbuXAvhNsn+8j3HGm97eI+Giv8QXKLGGmAZm/lAQEzHRHxu0YLlEdls1 +bk70Bdc1hnEjLSsaw/NBdw1uVa0uTEsqnVJzmE3kkeN4hngA3wYIxJVdNXEUs6bhOnO+SRYhNr B8lYZP5fkU9nBRzmyUnk/MLAMoPPWvNwaap+90wrJJ3mWfk1GUIcA2HVQMpRQ== X-Received: by 2002:a05:6a20:258c:b0:1e1:bdae:e058 with SMTP id adf61e73a8af0-1e5e0819174mr76976242637.37.1735841426718; Thu, 02 Jan 2025 10:10:26 -0800 (PST) Received: from stoup.. ([63.239.63.212]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbaf1sm24620827b3a.112.2025.01.02.10.10.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 10:10:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 40/73] tcg/s390x: Fold the ext{8, 16, 32}[us] cases into {s}extract Date: Thu, 2 Jan 2025 10:06:20 -0800 Message-ID: <20250102180654.1420056-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250102180654.1420056-1-richard.henderson@linaro.org> References: <20250102180654.1420056-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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 Accept byte and word extensions with the extract opcodes. This is preparatory to removing the specialized extracts. Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target-has.h | 22 ++++++++++++++++++++-- tcg/s390x/tcg-target.c.inc | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/tcg/s390x/tcg-target-has.h b/tcg/s390x/tcg-target-has.h index 93f1a67bd1..075ce5c15c 100644 --- a/tcg/s390x/tcg-target-has.h +++ b/tcg/s390x/tcg-target-has.h @@ -57,7 +57,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_ext16u_i32 1 #define TCG_TARGET_HAS_deposit_i32 1 #define TCG_TARGET_HAS_extract_i32 1 -#define TCG_TARGET_HAS_sextract_i32 0 +#define TCG_TARGET_HAS_sextract_i32 1 #define TCG_TARGET_HAS_extract2_i32 0 #define TCG_TARGET_HAS_extr_i64_i32 0 #define TCG_TARGET_HAS_qemu_st8_i32 0 @@ -70,7 +70,7 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_ext32u_i64 1 #define TCG_TARGET_HAS_deposit_i64 1 #define TCG_TARGET_HAS_extract_i64 1 -#define TCG_TARGET_HAS_sextract_i64 0 +#define TCG_TARGET_HAS_sextract_i64 1 #define TCG_TARGET_HAS_extract2_i64 0 #define TCG_TARGET_HAS_qemu_ldst_i128 1 @@ -96,4 +96,22 @@ extern uint64_t s390_facilities[3]; #define TCG_TARGET_HAS_cmpsel_vec 1 #define TCG_TARGET_HAS_tst_vec 0 +#define TCG_TARGET_extract_valid(type, ofs, len) 1 + +static inline bool +tcg_target_sextract_valid(TCGType type, unsigned ofs, unsigned len) +{ + if (ofs == 0) { + switch (len) { + case 8: + case 16: + return true; + case 32: + return type == TCG_TYPE_I64; + } + } + return false; +} +#define TCG_TARGET_sextract_valid tcg_target_sextract_valid + #endif diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index db8dec845b..633b4efb66 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -1572,9 +1572,41 @@ static void tgen_deposit(TCGContext *s, TCGReg dest, TCGReg src, static void tgen_extract(TCGContext *s, TCGReg dest, TCGReg src, int ofs, int len) { + if (ofs == 0) { + switch (len) { + case 8: + tcg_out_ext8u(s, dest, src); + return; + case 16: + tcg_out_ext16u(s, dest, src); + return; + case 32: + tcg_out_ext32u(s, dest, src); + return; + } + } tcg_out_risbg(s, dest, src, 64 - len, 63, 64 - ofs, 1); } +static void tgen_sextract(TCGContext *s, TCGReg dest, TCGReg src, + int ofs, int len) +{ + if (ofs == 0) { + switch (len) { + case 8: + tcg_out_ext8s(s, TCG_TYPE_REG, dest, src); + return; + case 16: + tcg_out_ext16s(s, TCG_TYPE_REG, dest, src); + return; + case 32: + tcg_out_ext32s(s, dest, src); + return; + } + } + g_assert_not_reached(); +} + static void tgen_gotoi(TCGContext *s, int cc, const tcg_insn_unit *dest) { ptrdiff_t off = tcg_pcrel_diff(s, dest) >> 1; @@ -2727,6 +2759,9 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, OP_32_64(extract): tgen_extract(s, args[0], args[1], args[2], args[3]); break; + OP_32_64(sextract): + tgen_sextract(s, args[0], args[1], args[2], args[3]); + break; case INDEX_op_clz_i64: tgen_clz(s, args[0], args[1], args[2], const_args[2]); @@ -3325,6 +3360,8 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) case INDEX_op_extu_i32_i64: case INDEX_op_extract_i32: case INDEX_op_extract_i64: + case INDEX_op_sextract_i32: + case INDEX_op_sextract_i64: case INDEX_op_ctpop_i32: case INDEX_op_ctpop_i64: return C_O1_I1(r, r);