From patchwork Sat May 2 22:44:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186076 Delivered-To: patch@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp2289154ilf; Sat, 2 May 2020 15:54:11 -0700 (PDT) X-Google-Smtp-Source: APiQypKLgiGfUjvDMdhtpCxIX7H5swMzAR2aji/KTvCC52rhp8wiLlgj3SYaRPI5El4MNSxzc+SW X-Received: by 2002:a0c:b286:: with SMTP id r6mr10113634qve.244.1588460051729; Sat, 02 May 2020 15:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588460051; cv=none; d=google.com; s=arc-20160816; b=mb9dgXPzXztN6SvjWUn7s7iUMzmsIPYY29mMcq/fa343tCZqGV6QrUM773kq1brfFk xd1hdNizjyw/QSYb/Seg+tpd/oShEkmbbskR+W53cgas/uYIOuorphhILQL4z+lo2N+K JSqPAVIl9uicr+26tUJjFnurlsRiLhzch5/ByeCC7leZE/3XLgIE1j6YqR6IrWLBvKGm Zq0/n54Rk0l4VUmfRwC2O6ecs5jkqlNTlaROKWjoczd68zC0DRBWQjM/3ZNivN4cFr5A b2ExqHT88Y/v0EmhBuSRX9RfbLMRjGaGTuagxwBMBI6VnX/NlJKVbwUwGHK5c8cor2eX WAWA== 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=HkrQs5dpEFTRpOusdkDcmR/jxV9J9hkTnHpacMdwp8Y=; b=j4ACHaetd7OhCEKkgad+QdPvHd8mlA7ywicv1ysHMotM/+YHe9grWtzvFeBVgomgYI KGaDuBw7VhlpdHuPWtFD6B8WZFt3eo7Wwkq+LqLELjOVVePX6Df78j4JYAPh00ZmPuMh FLFWy1tmVSOpvMQsTNiHthUlcN1JuNAi5KweF9wZGuWgCNAu+1mTe67hO2DDk03AGzC6 i8A7PAK//2pFSAOHk+CCbGNEespTV51N1AVAswbxpPq8QoiDmZI68VMjN8bzjhEg1KLe lSRR7LjP2m7JOD8Agok+4Sxjz7fBLFhS9CUWWseodqPf60q6vuSnK6SImVbj42Qpol7V 46uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b9bf32EX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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. [2001:470:142::17]) by mx.google.com with ESMTPS id n22si4092921qtp.366.2020.05.02.15.54.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 May 2020 15:54:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::17 as permitted sender) client-ip=2001:470:142::17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b9bf32EX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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]:36900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jV11P-00049l-7s for patch@linaro.org; Sat, 02 May 2020 18:54:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jV0su-0003Hv-B7 for qemu-devel@nongnu.org; Sat, 02 May 2020 18:45:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jV0st-0004nG-DT for qemu-devel@nongnu.org; Sat, 02 May 2020 18:45:24 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:42290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jV0ss-0004kf-Vr for qemu-devel@nongnu.org; Sat, 02 May 2020 18:45:23 -0400 Received: by mail-pf1-x442.google.com with SMTP id f7so3533590pfa.9 for ; Sat, 02 May 2020 15:45:22 -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=HkrQs5dpEFTRpOusdkDcmR/jxV9J9hkTnHpacMdwp8Y=; b=b9bf32EXnUvjntIHj/5yJHKXOw/KTHIu6oftw7zymW/onndkCLzsDPFDkU1WZzVRRC SnWpLpZ5wkH72ikbhFaYrMXV+5/W6hLS6YYBJmW4ateHNxt/VXJ2tYfbJjbNQgjsJr9n oEBADLAmMBDJ5mUBFti78UdvC4wULzYVU79O7W5D+iY0h5phdNdc34cGH34Jhcd6d0AZ DZeZLxtG1tumCP6mwFij02F+t0dCUzR7bMWNVgRlDfKdxeQs6W1uxiP4+yr8PtHmTiMV YYw9tHMUQB2CTERFPI0APOyGCCdQB5/64L8/JQfOjgQNC5roClnzWAg3O8Vi7qFDLu5Y gw6A== 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=HkrQs5dpEFTRpOusdkDcmR/jxV9J9hkTnHpacMdwp8Y=; b=QLbHc6JzMalxdwUy0fp8M7NEVo3iVBLu/XsFPhK5hi8qwevc46n7wnrTYg/Fn9W+SC BxDEciMBj68YzLDQsGB1XzFaNYnuzVu+z91IgEM31CMeVcBynzCvBy2QTjBouwV5+XOb l5GeDjnqLT3t47b/3xE2uZid2nxcRM0x6ljm1rhE8IAVM605ThDMrK+B41vdU6xydKZo bxATaIaX4GWbf55A+lc+SEWRhdeMe0CDIDWJYbXu+CS4ArZMEe+hLmxnSEdKcbQswkZd nPkI6wCyUCqQao9mXf/4E08sT32e0Vir6GH/oSi6w8Cp2ajlOAqOvb/FT/tpSUHzAzuA sXsw== X-Gm-Message-State: AGi0PuaBaU3uACpyMRx3lLuDYTtkFxq3Js10eY1RgRO6+Kd53BlRwmxI z84nENcwEnlprEIvQ51rCMuaQjmc/4U= X-Received: by 2002:a63:7e1b:: with SMTP id z27mr10123554pgc.19.1588459521156; Sat, 02 May 2020 15:45:21 -0700 (PDT) Received: from localhost.localdomain (174-21-149-226.tukw.qwest.net. [174.21.149.226]) by smtp.gmail.com with ESMTPSA id h5sm2956182pjv.4.2020.05.02.15.45.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 May 2020 15:45:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 11/15] target/arm: Wrap vector qrdmla/qrdmls in GVecGen3Fn Date: Sat, 2 May 2020 15:44:59 -0700 Message-Id: <20200502224503.2282-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200502224503.2282-1-richard.henderson@linaro.org> References: <20200502224503.2282-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::442; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x442.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::442 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" Provide a functional interface for the vector expansion. This fits better with the existing set of helpers that we provide for other operations. Signed-off-by: Richard Henderson --- target/arm/translate.h | 5 ++++ target/arm/translate-a64.c | 34 ++---------------------- target/arm/translate.c | 54 +++++++++++++++++++------------------- 3 files changed, 34 insertions(+), 59 deletions(-) -- 2.20.1 diff --git a/target/arm/translate.h b/target/arm/translate.h index ada84d411d..76cd3d31c7 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -332,6 +332,11 @@ void gen_gvec_sri(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, void gen_gvec_sli(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs, int64_t shift, uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_sqrdmlah_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); +void gen_gvec_sqrdmlsh_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); + /* * Forward to the isar_feature_* tests given a DisasContext pointer. */ diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 4d5cdcef2f..1821a8e09d 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -604,18 +604,6 @@ static void gen_gvec_op3_ool(DisasContext *s, bool is_q, int rd, is_q ? 16 : 8, vec_full_reg_size(s), data, fn); } -/* Expand a 3-operand + env pointer operation using - * an out-of-line helper. - */ -static void gen_gvec_op3_env(DisasContext *s, bool is_q, int rd, - int rn, int rm, gen_helper_gvec_3_ptr *fn) -{ - tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd), - vec_full_reg_offset(s, rn), - vec_full_reg_offset(s, rm), cpu_env, - is_q ? 16 : 8, vec_full_reg_size(s), 0, fn); -} - /* Expand a 3-operand + fpstatus pointer + simd data value operation using * an out-of-line helper. */ @@ -11710,29 +11698,11 @@ static void disas_simd_three_reg_same_extra(DisasContext *s, uint32_t insn) switch (opcode) { case 0x0: /* SQRDMLAH (vector) */ - switch (size) { - case 1: - gen_gvec_op3_env(s, is_q, rd, rn, rm, gen_helper_gvec_qrdmlah_s16); - break; - case 2: - gen_gvec_op3_env(s, is_q, rd, rn, rm, gen_helper_gvec_qrdmlah_s32); - break; - default: - g_assert_not_reached(); - } + gen_gvec_fn3(s, is_q, rd, rn, rm, gen_gvec_sqrdmlah_qc, size); return; case 0x1: /* SQRDMLSH (vector) */ - switch (size) { - case 1: - gen_gvec_op3_env(s, is_q, rd, rn, rm, gen_helper_gvec_qrdmlsh_s16); - break; - case 2: - gen_gvec_op3_env(s, is_q, rd, rn, rm, gen_helper_gvec_qrdmlsh_s32); - break; - default: - g_assert_not_reached(); - } + gen_gvec_fn3(s, is_q, rd, rn, rm, gen_gvec_sqrdmlsh_qc, size); return; case 0x2: /* SDOT / UDOT */ diff --git a/target/arm/translate.c b/target/arm/translate.c index a5bb4b0040..8d20726dcf 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -3901,20 +3901,26 @@ static const uint8_t neon_2rm_sizes[] = { [NEON_2RM_VCVT_UF] = 0x4, }; - -/* Expand v8.1 simd helper. */ -static int do_v81_helper(DisasContext *s, gen_helper_gvec_3_ptr *fn, - int q, int rd, int rn, int rm) +void gen_gvec_sqrdmlah_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz) { - if (dc_isar_feature(aa32_rdm, s)) { - int opr_sz = (1 + q) * 8; - tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), - vfp_reg_offset(1, rn), - vfp_reg_offset(1, rm), cpu_env, - opr_sz, opr_sz, 0, fn); - return 0; - } - return 1; + static gen_helper_gvec_3_ptr * const fns[2] = { + gen_helper_gvec_qrdmlah_s16, gen_helper_gvec_qrdmlah_s32 + }; + tcg_debug_assert(vece >= 1 && vece <= 2); + tcg_gen_gvec_3_ptr(rd_ofs, rn_ofs, rm_ofs, cpu_env, + opr_sz, max_sz, 0, fns[vece - 1]); +} + +void gen_gvec_sqrdmlsh_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, + uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz) +{ + static gen_helper_gvec_3_ptr * const fns[2] = { + gen_helper_gvec_qrdmlsh_s16, gen_helper_gvec_qrdmlsh_s32 + }; + tcg_debug_assert(vece >= 1 && vece <= 2); + tcg_gen_gvec_3_ptr(rd_ofs, rn_ofs, rm_ofs, cpu_env, + opr_sz, max_sz, 0, fns[vece - 1]); } #define GEN_CMP0(NAME, COND) \ @@ -5465,13 +5471,10 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) break; /* VPADD */ } /* VQRDMLAH */ - switch (size) { - case 1: - return do_v81_helper(s, gen_helper_gvec_qrdmlah_s16, - q, rd, rn, rm); - case 2: - return do_v81_helper(s, gen_helper_gvec_qrdmlah_s32, - q, rd, rn, rm); + if (dc_isar_feature(aa32_rdm, s) && (size == 1 || size == 2)) { + gen_gvec_sqrdmlah_qc(size, rd_ofs, rn_ofs, rm_ofs, + vec_size, vec_size); + return 0; } return 1; @@ -5484,13 +5487,10 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn) break; } /* VQRDMLSH */ - switch (size) { - case 1: - return do_v81_helper(s, gen_helper_gvec_qrdmlsh_s16, - q, rd, rn, rm); - case 2: - return do_v81_helper(s, gen_helper_gvec_qrdmlsh_s32, - q, rd, rn, rm); + if (dc_isar_feature(aa32_rdm, s) && (size == 1 || size == 2)) { + gen_gvec_sqrdmlsh_qc(size, rd_ofs, rn_ofs, rm_ofs, + vec_size, vec_size); + return 0; } return 1;