From patchwork Tue Jun 28 04:21:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 585477 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp416870mab; Mon, 27 Jun 2022 21:49:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uDhuJLFgRlOouLoBjk6KRU8fdPebCWdeFj1qweP4TCylBXz8OTZMc1dKWuG2Rc/Saygljn X-Received: by 2002:a05:620a:4387:b0:6af:20c2:6054 with SMTP id a7-20020a05620a438700b006af20c26054mr6544507qkp.349.1656391758185; Mon, 27 Jun 2022 21:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656391758; cv=none; d=google.com; s=arc-20160816; b=vImmhJJ1nc+GXO9ju30xryy6+zqT+7dbMtjGmXFy8g7+aJ9IqZFIZbOt5HDvrGD/W+ vee5MehKJ5lk5rY0oWtA2/1C2Jd8fh6zSX0Qzn5Ytl1cIe6yY9Tt+gE+bznCnkMMZEyz HBU47k7wfhB4TwW2KyOyX7K4zbkGuq8tzIELvRlf1xMJYXp5/pnfIcTPXxXlRBEHTjcS UOdroV808QLr//RJr2k/aIIOmQbMZQ3hp0UeSFCUJoZg25ChffYf5THvRo5FVQVVvYz7 AlVUDNcVB57XXnBXUrERhYHj5C17exJCr5/O5AE8G6jAgYha3al7zfbmYW8IZ2llcJ5i 8URQ== 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=28vgYGphhmuIGOQ3NR6EcTiIP3DBoLZHG9GLZrK4ZGk=; b=WJwx3rd0z5Wk36H4ihkL7XYtAPkKJP8bNium5lUes+CmdDwFIb/GmQ/SksOGWGM0UA qgfWrrBHB7d1Nxy4sU2Rtlal/bX2DjOB2Eswjocx2yZ2xh3KCVf8i+vf1oM07KeTGcLu Ijj3KxIPAA6iFEtdIXZB7BdjhR5gHAJFuPMUQEjBGIf/LKa81vrXEydRK0uLVLT/TA2H jkCKfOsvWtQaamFgxg2+wfzixuqr6PH3ufve1V5nCeadHfqa0PD5kVpJ3pgbAAos28VH QXh2O+RxN1UN26PxwuGHhTZPpc+Drmzc8+sk2s1c99Do7s0UK6I8cLuqWwJDTapHV6/w tUKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VnZAVHZ0; 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 s7-20020ac85cc7000000b00304fdc5381asi6787059qta.153.2022.06.27.21.49.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 21:49:18 -0700 (PDT) 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=VnZAVHZ0; 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]:48230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o63A5-0007SE-OX for patch@linaro.org; Tue, 28 Jun 2022 00:49:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o62kG-0002dH-56 for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:22:36 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:34579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o62kD-0003sK-0X for qemu-devel@nongnu.org; Tue, 28 Jun 2022 00:22:35 -0400 Received: by mail-pf1-x42d.google.com with SMTP id t21so10912724pfq.1 for ; Mon, 27 Jun 2022 21:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=28vgYGphhmuIGOQ3NR6EcTiIP3DBoLZHG9GLZrK4ZGk=; b=VnZAVHZ0nNzEow/Pq92Ft6c66/PHkHX6Yr59H/uaKZMxAYfn/xmCjPvq9MnLA48IK/ 2WTppk4Yet52+E3BI71b+aNSyPvSUC05yO8feWzvbX8MMPYIU/lwf/58X3Yn60fQfiyZ VsZEbp4iBjbm82oPf7mYplCaDZnh52iOgUTX9aetUlWiv3LaK05dz2KQMr3HFFz2Kzch sPA76ycy56+lB0ZL3nTBi7E/0w346FRm4yIAdFQ1ufDJjh6NxefDkzfny48brxtcgrgQ v0e5pynldBIlIVtRyCscEU+tqwoK5+WSvcuxzxwFj3JPSz1bDiTEAG6gtlmqp18o/676 p7Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=28vgYGphhmuIGOQ3NR6EcTiIP3DBoLZHG9GLZrK4ZGk=; b=Yszu2j7+IT1VDO/yHe7CVpvEtPHoVOAESau642NZnX7BFq0QqKkMSTtwNp2xYk/IHg sGR6uckyXd6RGT9oqDPSO9Xg5qohCau9+oGRxfqcV01FxPqznz16NNjMq/hh/jWw4hnn fS/peeYO6oV6aOWnefsMkx8n8dN4tvgSRYQfOrG3/jltxBdtf3T9bRHR/ARuxGHhBEz2 D1MNzU7Njk+PTZc+WtxOrXdOWD6gCIC2ARYfEQfRbcCcmCo4FC+dH8Qmv4CVff3q4pZX UEqzaaRxDErzLUyIBZVsYfCJLDKhrUs82+TSgTUrEHgnXLr73jeKAHtVXZqdn12OsbRJ ufxg== X-Gm-Message-State: AJIora9ZzdW7lGI2Guy073Kr0T2RIo/Ww+2K9rBV1oD5FtVfqbBIo5/2 X2jprt77xbVKaQ4WTu86wf4zc7NYs+462w== X-Received: by 2002:a05:6a00:8c5:b0:510:6eae:6fa1 with SMTP id s5-20020a056a0008c500b005106eae6fa1mr1639483pfu.12.1656390151606; Mon, 27 Jun 2022 21:22:31 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id jg6-20020a17090326c600b0016a087cfad8sm7994929plb.264.2022.06.27.21.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 21:22:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v4 29/45] target/arm: Implement REVD Date: Tue, 28 Jun 2022 09:51:01 +0530 Message-Id: <20220628042117.368549-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220628042117.368549-1-richard.henderson@linaro.org> References: <20220628042117.368549-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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" This is an SVE instruction that operates using the SVE vector length but that it is present only if SME is implemented. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 2 ++ target/arm/sve.decode | 1 + target/arm/sve_helper.c | 16 ++++++++++++++++ target/arm/translate-sve.c | 2 ++ 4 files changed, 21 insertions(+) diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index ab0333400f..cc4e1d8948 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -719,6 +719,8 @@ DEF_HELPER_FLAGS_4(sve_revh_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_revw_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_revd_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_4(sve_rbit_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_rbit_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_rbit_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 966803cbb7..a9e48f07b4 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -652,6 +652,7 @@ REVB 00000101 .. 1001 00 100 ... ..... ..... @rd_pg_rn REVH 00000101 .. 1001 01 100 ... ..... ..... @rd_pg_rn REVW 00000101 .. 1001 10 100 ... ..... ..... @rd_pg_rn RBIT 00000101 .. 1001 11 100 ... ..... ..... @rd_pg_rn +REVD 00000101 00 1011 10 100 ... ..... ..... @rd_pg_rn_e0 # SVE vector splice (predicated, destructive) SPLICE 00000101 .. 101 100 100 ... ..... ..... @rdn_pg_rm diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 9a26f253e0..5de82696b5 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -931,6 +931,22 @@ DO_ZPZ_D(sve_revh_d, uint64_t, hswap64) DO_ZPZ_D(sve_revw_d, uint64_t, wswap64) +void HELPER(sme_revd_q)(void *vd, void *vn, void *vg, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd, *n = vn; + uint8_t *pg = vg; + + for (i = 0; i < opr_sz; i += 2) { + if (pg[H1(i)] & 1) { + uint64_t n0 = n[i + 0]; + uint64_t n1 = n[i + 1]; + d[i + 0] = n1; + d[i + 1] = n0; + } + } +} + DO_ZPZ(sve_rbit_b, uint8_t, H1, revbit8) DO_ZPZ(sve_rbit_h, uint16_t, H1_2, revbit16) DO_ZPZ(sve_rbit_s, uint32_t, H1_4, revbit32) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 23b051746c..6019dfb53c 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -2901,6 +2901,8 @@ TRANS_FEAT(REVH, aa64_sve, gen_gvec_ool_arg_zpz, revh_fns[a->esz], a, 0) TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz, a->esz == 3 ? gen_helper_sve_revw_d : NULL, a, 0) +TRANS_FEAT(REVD, aa64_sme, gen_gvec_ool_arg_zpz, gen_helper_sme_revd_q, a, 0) + TRANS_FEAT(SPLICE, aa64_sve, gen_gvec_ool_arg_zpzz, gen_helper_sve_splice, a, a->esz)