From patchwork Sat Aug 15 01:31:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 247754 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp1241449ilo; Sat, 15 Aug 2020 08:30:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8BcngobzRvOSizaMboxZPL+MqgfJfXUHYKv92HU0dY1ImftiaK4jtjOka1ZibloZqLwfC X-Received: by 2002:a25:9b86:: with SMTP id v6mr10367746ybo.133.1597505436564; Sat, 15 Aug 2020 08:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597505436; cv=none; d=google.com; s=arc-20160816; b=pc+wx4Xso3U7l/sq38lXNd7r3VpZcJIXZ8czc35IIz7HIKzpuHUOPd+7QQZjdRp+h1 pNcd2oPRBK7PNi3gNNXwpYGBH7t7KaoQOmNjDxaQbq0/2hyz/ASeUfwb41eya7/I99xP /yl4U8XYAfe8lmt8MNo2cDLAnehpgDdTdbbm1e+qto4N2D9RcY1UvRYLbpOT/Mt+ZssR 5QVW/EnRH7PVd2hFK7RxEBoqn0Oqcv3VvkuluVXyH8cyWdY7tTUOfWyLTeNnqfG9Va0l fuovP+cuEtM3vdvFuZ9Y5iR9SKW3nCeqrHICmXWuynlarpQiEgg5rjOlOToJhojX/u3b xPfQ== 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=D1VJrUQknShqmnmzu8X8w1cJRuHx820LA67l/SpR/wI=; b=ZCyXQLLzNBcQYv+3WzBSKxZj1gVi2DDzNUwFm3Dbo0u8HLiwqAH2DZTOxMPsocYkd9 rSoaaaFEOTUBAeQO2U4a0MYtj7N6voZXQ7G8K8Cu1daD2+7oPMbpfPe1SxssFPWMJYFJ VyAGvZ/2KooxtFxuUbb21XX0GVKxruUu8kpb/aQCuSD3s7wrdhOkrK6J38vDEOfIKia2 3Ei7lvlawt5KXSYTjp3RLnUdJbpwi1KF8qZKA/H7SIlN56qZ88bwmdck59EVf3p5mCnA El+OH+IRghBFgRoOLt4O9vLSzH+Me3cioGXxgUMM05jq0H6hPib0Gt+6LffyDW4Q5CSq pP7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WmVif8Ar; 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 x4si11390328ybq.362.2020.08.15.08.30.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Aug 2020 08:30:36 -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=WmVif8Ar; 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]:46626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6y8h-0004fl-Vz for patch@linaro.org; Sat, 15 Aug 2020 11:30:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6y6U-0002oW-Ko for qemu-devel@nongnu.org; Sat, 15 Aug 2020 11:28:18 -0400 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:39770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k6y6S-00040C-Qi for qemu-devel@nongnu.org; Sat, 15 Aug 2020 11:28:18 -0400 Received: by mail-pj1-x1041.google.com with SMTP id f9so5653082pju.4 for ; Sat, 15 Aug 2020 08:28:15 -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=D1VJrUQknShqmnmzu8X8w1cJRuHx820LA67l/SpR/wI=; b=WmVif8ArPf0sdlGrhV/s/zKZGtvIaxy/aOyK09OYvPdy1oSxGR/pblFFX7sTBnZxVj rgYuuolNwN0G3RqTYUnL9AOR0TKKNCCov/uFEKu2KcE62MXZjMeJwFHqb13XcnQbP9NH F/MyD8YVDCB7K+frcYVEx4gl2O3q09F/b+ZPNFofurzUZS2iDQ88/1+K3dgf/VI/PLz7 iHzmUInH0x0GdkdHNm91F6rCqXtH7nVokTtTvekG8BmC6MzVNX1ui/Okle3vOYJnWrH+ /1RFKCugh3a3MQcsgPN+Q90nh1JWdS68qVQICNGq4jZ6iP/s/taoRX6D4uqvE3S+XFPv DWIQ== 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=D1VJrUQknShqmnmzu8X8w1cJRuHx820LA67l/SpR/wI=; b=ZUMp3PvBcy//An/314dcFzERoJbUGlEHAR384E2lfKjrt2QJ8M3BtAXroz4s/FWVb5 Du9xYPK7AzyP7Mmc0sDlOjmBCS4NB8HeTeUjNycwmHRaJ1W64DgZgAvDLh8e2WNRrkkT yStC+kmIlBfIbDyqjxBS3d7EqGkxWsv3q8eNd7/+h+j+AXZQNScO+kjGGJoJUuvKfIYs KqKDrO3x9eCEMryu5b2A630LZx/dg42G+BxvPWp8LFOH0fWOwCL7F8E0cezDsShBEnf5 KpSwjNf144YNt0xmqRmhLc+PeD0iqyFPSGCuGpvag15vp+aD4k2uZzMs/PyNKhn1DmI/ jaBA== X-Gm-Message-State: AOAM5321PLyC18018pF5UVvecltQaOAe0Iu2cTmpBnZVRY/eoucM9SGG movwJlseLoIuM7anxNHG3ll76+SRGpdpPg== X-Received: by 2002:aa7:9552:: with SMTP id w18mr695754pfq.150.1597455134318; Fri, 14 Aug 2020 18:32:14 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id y196sm10625528pfc.202.2020.08.14.18.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 18:32:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 20/20] target/arm: Convert sq{, r}dmulh to gvec for aa64 advsimd Date: Fri, 14 Aug 2020 18:31:45 -0700 Message-Id: <20200815013145.539409-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200815013145.539409-1-richard.henderson@linaro.org> References: <20200815013145.539409-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1041; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1041.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper.h | 10 ++++++++ target/arm/translate-a64.c | 33 ++++++++++++++++++-------- target/arm/vec_helper.c | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 10 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/target/arm/helper.h b/target/arm/helper.h index 378bb1898b..3ca73a1764 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -776,6 +776,16 @@ DEF_HELPER_FLAGS_5(gvec_mls_idx_s, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_5(gvec_mls_idx_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(neon_sqdmulh_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(neon_sqdmulh_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_5(neon_sqrdmulh_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(neon_sqrdmulh_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) + #ifdef TARGET_AARCH64 #include "helper-a64.h" #include "helper-sve.h" diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c74c6e854c..d4da12268c 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -697,6 +697,20 @@ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn, tcg_temp_free_ptr(fpst); } +/* Expand a 3-operand + qc + operation using an out-of-line helper. */ +static void gen_gvec_op3_qc(DisasContext *s, bool is_q, int rd, int rn, + int rm, gen_helper_gvec_3_ptr *fn) +{ + TCGv_ptr qc_ptr = tcg_temp_new_ptr(); + + tcg_gen_addi_ptr(qc_ptr, cpu_env, offsetof(CPUARMState, vfp.qc)); + tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), + vec_full_reg_offset(s, rn), + vec_full_reg_offset(s, rm), qc_ptr, + is_q ? 16 : 8, vec_full_reg_size(s), 0, fn); + tcg_temp_free_ptr(qc_ptr); +} + /* Set ZF and NF based on a 64 bit result. This is alas fiddlier * than the 32 bit equivalent. */ @@ -11753,6 +11767,15 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) gen_gvec_fn3(s, is_q, rd, rn, rm, gen_gvec_mla, size); } return; + case 0x16: /* SQDMULH, SQRDMULH */ + { + static gen_helper_gvec_3_ptr * const fns[2][2] = { + { gen_helper_neon_sqdmulh_h, gen_helper_neon_sqrdmulh_h }, + { gen_helper_neon_sqdmulh_s, gen_helper_neon_sqrdmulh_s }, + }; + gen_gvec_op3_qc(s, is_q, rd, rn, rm, fns[size - 1][u]); + } + return; case 0x11: if (!u) { /* CMTST */ gen_gvec_fn3(s, is_q, rd, rn, rm, gen_gvec_cmtst, size); @@ -11864,16 +11887,6 @@ static void disas_simd_3same_int(DisasContext *s, uint32_t insn) genenvfn = fns[size][u]; break; } - case 0x16: /* SQDMULH, SQRDMULH */ - { - static NeonGenTwoOpEnvFn * const fns[2][2] = { - { gen_helper_neon_qdmulh_s16, gen_helper_neon_qrdmulh_s16 }, - { gen_helper_neon_qdmulh_s32, gen_helper_neon_qrdmulh_s32 }, - }; - assert(size == 1 || size == 2); - genenvfn = fns[size - 1][u]; - break; - } default: g_assert_not_reached(); } diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c index fb53684ce3..73d62c4e4f 100644 --- a/target/arm/vec_helper.c +++ b/target/arm/vec_helper.c @@ -109,6 +109,30 @@ void HELPER(gvec_qrdmlsh_s16)(void *vd, void *vn, void *vm, clear_tail(d, opr_sz, simd_maxsz(desc)); } +void HELPER(neon_sqdmulh_h)(void *vd, void *vn, void *vm, + void *vq, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + int16_t *d = vd, *n = vn, *m = vm; + + for (i = 0; i < opr_sz / 2; ++i) { + d[i] = do_sqrdmlah_h(n[i], m[i], 0, false, false, vq); + } + clear_tail(d, opr_sz, simd_maxsz(desc)); +} + +void HELPER(neon_sqrdmulh_h)(void *vd, void *vn, void *vm, + void *vq, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + int16_t *d = vd, *n = vn, *m = vm; + + for (i = 0; i < opr_sz / 2; ++i) { + d[i] = do_sqrdmlah_h(n[i], m[i], 0, false, true, vq); + } + clear_tail(d, opr_sz, simd_maxsz(desc)); +} + /* Signed saturating rounding doubling multiply-accumulate high half, 32-bit */ static int32_t do_sqrdmlah_s(int32_t src1, int32_t src2, int32_t src3, bool neg, bool round, uint32_t *sat) @@ -172,6 +196,30 @@ void HELPER(gvec_qrdmlsh_s32)(void *vd, void *vn, void *vm, clear_tail(d, opr_sz, simd_maxsz(desc)); } +void HELPER(neon_sqdmulh_s)(void *vd, void *vn, void *vm, + void *vq, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + int32_t *d = vd, *n = vn, *m = vm; + + for (i = 0; i < opr_sz / 4; ++i) { + d[i] = do_sqrdmlah_s(n[i], m[i], 0, false, false, vq); + } + clear_tail(d, opr_sz, simd_maxsz(desc)); +} + +void HELPER(neon_sqrdmulh_s)(void *vd, void *vn, void *vm, + void *vq, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc); + int32_t *d = vd, *n = vn, *m = vm; + + for (i = 0; i < opr_sz / 4; ++i) { + d[i] = do_sqrdmlah_s(n[i], m[i], 0, false, true, vq); + } + clear_tail(d, opr_sz, simd_maxsz(desc)); +} + /* Integer 8 and 16-bit dot-product. * * Note that for the loops herein, host endianness does not matter