From patchwork Tue Mar 9 16:20:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 396065 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp2815054jai; Tue, 9 Mar 2021 10:22:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWfD1epZvl57fqS/pihx6p9IkJh5ClgQSSLZG6S37KknRvGcW7bnk0q0/GbAweTvMaEU+U X-Received: by 2002:a05:6e02:1c0b:: with SMTP id l11mr24194587ilh.187.1615314133148; Tue, 09 Mar 2021 10:22:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615314133; cv=none; d=google.com; s=arc-20160816; b=hd63hWiRbbNpDh297YOcE7UZmVReP4SFwLUqvgmoB3eRMlt8TyCxCAoGeatHwS4tBZ OOqb3Cel/nGTv79wM0zdLh0pi/3fVy2P3cmHATY9pRovYZyHxAUdbHPwgGId2YIrbTOJ H7iJfgId3b1Ei4ju65JeynFkukZkgf1pb5XM+3oGfi0nKFNPRtyuaioUv3vM5c4W/Usw eWR42dGOn3P1xPfNrDaYlXdWzPcd2kfWpJ7ZiNLJlh8+bgi0AD9xNoF13JOttC/Q/mn9 T/DZTILmivk1ZwMsFMxu/vDF//8MHWapfO4CZ7UX8Fn4Ry30rEhOlE0G3vMlWSs1lO11 KsYw== 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=IBLMO5eVc4EnK/tNZqjKH+YJHmSPUKVvxUQrcUP5MI8=; b=QVxWfry1mRMM165ul4wqgZ9eEoaJRvKeEfsVEWG6jFGzjGYkqRpbUmk3cVYGj/9ajW BKwbl3DF/ezaDxj5gjhCEfwdD8EQDQ8zi9zdql+oiPbwhHdgiWCqU7unrgUbmTKu3Buh R+CaPLf2JXaC3WMZTtnBWDehWpkWrK+a0Mtjb3J0dkcu117OMZQe6ttsLoqHvCOsvhE6 EsTGaaGVlCwsQN8rAp+Sr66o8AXf3ezsiNA9BcKkmoEvba8HZ0ZwS3u1AtTCxpQ01wDN RkApg05UuWHyLcD0DapczcURJQ7XYchZEln66Rq6QRnK8wclfy0OwYJ9Z1/lfHJnDPtj 04Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RXSIVygG; 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 v7si13403143ilu.80.2021.03.09.10.22.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Mar 2021 10:22:13 -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=RXSIVygG; 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]:44174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJgzk-0000lk-Er for patch@linaro.org; Tue, 09 Mar 2021 13:22:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46316) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJf7H-0007ux-6v for qemu-devel@nongnu.org; Tue, 09 Mar 2021 11:21:51 -0500 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:41542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lJf6w-0002Yn-VY for qemu-devel@nongnu.org; Tue, 09 Mar 2021 11:21:50 -0500 Received: by mail-ot1-x331.google.com with SMTP id f8so8308635otp.8 for ; Tue, 09 Mar 2021 08:21:27 -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=IBLMO5eVc4EnK/tNZqjKH+YJHmSPUKVvxUQrcUP5MI8=; b=RXSIVygGg4iGOzB5iKHMhMSKEdQFqKnl996mj4LBAbmVqdy+WIh1V3fCPmX62H/6mF zvrfDdp/kjKDII5hy5sZz5MizJKWkxW/2reGoCOqrdzh/+uaOVHDdmYHWO4NYy/xiLjz cdMR/q8KuSBNSdPr7a48l7BAn9MZvilFxgyyIqEsRHaLmuX06jggOo6g18nsvDpAO7av SW0QEYKKxWLXQ8h58OutEYSFTC8dRN4AyH9k5g6bCAjLdck8k5ssCQFS6qxL7oRMgCc0 epdeQPigV2WKgItf221UyhDL4/a40AbpLMPECG3BrT/u3GrA6SD0PunAuhacfAU6N065 TF4A== 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=IBLMO5eVc4EnK/tNZqjKH+YJHmSPUKVvxUQrcUP5MI8=; b=mB1G2DB4pIdiGQaOm77cqvjg9KeQ8lIjEEauEsdTbim+Nmbypw8KdmC1gmOP2Htn/e rKo5Rq8oXzAnimnGdeaO7BO0NIKq9F3GU+sKAbFpfIA5y6QW8njH26VUtNqJ6jyEqYdQ H6z0xeXsbNez4jOiWexWyMuMphJ1K9A0EdFkMEH3tkVHvspP1GEXg9+uoGaJZnuMKGn2 W+yX1aYCyAXvb1Uj4HAruwtLj2vEoV2tpWg7k3uxSPA8jpAaiwTcwCXjA2Am/ErjZm53 cfUdrVLxljwpzxd/YCkQgH8tKibatuyWnLx7MlVTXz7YUN5WfGVFLnWDWQDWpdPqQk/e pgyQ== X-Gm-Message-State: AOAM532UBSwDFlTMJjSYAG+JsSm5p4xMLUI6wsc7N/o2pb0YOi5ttIfQ iEU6HDVGR/QgJbh79WRHWYl/IHf3lw2e09LS X-Received: by 2002:a9d:4e14:: with SMTP id p20mr16852972otf.94.1615306886661; Tue, 09 Mar 2021 08:21:26 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id v23sm2516474ots.63.2021.03.09.08.21.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 08:21:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 38/78] target/arm: Implement SVE2 ADDHNB, ADDHNT Date: Tue, 9 Mar 2021 08:20:01 -0800 Message-Id: <20210309162041.23124-39-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::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.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=unavailable 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: <20200417162231.10374-2-steplong@quicinc.com> Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 8 ++++++++ target/arm/sve.decode | 5 +++++ target/arm/sve_helper.c | 36 ++++++++++++++++++++++++++++++++++++ target/arm/translate-sve.c | 13 +++++++++++++ 4 files changed, 62 insertions(+) -- 2.25.1 diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index d154218452..a369fd2391 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -2509,6 +2509,14 @@ DEF_HELPER_FLAGS_3(sve2_uqrshrnt_h, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(sve2_uqrshrnt_s, TCG_CALL_NO_RWG, void, ptr, ptr, i32) DEF_HELPER_FLAGS_3(sve2_uqrshrnt_d, TCG_CALL_NO_RWG, void, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve2_addhnb_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve2_addhnb_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve2_addhnb_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_4(sve2_addhnt_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve2_addhnt_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sve2_addhnt_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_5(sve2_match_ppzz_b, TCG_CALL_NO_RWG, i32, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve2_match_ppzz_h, TCG_CALL_NO_RWG, diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 936977eacb..72dd36a5c8 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1320,6 +1320,11 @@ UQSHRNT 01000101 .. 1 ..... 00 1101 ..... ..... @rd_rn_tszimm_shr UQRSHRNB 01000101 .. 1 ..... 00 1110 ..... ..... @rd_rn_tszimm_shr UQRSHRNT 01000101 .. 1 ..... 00 1111 ..... ..... @rd_rn_tszimm_shr +## SVE2 integer add/subtract narrow high part + +ADDHNB 01000101 .. 1 ..... 011 000 ..... ..... @rd_rn_rm +ADDHNT 01000101 .. 1 ..... 011 001 ..... ..... @rd_rn_rm + ### SVE2 Character Match MATCH 01000101 .. 1 ..... 100 ... ..... 0 .... @pd_pg_rn_rm diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 3bf81d96ae..2e2ad8fb09 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -2112,6 +2112,42 @@ DO_SHRNT(sve2_uqrshrnt_d, uint64_t, uint32_t, , H1_4, DO_UQRSHRN_D) #undef DO_SHRNB #undef DO_SHRNT +#define DO_BINOPNB(NAME, TYPEW, TYPEN, SHIFT, OP) \ +void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ +{ \ + intptr_t i, opr_sz = simd_oprsz(desc); \ + for (i = 0; i < opr_sz; i += sizeof(TYPEW)) { \ + TYPEW nn = *(TYPEW *)(vn + i); \ + TYPEW mm = *(TYPEW *)(vm + i); \ + *(TYPEW *)(vd + i) = (TYPEN)OP(nn, mm, SHIFT); \ + } \ +} + +#define DO_BINOPNT(NAME, TYPEW, TYPEN, SHIFT, HW, HN, OP) \ +void HELPER(NAME)(void *vd, void *vn, void *vm, uint32_t desc) \ +{ \ + intptr_t i, opr_sz = simd_oprsz(desc); \ + for (i = 0; i < opr_sz; i += sizeof(TYPEW)) { \ + TYPEW nn = *(TYPEW *)(vn + HW(i)); \ + TYPEW mm = *(TYPEW *)(vm + HW(i)); \ + *(TYPEN *)(vd + HN(i + sizeof(TYPEN))) = OP(nn, mm, SHIFT); \ + } \ +} + +#define DO_ADDHN(N, M, SH) ((N + M) >> SH) + +DO_BINOPNB(sve2_addhnb_h, uint16_t, uint8_t, 8, DO_ADDHN) +DO_BINOPNB(sve2_addhnb_s, uint32_t, uint16_t, 16, DO_ADDHN) +DO_BINOPNB(sve2_addhnb_d, uint64_t, uint32_t, 32, DO_ADDHN) + +DO_BINOPNT(sve2_addhnt_h, uint16_t, uint8_t, 8, H1_2, H1, DO_ADDHN) +DO_BINOPNT(sve2_addhnt_s, uint32_t, uint16_t, 16, H1_4, H1_2, DO_ADDHN) +DO_BINOPNT(sve2_addhnt_d, uint64_t, uint32_t, 32, , H1_4, DO_ADDHN) + +#undef DO_ADDHN + +#undef DO_BINOPNB + /* Fully general four-operand expander, controlled by a predicate. */ #define DO_ZPZZZ(NAME, TYPE, H, OP) \ diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 29d33389c2..931f1177a5 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -7463,6 +7463,19 @@ static bool trans_UQRSHRNT(DisasContext *s, arg_rri_esz *a) return do_sve2_shr_narrow(s, a, ops); } +#define DO_SVE2_ZZZ_NARROW(NAME, name) \ +static bool trans_##NAME(DisasContext *s, arg_rrr_esz *a) \ +{ \ + static gen_helper_gvec_3 * const fns[4] = { \ + NULL, gen_helper_sve2_##name##_h, \ + gen_helper_sve2_##name##_s, gen_helper_sve2_##name##_d, \ + }; \ + return do_sve2_zzz_ool(s, a, fns[a->esz]); \ +} + +DO_SVE2_ZZZ_NARROW(ADDHNB, addhnb) +DO_SVE2_ZZZ_NARROW(ADDHNT, addhnt) + static bool do_sve2_ppzz_flags(DisasContext *s, arg_rprr_esz *a, gen_helper_gvec_flags_4 *fn) {