From patchwork Thu Jun 21 01:53:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 139419 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1479812lji; Wed, 20 Jun 2018 19:09:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ8VYUh1XDUeeOkQF+vq6O8+POSuWVzoQuJlnaLZqGOxc0nVldYndcO1FLBU1IMVAlGkVI9 X-Received: by 2002:a37:5041:: with SMTP id e62-v6mr20464183qkb.133.1529546988772; Wed, 20 Jun 2018 19:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529546988; cv=none; d=google.com; s=arc-20160816; b=ImlTcIrWxjxSuVVX3+1noKvxSebWhwDJ1hI6ZTp6CKzTkhmHwSqL6EwC5DxCOi6Yl5 F1oxEc9lRLMbsMhLpY6kB9u7FctRUNqy547kMk0P+fevF8u6jXmpMeXMp7u/QtsFHC/x OqJWk84jrPikF50293dmGV47Dkn9L7+tD5wDg33ZKUn///Sfrxk1Yv73yEDcVLZHslmN DjwQIklYN2BJ7nM4CVxdHTreQIqdQoDON/lMrGbSUrtZRWh22zcVKSJ4vpmqYKCROyGH shBQF6dYkp+vdi6BM6OHhok+Rrd07KwQtGr8nd7cYs6+w7d918gh9EP+L/hfd19PRnu+ yWYA== 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:arc-authentication-results; bh=RCtfZpKBlW4ElNRMaWaS9zgg8qe947nw1g14SfBucD0=; b=CyYdn4e3UWpUx6j59a/DJz/LFaPzDMPFNaTA9SGtIkkQisWZB5pCG4Bn0Sr81dXkBs 8wSdaLoez0XJB/YRWEAW8MxnBRMMtCp7Z4mwYnTFA+C9hViwE7N2AT4ubYwdiPpa7fJ8 HKsRBp1rsWoQlFa6TJEgD9kwpD3YQevv/xggcSJzT2rluwlDd0BQrtQrbz9p6UXplU6/ mPVj9FtiZhgBjZCtRpmuHhFCQCCwAoH5mAYiXCzEHjCcOePT98989utNLezYcf+8nVfO GiD/3h1Oes93F86zYdXHSYyQDH4gc5PeSHPpEn/9MFs0uMXVJoyFG2/vow5Kv0s0ICYu f5fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iJW0uLe9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v29-v6si3730387qtj.237.2018.06.20.19.09.48 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 20 Jun 2018 19:09:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=iJW0uLe9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:52556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVp2i-0007DW-5d for patch@linaro.org; Wed, 20 Jun 2018 22:09:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVoo9-0004bI-21 for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVoo8-0003I8-18 for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:45 -0400 Received: from mail-pl0-x22f.google.com ([2607:f8b0:400e:c01::22f]:38072) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fVoo7-0003Hl-PM for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:43 -0400 Received: by mail-pl0-x22f.google.com with SMTP id d10-v6so757627plo.5 for ; Wed, 20 Jun 2018 18:54:43 -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; bh=RCtfZpKBlW4ElNRMaWaS9zgg8qe947nw1g14SfBucD0=; b=iJW0uLe9bOPvuuQn+kE+zY+X/rWphnXbttEfStGrY6TM2IjUFmjg7G+cW5AQKXp/Rv cNS8Eai3+gi1t24aUU1kxwdFJkmDP6dG5IoX+nLNViMMLc9CkMSDSOu1iyyzrfiB6G8C Q0VpLRGwedekZ2/z9sz1ZrBkt8sM5fqnpF2iI= 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=RCtfZpKBlW4ElNRMaWaS9zgg8qe947nw1g14SfBucD0=; b=uZK5TCKFcuK6XoPv13FEsBjgTXJNbc9nYVqkvRZL3KhAWtneySW+vRJGSQxRhuRx72 MmKNZUu+9tfsUKJ499rJ//EVs4NYgyDe2lA9n/0/BgrQIHyH6Clwp3l5Ar9r9Mjh1TB4 0cWzTYlBf/9J7s4hcn1Db5LsK1HiDEsQgnHUrZsRE/aPFMwPGbJe4VbP0JuClowHmpFj ZM9SVpFYgAUGDSAWPyYEgOgfly8QdBl1+U2vJH+SjMJbbsTk4PMs0s+I1MhET1Ym3unC +w5ja6yIV+RiSYonQ9QZC4ZeO4P30CzraOJnRrTsr8s79t1CZJ6rbjqA5jUJIgBpwKMI qkEA== X-Gm-Message-State: APt69E3nsT5tCRoJWLu4aB+uC+vKiWcEAZSISR/oVRLuRajPXtuk/AZX cbZs87sJr7gKZsbNqbnJq3droTxdWsA= X-Received: by 2002:a17:902:125:: with SMTP id 34-v6mr26252825plb.42.1529546082491; Wed, 20 Jun 2018 18:54:42 -0700 (PDT) Received: from cloudburst.twiddle.net (mta-98-147-121-51.hawaii.rr.com. [98.147.121.51]) by smtp.gmail.com with ESMTPSA id a27-v6sm6187946pfc.18.2018.06.20.18.54.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 18:54:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:53:44 -1000 Message-Id: <20180621015359.12018-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180621015359.12018-1-richard.henderson@linaro.org> References: <20180621015359.12018-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::22f Subject: [Qemu-devel] [PATCH v5 20/35] target/arm: Implement SVE Floating Point Unary Operations - Unpredicated Group 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/arm/helper.h | 8 +++++++ target/arm/translate-sve.c | 47 ++++++++++++++++++++++++++++++++++++++ target/arm/vec_helper.c | 20 ++++++++++++++++ target/arm/sve.decode | 5 ++++ 4 files changed, 80 insertions(+) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/helper.h b/target/arm/helper.h index 56439ac1e4..ad9cb6c7d5 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -601,6 +601,14 @@ DEF_HELPER_FLAGS_5(gvec_fcmlas_idx, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_5(gvec_fcmlad, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_frecpe_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_frecpe_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_frecpe_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_4(gvec_frsqrte_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_frsqrte_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(gvec_frsqrte_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_5(gvec_fadd_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(gvec_fadd_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(gvec_fadd_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 47d64f2fc7..d7957cddbd 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -3507,6 +3507,53 @@ DO_VPZ(FMAXNMV, fmaxnmv) DO_VPZ(FMINV, fminv) DO_VPZ(FMAXV, fmaxv) +/* + *** SVE Floating Point Unary Operations - Unpredicated Group + */ + +static void do_zz_fp(DisasContext *s, arg_rr_esz *a, gen_helper_gvec_2_ptr *fn) +{ + unsigned vsz = vec_full_reg_size(s); + TCGv_ptr status = get_fpstatus_ptr(a->esz == MO_16); + + tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, a->rd), + vec_full_reg_offset(s, a->rn), + status, vsz, vsz, 0, fn); + tcg_temp_free_ptr(status); +} + +static bool trans_FRECPE(DisasContext *s, arg_rr_esz *a, uint32_t insn) +{ + static gen_helper_gvec_2_ptr * const fns[3] = { + gen_helper_gvec_frecpe_h, + gen_helper_gvec_frecpe_s, + gen_helper_gvec_frecpe_d, + }; + if (a->esz == 0) { + return false; + } + if (sve_access_check(s)) { + do_zz_fp(s, a, fns[a->esz - 1]); + } + return true; +} + +static bool trans_FRSQRTE(DisasContext *s, arg_rr_esz *a, uint32_t insn) +{ + static gen_helper_gvec_2_ptr * const fns[3] = { + gen_helper_gvec_frsqrte_h, + gen_helper_gvec_frsqrte_s, + gen_helper_gvec_frsqrte_d, + }; + if (a->esz == 0) { + return false; + } + if (sve_access_check(s)) { + do_zz_fp(s, a, fns[a->esz - 1]); + } + return true; +} + /* *** SVE Floating Point Accumulating Reduction Group */ diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c index 97af75a61b..073e5c58e7 100644 --- a/target/arm/vec_helper.c +++ b/target/arm/vec_helper.c @@ -427,6 +427,26 @@ void HELPER(gvec_fcmlad)(void *vd, void *vn, void *vm, clear_tail(d, opr_sz, simd_maxsz(desc)); } +#define DO_2OP(NAME, FUNC, TYPE) \ +void HELPER(NAME)(void *vd, void *vn, void *stat, uint32_t desc) \ +{ \ + intptr_t i, oprsz = simd_oprsz(desc); \ + TYPE *d = vd, *n = vn; \ + for (i = 0; i < oprsz / sizeof(TYPE); i++) { \ + d[i] = FUNC(n[i], stat); \ + } \ +} + +DO_2OP(gvec_frecpe_h, helper_recpe_f16, float16) +DO_2OP(gvec_frecpe_s, helper_recpe_f32, float32) +DO_2OP(gvec_frecpe_d, helper_recpe_f64, float64) + +DO_2OP(gvec_frsqrte_h, helper_rsqrte_f16, float16) +DO_2OP(gvec_frsqrte_s, helper_rsqrte_f32, float32) +DO_2OP(gvec_frsqrte_d, helper_rsqrte_f64, float64) + +#undef DO_2OP + /* Floating-point trigonometric starting value. * See the ARM ARM pseudocode function FPTrigSMul. */ diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 39a803621f..191be9463d 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -739,6 +739,11 @@ FMINNMV 01100101 .. 000 101 001 ... ..... ..... @rd_pg_rn FMAXV 01100101 .. 000 110 001 ... ..... ..... @rd_pg_rn FMINV 01100101 .. 000 111 001 ... ..... ..... @rd_pg_rn +## SVE Floating Point Unary Operations - Unpredicated Group + +FRECPE 01100101 .. 001 110 001100 ..... ..... @rd_rn +FRSQRTE 01100101 .. 001 111 001100 ..... ..... @rd_rn + ### SVE FP Accumulating Reduction Group # SVE floating-point serial reduction (predicated)