From patchwork Tue Mar 9 16:20:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 396073 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp2819592jai; Tue, 9 Mar 2021 10:28:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyynGn518/DaA70VIi9KL3RhOsudzt6YG3bhDQtmPoattS+arhiXNztElC0dc3UXwWwKNeP X-Received: by 2002:a05:6e02:138f:: with SMTP id d15mr25648942ilo.217.1615314523114; Tue, 09 Mar 2021 10:28:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615314523; cv=none; d=google.com; s=arc-20160816; b=sO/8cXM+YAC7iNJtjl7K0MlZQ1K0NhHTubalioL5+0JLcsV+MrNC3U6ZLumUID1MAP NPYxSwENqXLcY7zUv7scj6QovkRsO6eIjcF1F5OMOs1XpPuEsb1GXy27K9k6yHaC0u5G FgZ/ZFWxxMIH67jfhw7GHOGR68Cx2Vb1t/ecdwZcFxjIqA6SEYuxSWtgCV3G+9YH/lrT Vt7MijFe3/B4hLOpQv3FD1aQsiyyaV4PqiLB1SDK3T6HgnBMq4pdTCGCXvJHviJ2TMI1 F/EV19Tkg7QB4/9lFZOQqKAlWEcvm1Ime1s8YRDpMln0oD+vlzIzCpO2vXxXEbKwEYn3 CVhA== 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=2LRthBYH3plyRGRdELd90NdrMXuX6CtYeCD9OlWaRNY=; b=GajaLlpV/HU+yMUqU5p0DyfKKqQVGk/j1swK/92XUJXIhRq4Z3HFfpW1WWaIwXg8yu W91pHBbgCDQb9dl0jPv+CMJfReGoRtN/GhjzYw37HzSLTfiqvDMPL5UZIgIQjtdT94ez IDdKwnMLhYWh/5Lc0nJmeq/Pijrr7XZB+W2Nz66niTZAZhNCarEjlOTupEf1kxxM0LN/ AmiPFo01dvuKXidjKUeBx2ATLwQHlCZo0i0ogoGKcKPG1Ti/+TrghOmPOnxGRD8VP1d5 OkkM+doKuccSS0URWuYciQV2+Yq9xs3UDtxowwuskKXD2BYp7OZbBcGy5i/gYCIaGPaJ SWAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WhqUF+Ff; 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 i11si3223041ioh.75.2021.03.09.10.28.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Mar 2021 10:28:43 -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=WhqUF+Ff; 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]:36016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJh62-00013e-Fs for patch@linaro.org; Tue, 09 Mar 2021 13:28:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJf8C-0000eu-Ak for qemu-devel@nongnu.org; Tue, 09 Mar 2021 11:22:48 -0500 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]:40428) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJf7x-0002rO-LU for qemu-devel@nongnu.org; Tue, 09 Mar 2021 11:22:48 -0500 Received: by mail-ot1-x336.google.com with SMTP id b8so13349901oti.7 for ; Tue, 09 Mar 2021 08:22:31 -0800 (PST) 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=2LRthBYH3plyRGRdELd90NdrMXuX6CtYeCD9OlWaRNY=; b=WhqUF+FfAtW2uKJ3oe2r6CJaDgeRBKSjGdDyy1KNVwEV/SsogVVNxVWrfbIQJ3xlAQ O4UiNc23+s9x1F6aPVHzBhOY70eWlTWBRvp0GFtyCpLao+0fwgojFdrnanIlA1/i37qB m8f+IAvhWhBLu1eYD/BLf9DXtZ7opHPW/IeMDzpToLMoh3mLGlC7awb3qnpZDqIo+JoQ JkjKYFSJHndtS3eALo5Y71HoPlkhN3mnRchZH11daCsi1RRQrrJY+8nXKqMY5aMLHKhi y2N2/FZ/5hdjU2YIrFb1OGvx9BXJJSZwrns455Vdik0+DRd05VmKxdVjVilibGkZhZxW eL4w== 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=2LRthBYH3plyRGRdELd90NdrMXuX6CtYeCD9OlWaRNY=; b=p23IT+sRk7l5+cmMZJSAILuDtDaLpuYcfJ2Dpb3Ffa23D4iteMNmyqQShgpsCqz1Ne Z5Xobe+D8GbYqMDWD8GV3+0/z9kmvu3NamBHuBGTHPXgOnAkmfsNRvbDxcbx8NpAfjzx rIgsP4FtfmzI3pIQgAi4/cIGfglUvX1fz7VBVHFLeg42IQPpmW3QWbuLkF/pfXdOWbVf JXLDGlx86i0uNNfSmJCl7bh8tPLndvikRCcqTEQvQF3LJEYbbNatbE4IeyO8Os86mF7g N3sKvDW/hSu0dAff4PQeJxXZVhzqjbKWiZskmJ8PXepO3CyW7Ecw2aT4HWLbgG6mc01c JUQA== X-Gm-Message-State: AOAM532Wi2ZnnxKS+jPk5DlxYDFG3lUgL6XygYYooT0DQ7BFk81OVkRr 157oz49FFUOENJl9o0y5+kuioyZ+eGjdp3/g X-Received: by 2002:a9d:a0a:: with SMTP id 10mr25057090otg.181.1615306950877; Tue, 09 Mar 2021 08:22:30 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id u19sm3470898ote.15.2021.03.09.08.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 08:22:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 68/78] target/arm: Implement SVE2 FCVTNT Date: Tue, 9 Mar 2021 08:20:31 -0800 Message-Id: <20210309162041.23124-69-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210309162041.23124-1-richard.henderson@linaro.org> References: <20210309162041.23124-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x336.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@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org, Stephen Long Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Stephen Long Signed-off-by: Stephen Long Message-Id: <20200428174332.17162-2-steplong@quicinc.com> Signed-off-by: Richard Henderson --- 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 c85cd85a0b..eedb70eb50 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -2734,3 +2734,8 @@ DEF_HELPER_FLAGS_5(sve2_sqrdcmlah_idx_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve2_sqrdcmlah_idx_s, 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 9bf37e322f..2c38fe4691 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1573,3 +1573,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 c406ae289c..b719a3aacf 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -7600,3 +7600,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, H1_2, float64_to_float32) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 6959cc9d9c..83fab9a6fc 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -8221,3 +8221,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); +}