From patchwork Thu Feb 14 03:43:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 158309 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp876535jaa; Wed, 13 Feb 2019 20:03:17 -0800 (PST) X-Google-Smtp-Source: AHgI3IZO2kPKL5SnFK3EpPaor7JEc6Q/afVH0FD/sI350Bdxpz8Nu4UR8KCdgmJOZMkJ3ba8J2sw X-Received: by 2002:a25:ab52:: with SMTP id u76mr1395167ybi.143.1550116997925; Wed, 13 Feb 2019 20:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550116997; cv=none; d=google.com; s=arc-20160816; b=r3dJHkrn0iGH3Ilj8LsWjbGcOg1xlf8p59Grnpqk09r1gSY0zr4/8ntaCsNeyV8eYK XaQnuTRDqs/QxIjQVtqalzPJDs2YJWyCW/3NyYmoOI8v3GKi2QS1n4fCAcIcFPUvs3Xt 9Fozq5UZqnuoLso/VytFDJ94f3FBKX0x4dm2M+Owd99wBrnACtqOXV34P0QtR0//R+Rq 2V++hnjbHtnL+2ohU17kNnJEYu4w4Z87MtJLLFriHshffjrLnsuss9hyOpo6wMyCIKvn cDb43FUdCQ+7I2RyTlpxvOchh2ygbIgfWh/wOKq6gxHPTjbjfxn2e+SkepJXUYMIAIFG HfoA== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=+3uqZJoPHf7H0MV6qZLBPTy2QZidE62Ds6I3+3j8avw=; b=LYawSfHjnDga2HVUJw5rvlORqFS+GxTvW48EWcPA5/hdZhjjZtnaZqhGZXqAA+LQ6L RfWf5ETCCW9pUxldyOFdJnf9RUOMm7AK2W+CzwlN6iz13AX8SjkW8VcZfkB09Mb7zbOk ofwmIRBvwiRnUjaaHOZTK++vxZHg3UTqVOmaciNPkCbtnSRTW7bxt+mYD9IeTnW1KTn/ 7qYIyiyb6GIWyJqimuBGttU9JP7vSvnCNifohjFvK5U+rvE9ELQc9xLr6q58YcxhUnDH ojm6zirl18YczJZwTeF8LsijlRXYdV6GPmrzh640ILhCLJFaMdcv5PoFmZQvH/7VLPdL E5PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ApmbJmSv; 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 188si711720ybv.56.2019.02.13.20.03.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 13 Feb 2019 20:03:17 -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=fail header.i=@linaro.org header.s=google header.b=ApmbJmSv; 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 ([127.0.0.1]:39490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gu8F3-0002JR-GW for patch@linaro.org; Wed, 13 Feb 2019 23:03:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gu89f-0006a3-BK for qemu-devel@nongnu.org; Wed, 13 Feb 2019 22:57:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gu7wL-000750-3m for qemu-devel@nongnu.org; Wed, 13 Feb 2019 22:43:59 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:41354) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gu7wK-00071V-Qk for qemu-devel@nongnu.org; Wed, 13 Feb 2019 22:43:57 -0500 Received: by mail-pg1-x543.google.com with SMTP id m1so2291585pgq.8 for ; Wed, 13 Feb 2019 19:43:53 -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; bh=+3uqZJoPHf7H0MV6qZLBPTy2QZidE62Ds6I3+3j8avw=; b=ApmbJmSvB8VSJDL5eDTlE8zZT7BoNNLMEsDwRhJFjr3eKePGIbrymDIGAXR+wDsYQp Kcx4zakuvQxGuhx6U5dwOkvnshH5f5vRdvTHmP0+RjUakhDgZGTc21MwjyrubISlZkkL eowkEfdF8TfVCU1BvXRgXWpZplhbzltfiI+ZnoXQ4vJokPrKj/gtk8wjiuDkUUe2OcRX /S/ZnIo+5J8zabDuKh/5obnB3j2yozEl0/99An5MKBkm76ZSyd6Ex8SQ/okHbtXCM1y8 8oXorhE6nIv45jWFumfDZviADbf6t3WZXaEPd9/roYkZvd54VYAp0FcSjCi5VEGMtfjX 2G3g== 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; bh=+3uqZJoPHf7H0MV6qZLBPTy2QZidE62Ds6I3+3j8avw=; b=kzgZMuRIX+zuHNKi8k61in8rDvbwqYJ3liOsSxnRoP4o+EqgWBPpBK49KEH+LnArGK /RQ9nENZHQRI8QCMx34F3vzmAy1xkRknk1m7tV8IZ4xfBA0d8mcCGpHwbxsowpfyu6ox ILMamd6ZS3r2BoFVAJw7BEHbYDg0zZMQUZOYITgC8SR2XII+z2ERUz8n34lP5fRgAFtp CklJP9z8xoPHPtueojtXJSCbAaqjgJ0AEgiZhfsTk52HGOZxp+5VaZ06BpOW/qzoW8nT jA6h+UShNcVXfPPi9XqZhU+8ULnfPmQtkiLtWbrSPJFgBJn8cXe6y+eanxpGaq1BvtJP zibQ== X-Gm-Message-State: AHQUAuaDqYlyl1i1+7oV8TzaAQzp2o1f5WIkDzjZwuoa4WOmyyuBCgdy RDWZj/RjKXUYdWsH03+xTcv7XjZegX0= X-Received: by 2002:a63:5761:: with SMTP id h33mr1672927pgm.283.1550115831660; Wed, 13 Feb 2019 19:43:51 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id o2sm972713pgq.90.2019.02.13.19.43.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Feb 2019 19:43:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 19:43:44 -0800 Message-Id: <20190214034345.24722-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190214034345.24722-1-richard.henderson@linaro.org> References: <20190214034345.24722-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 Subject: [Qemu-devel] [PATCH 3/4] target/arm: Implement VFMAL and VFMSL for aarch32 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/cpu.h | 5 ++ target/arm/translate.c | 104 +++++++++++++++++++++++++++++------------ 2 files changed, 80 insertions(+), 29 deletions(-) -- 2.17.2 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 15085a94ff..84d24044fe 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3232,6 +3232,11 @@ static inline bool isar_feature_aa32_dp(const ARMISARegisters *id) return FIELD_EX32(id->id_isar6, ID_ISAR6, DP) != 0; } +static inline bool isar_feature_aa32_fhm(const ARMISARegisters *id) +{ + return FIELD_EX32(id->id_isar6, ID_ISAR6, FHM) != 0; +} + static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id) { /* diff --git a/target/arm/translate.c b/target/arm/translate.c index 66cf28c8cb..0ed4768080 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8236,15 +8236,8 @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL; int rd, rn, rm, opr_sz; int data = 0; - bool q; - - q = extract32(insn, 6, 1); - VFP_DREG_D(rd, insn); - VFP_DREG_N(rn, insn); - VFP_DREG_M(rm, insn); - if ((rd | rn | rm) & q) { - return 1; - } + int off_rn, off_rm; + bool is_long = false, q = extract32(insn, 6, 1); if ((insn & 0xfe200f10) == 0xfc200800) { /* VCMLA -- 1111 110R R.1S .... .... 1000 ...0 .... */ @@ -8271,10 +8264,38 @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) return 1; } fn_gvec = u ? gen_helper_gvec_udot_b : gen_helper_gvec_sdot_b; + } else if ((insn & 0xff300f10) == 0xfc200810) { + /* VFM[AS]L -- 1111 1100 S.10 .... .... 1000 .Q.1 .... */ + int sub = extract32(insn, 23, 1); + if (!dc_isar_feature(aa32_fhm, s)) { + return 1; + } + is_long = true; + fn_gvec_ptr = sub ? gen_helper_gvec_fmlsl_h : gen_helper_gvec_fmlal_h; + data = 0; /* is_2 == 0 */ } else { return 1; } + VFP_DREG_D(rd, insn); + if (rd & q) { + return 1; + } + if (q || !is_long) { + VFP_DREG_N(rn, insn); + VFP_DREG_M(rm, insn); + if ((rn | rm) & q & !is_long) { + return 1; + } + off_rn = vfp_reg_offset(1, rn); + off_rm = vfp_reg_offset(1, rm); + } else { + rn = VFP_SREG_N(insn); + rm = VFP_SREG_M(insn); + off_rn = vfp_reg_offset(0, rn); + off_rm = vfp_reg_offset(0, rm); + } + if (s->fp_excp_el) { gen_exception_insn(s, 4, EXCP_UDEF, syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); @@ -8287,15 +8308,11 @@ static int disas_neon_insn_3same_ext(DisasContext *s, uint32_t insn) opr_sz = (1 + q) * 8; if (fn_gvec_ptr) { TCGv_ptr fpst = get_fpstatus_ptr(1); - tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), - vfp_reg_offset(1, rn), - vfp_reg_offset(1, rm), fpst, + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, fpst, opr_sz, opr_sz, data, fn_gvec_ptr); tcg_temp_free_ptr(fpst); } else { - tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), - vfp_reg_offset(1, rn), - vfp_reg_offset(1, rm), + tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm, opr_sz, opr_sz, data, fn_gvec); } return 0; @@ -8314,14 +8331,8 @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) gen_helper_gvec_3 *fn_gvec = NULL; gen_helper_gvec_3_ptr *fn_gvec_ptr = NULL; int rd, rn, rm, opr_sz, data; - bool q; - - q = extract32(insn, 6, 1); - VFP_DREG_D(rd, insn); - VFP_DREG_N(rn, insn); - if ((rd | rn) & q) { - return 1; - } + int off_rn, off_rm; + bool is_long = false, q = extract32(insn, 6, 1); if ((insn & 0xff000f10) == 0xfe000800) { /* VCMLA (indexed) -- 1111 1110 S.RR .... .... 1000 ...0 .... */ @@ -8350,6 +8361,7 @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) } else if ((insn & 0xffb00f00) == 0xfe200d00) { /* V[US]DOT -- 1111 1110 0.10 .... .... 1101 .Q.U .... */ int u = extract32(insn, 4, 1); + if (!dc_isar_feature(aa32_dp, s)) { return 1; } @@ -8357,10 +8369,48 @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) /* rm is just Vm, and index is M. */ data = extract32(insn, 5, 1); /* index */ rm = extract32(insn, 0, 4); + } else if ((insn & 0xffa00f10) == 0xfe000810) { + /* VFM[AS]L -- 1111 1110 0.0S .... .... 1000 .Q.1 .... */ + int sub = extract32(insn, 20, 1); + int vm20 = extract32(insn, 0, 3); + int vm3 = extract32(insn, 3, 1); + int m = extract32(insn, 5, 1); + int index; + + if (!dc_isar_feature(aa32_fhm, s)) { + return 1; + } + if (q) { + rm = vm20; + index = m * 2 + vm3; + } else { + rm = vm20 * 2 + m; + index = vm3; + } + is_long = true; + data = index << 1; /* is_2 == 0 */ + fn_gvec_ptr = (sub ? gen_helper_gvec_fmlsl_idx_h + : gen_helper_gvec_fmlal_idx_h); } else { return 1; } + VFP_DREG_D(rd, insn); + if (rd & q) { + return 1; + } + if (q || !is_long) { + VFP_DREG_N(rn, insn); + if (rn & q & !is_long) { + return 1; + } + off_rn = vfp_reg_offset(1, rn); + off_rm = vfp_reg_offset(1, rm); + } else { + rn = VFP_SREG_N(insn); + off_rn = vfp_reg_offset(0, rn); + off_rm = vfp_reg_offset(0, rm); + } if (s->fp_excp_el) { gen_exception_insn(s, 4, EXCP_UDEF, syn_simd_access_trap(1, 0xe, false), s->fp_excp_el); @@ -8373,15 +8423,11 @@ static int disas_neon_insn_2reg_scalar_ext(DisasContext *s, uint32_t insn) opr_sz = (1 + q) * 8; if (fn_gvec_ptr) { TCGv_ptr fpst = get_fpstatus_ptr(1); - tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), - vfp_reg_offset(1, rn), - vfp_reg_offset(1, rm), fpst, + tcg_gen_gvec_3_ptr(vfp_reg_offset(1, rd), off_rn, off_rm, fpst, opr_sz, opr_sz, data, fn_gvec_ptr); tcg_temp_free_ptr(fpst); } else { - tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), - vfp_reg_offset(1, rn), - vfp_reg_offset(1, rm), + tcg_gen_gvec_3_ool(vfp_reg_offset(1, rd), off_rn, off_rm, opr_sz, opr_sz, data, fn_gvec); } return 0;