From patchwork Tue May 25 01:03:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 447154 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp3850472jac; Mon, 24 May 2021 19:18:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCvMJ1j9VWpyQak+kTxUjU2ljARSh3IgIiYtunl3jymk/N8ZFT6mcIJZ4QxZs5LdRVGOIz X-Received: by 2002:a25:3a41:: with SMTP id h62mr37315834yba.500.1621909083914; Mon, 24 May 2021 19:18:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621909083; cv=none; d=google.com; s=arc-20160816; b=dz3joPQLyz26VSmjHcav4hCufkGx/YsRi2lY9E5ruAo18w20+nRZnjT/Cd77CTNZr7 NHB7vCT5MAR7NHd57K2RUmk4zWOMsXCKx84q7jJMglymdCBlqFBGQCUHZ/eIidU07yyZ RF8O5+HPRWNylCryoKyhyw3alJAT2Tbl+vjReXj2HKPxx6Y8TjQfCyfQmlk7Nj9tUGmb SQUH6k11WaB6A8tct0w7uIX1U/RxobKUDgPcDN4WEB5UxchzW5w1FFGPgPfzelrxRuG+ HJLBTmhdrc3jGfI7TrR85wSW4pLxCkcRAgTnJGerbSsys7SU7GiB0607nnBgHRXjl6LS PE2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=lgZhxU07vdbFbL3Rra8/VVNowuJ8Xs/CdPm7YJWJNXI=; b=JaA2SsZMcvdrHNTgRh454dGHMkWeJeENd0MxGz8db8r07WsXiJlQ+RzHyV+i2+7rcM J5+jd6MAAc5wIsNPpq3Xi30ruxbILKz3SL0MfkjT95fR7wZFoE8oPe+G44mi47cfE/KJ kbJPNKT4KLXRwNjJJ6PbKK+ri+rRYXeaSRRdnTrMk6kYeC0+bHqoRMWVY3xj9UD1QFwz /xC45xpax+5FbaC3CwMTi4DS/yH8JmN7y3kH1NpcnmHiCotgKxZl6GzAcuJR+JrT8OPH Pn5vqcd7pJapZJr1Y0XHjfYmxlA0IdP9kkLyfC+Wy1o+OWFtiedRHUo9R4Ec41LASKw7 8ESA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=M8kpUrSj; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a8si16677023ybk.354.2021.05.24.19.18.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 May 2021 19:18:03 -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=fail header.i=@linaro.org header.s=google header.b=M8kpUrSj; 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 Received: from localhost ([::1]:35786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1llMdv-00022J-7x for patch@linaro.org; Mon, 24 May 2021 22:18:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llLYV-0000yx-JL for qemu-devel@nongnu.org; Mon, 24 May 2021 21:08:23 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:39918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1llLXt-00047w-Dg for qemu-devel@nongnu.org; Mon, 24 May 2021 21:08:23 -0400 Received: by mail-pl1-x62a.google.com with SMTP id t9so7067022ply.6 for ; Mon, 24 May 2021 18:07:44 -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=lgZhxU07vdbFbL3Rra8/VVNowuJ8Xs/CdPm7YJWJNXI=; b=M8kpUrSjJ5a0hwd/HrgMt2/H2Nz8ZqvBEadKqHxhvqXxdvvCoxgQGEEMUBPX26Ej/8 EyjW8JoYob5en2CYK5NxHrcq8R00QsfRnua5EE0NuFuI3oZ3TjwFHY05ueHsNJgbURld oiTLnNc41kaOXnsiFebR/mOB+pAiJMOzsvu1RtL6z5PBcY7ZAYnLe56m4WI6F/AhmtMM xQSK6UXOyoddW4XjuRvpyYrKiaxgdogO3HpenGh4/7xEFZbuZuOYGS7H9/3EENVRAFoD mvuYksnJwf6TELtDXxWITBeZYNjrHUrYHga9fVhcwdVJrKJ6Cqb/V5tLAHDP//Ft+xTz NtQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lgZhxU07vdbFbL3Rra8/VVNowuJ8Xs/CdPm7YJWJNXI=; b=Qjt8Rt1SoDeeu83Dz5Mrp41r3vgYH7jrCEKEpodUICQvy7n8uOjKNUAROT8sXqc45U dj3OiRVpQHATs20LoUC0LRUgwqw31v+zjJDbOA/haeR10oD6HKlIcA0VEPUxq5VfMvhy e7bVG3IBYqcuKAyZNIUqWV6Tgej9Rb6v1KtObLf0blG8Xb645kPDzECzv+1USkf9u8mk wcSuq+XKSnJjwkeZl/jQv76aWU2DkPXsZJ9yzmY0XeTXcq+4JY2dLI+8QB58YE4JUyv+ JE7UF0Eb/JJSUdCLJb3RN3zP+MIvSOQjRSIPmgtY4i3Uz8ZQxMZAETsFcc9VfyJ7VcG8 LocA== X-Gm-Message-State: AOAM533Bkx4qlCxwMlPiqXlt7l/PODKuoNQZsuToUm2qqRF9GLCl2XUf PFOQkTrcC0mE5dzNU3OhtrbjL/gdzkaRyw== X-Received: by 2002:a17:90b:1c0b:: with SMTP id oc11mr27749617pjb.156.1621904863964; Mon, 24 May 2021 18:07:43 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id b16sm11748176pju.35.2021.05.24.18.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 18:07:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 72/92] target/arm: Implement SVE2 FCVTNT Date: Mon, 24 May 2021 18:03:38 -0700 Message-Id: <20210525010358.152808-73-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210525010358.152808-1-richard.henderson@linaro.org> References: <20210525010358.152808-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Stephen Long Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Stephen Long Message-Id: <20200428174332.17162-2-steplong@quicinc.com> Signed-off-by: Richard Henderson --- v7: Fix big-endian indexing. --- target/arm/helper-sve.h | 5 +++++ target/arm/sve.decode | 4 ++++ target/arm/sve_helper.c | 20 ++++++++++++++++++++ target/arm/translate-sve.c | 16 ++++++++++++++++ 4 files changed, 45 insertions(+) -- 2.25.1 diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index cdff155ead..7aa365d565 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -2744,3 +2744,8 @@ DEF_HELPER_FLAGS_5(sve2_cdot_idx_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve2_cdot_idx_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_5(sve2_fcvtnt_sh, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve2_fcvtnt_ds, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/sve.decode b/target/arm/sve.decode index fdeb7b106b..94cdc6ff15 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1580,3 +1580,7 @@ SM4E 01000101 00 10001 1 11100 0 ..... ..... @rdn_rm_e0 # SVE2 crypto constructive binary operations SM4EKEY 01000101 00 1 ..... 11110 0 ..... ..... @rd_rn_rm_e0 RAX1 01000101 00 1 ..... 11110 1 ..... ..... @rd_rn_rm_e0 + +### SVE2 floating-point convert precision odd elements +FCVTNT_sh 01100100 10 0010 00 101 ... ..... ..... @rd_pg_rn_e0 +FCVTNT_ds 01100100 11 0010 10 101 ... ..... ..... @rd_pg_rn_e0 diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 4b05e2e427..d44bcfa44a 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -7602,3 +7602,23 @@ void HELPER(fmmla_d)(void *vd, void *vn, void *vm, void *va, d[3] = float64_add(a[3], float64_add(p0, p1, status), status); } } + +#define DO_FCVTNT(NAME, TYPEW, TYPEN, HW, HN, OP) \ +void HELPER(NAME)(void *vd, void *vn, void *vg, void *status, uint32_t desc) \ +{ \ + intptr_t i = simd_oprsz(desc); \ + uint64_t *g = vg; \ + do { \ + uint64_t pg = g[(i - 1) >> 6]; \ + do { \ + i -= sizeof(TYPEW); \ + if (likely((pg >> (i & 63)) & 1)) { \ + TYPEW nn = *(TYPEW *)(vn + HW(i)); \ + *(TYPEN *)(vd + HN(i + sizeof(TYPEN))) = OP(nn, status); \ + } \ + } while (i & 63); \ + } while (i != 0); \ +} + +DO_FCVTNT(sve2_fcvtnt_sh, uint32_t, uint16_t, H1_4, H1_2, sve_f32_to_f16) +DO_FCVTNT(sve2_fcvtnt_ds, uint64_t, uint32_t, , H1_4, float64_to_float32) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 9a6f7c87c1..700b02814c 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -8246,3 +8246,19 @@ static bool trans_RAX1(DisasContext *s, arg_rrr_esz *a) } return true; } + +static bool trans_FCVTNT_sh(DisasContext *s, arg_rpr_esz *a) +{ + if (!dc_isar_feature(aa64_sve2, s)) { + return false; + } + return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtnt_sh); +} + +static bool trans_FCVTNT_ds(DisasContext *s, arg_rpr_esz *a) +{ + if (!dc_isar_feature(aa64_sve2, s)) { + return false; + } + return do_zpz_ptr(s, a->rd, a->rn, a->pg, false, gen_helper_sve2_fcvtnt_ds); +}