From patchwork Thu Jun 21 01:53:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 139431 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1487857lji; Wed, 20 Jun 2018 19:21:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJtctVo+pIjihe5O2Zchxal9Pc0h4isiOrjKTgHAmg5IdvWlCs1xwCVp6dctxDLBR0zRYVK X-Received: by 2002:ac8:44d3:: with SMTP id b19-v6mr20438971qto.167.1529547712128; Wed, 20 Jun 2018 19:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529547712; cv=none; d=google.com; s=arc-20160816; b=E/nk3wIRhsZSiYU11PvGoa3Yz9LzbmPLIrEXgbQhKAtmpdFcSh7yPvHOIK5MR/6RAT pyDmSbtNWbDA2azMiKxnfKIOPAe0uJ0IGEsReuc4GrPIB6ddf8/IdlIAv0qf6CBt15jk t8FZOload6Y30dcwUuC3DenWC2gWM0LgE4XX07Yx7oeDoKZraCcJv+GsZ1berutjdKkr 820hU8u3NaChdyrx7LDsWJZeDo9cBaPDRSFvrhtVJXDwnpM5UEYzwBKqZiR6Mxnin9uF jSvcSAFisbx1+f6ADymBdGzFde/S/X8BuNTPliv70iGcgnjZvMXly0xD23cP0DWrfu+R IjZw== 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=/0h8A3BZDF8RXvY+bWdtcrfvhJEFmIbQwJk4x2l8+Dk=; b=QJUBsrtmh1R95oem7DWi1X2uZgJ4iEKuHVpx/IaOSmDP7rvGeIEWENxkPS9LSQLTu9 dIr0fHJGlXH3g2+6FcZ/cAK0wZeFpP7N5J8kO/XTX3vjdtwWWOFBX+oTxZwYKEbD9lQt OvbjRUXznTs/UpRjzkla1XlOOfQfAivTqr0QIWMc0dY4yWmEXLljwDB4En/gZZ7RdcIS vsKmWfBkRUB35OQ4AteYBt6q8MRmfSVnRf9cO5mC9PFktuuU37ccT/svqERSEqASnPXR aaC3oKFK3oo7Kjmo1WOiajIB4ZTstWxXaIjqPtVZzyaxBBmms8aQVIq9pr32E8spDGxE UgRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AFLbihHr; 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 g49-v6si80305qvg.7.2018.06.20.19.21.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 20 Jun 2018 19:21:52 -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=AFLbihHr; 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]:52630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVpEN-0001aN-LM for patch@linaro.org; Wed, 20 Jun 2018 22:21:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVooO-0004ov-8C for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:55:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVooM-0003Qt-Ga for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:55:00 -0400 Received: from mail-pg0-x232.google.com ([2607:f8b0:400e:c05::232]:44093) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fVooM-0003Qe-Ab for qemu-devel@nongnu.org; Wed, 20 Jun 2018 21:54:58 -0400 Received: by mail-pg0-x232.google.com with SMTP id g26-v6so636820pgn.11 for ; Wed, 20 Jun 2018 18:54:58 -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=/0h8A3BZDF8RXvY+bWdtcrfvhJEFmIbQwJk4x2l8+Dk=; b=AFLbihHryh2nCHH15bOVKtmQXN2BBDJWIdp/FaNFfUOtsm3fAedPN81Cq7odxYIusQ zd3OPyXErv+P9eUG9BiS0fpiAJr8FRyOOps0X1ITtKaMcMDeH2LOTbxy+H9yJIawFLVq zHY0cu2IdvGWl/dA9J3IvMCoVfi8V0hLN1mPY= 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=/0h8A3BZDF8RXvY+bWdtcrfvhJEFmIbQwJk4x2l8+Dk=; b=mSbjkEtSneLUxlpOJ9i7N/JZvppN3NJsMOXXE7s3o7JImpIu4YAhSoub8Q9M4CA9Eq v6VATYJxR4SJ5PtLouA7RJmKSlFTm5WDITFGezD4NU1LvqlWkqNXN5UG5gj/5PN45dcm dzBxof1mUORPsHaycutztZbQ/3Lsf9iDASG0HL4EgfjUPEVY4IUlqVT5wh3Vsy+Ktx7w LmqwIjxZYiMzbaoFs523ZMwGqBlOv6Xb8TEaB6MCEcxiW366K5shEpCmxmlnhs5eAYGP xyjCw2u/qGhtmOe4O+SICJANOaLLHJ5BZh3YGQUUI5YdkYEuohNzvP09/zj0t+DWO7Yd S8zA== X-Gm-Message-State: APt69E1z5Zo/7AzJ5eorxtzQzUhPoM2TSj/xRz+XW8yCv0x84lqPvNx1 5gwjyZWxow3r0HjqzRkPUOeLhb7qkAI= X-Received: by 2002:a62:8202:: with SMTP id w2-v6mr25345344pfd.32.1529546097046; Wed, 20 Jun 2018 18:54:57 -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.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 18:54:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 20 Jun 2018 15:53:51 -1000 Message-Id: <20180621015359.12018-28-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:c05::232 Subject: [Qemu-devel] [PATCH v5 27/35] target/arm: Implement SVE MOVPRFX 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/translate-sve.c | 60 +++++++++++++++++++++++++++++++++++++- target/arm/sve.decode | 7 +++++ 2 files changed, 66 insertions(+), 1 deletion(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 308c04de89..067c219b54 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -351,6 +351,23 @@ static bool do_zpzz_ool(DisasContext *s, arg_rprr_esz *a, gen_helper_gvec_4 *fn) return true; } +/* Select active elememnts from Zn and inactive elements from Zm, + * storing the result in Zd. + */ +static void do_sel_z(DisasContext *s, int rd, int rn, int rm, int pg, int esz) +{ + static gen_helper_gvec_4 * const fns[4] = { + gen_helper_sve_sel_zpzz_b, gen_helper_sve_sel_zpzz_h, + gen_helper_sve_sel_zpzz_s, gen_helper_sve_sel_zpzz_d + }; + unsigned vsz = vec_full_reg_size(s); + tcg_gen_gvec_4_ool(vec_full_reg_offset(s, rd), + vec_full_reg_offset(s, rn), + vec_full_reg_offset(s, rm), + pred_full_reg_offset(s, pg), + vsz, vsz, 0, fns[esz]); +} + #define DO_ZPZZ(NAME, name) \ static bool trans_##NAME##_zpzz(DisasContext *s, arg_rprr_esz *a, \ uint32_t insn) \ @@ -401,7 +418,13 @@ static bool trans_UDIV_zpzz(DisasContext *s, arg_rprr_esz *a, uint32_t insn) return do_zpzz_ool(s, a, fns[a->esz]); } -DO_ZPZZ(SEL, sel) +static bool trans_SEL_zpzz(DisasContext *s, arg_rprr_esz *a, uint32_t insn) +{ + if (sve_access_check(s)) { + do_sel_z(s, a->rd, a->rn, a->rm, a->pg, a->esz); + } + return true; +} #undef DO_ZPZZ @@ -5038,3 +5061,38 @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr *a, uint32_t insn) sve_access_check(s); return true; } + +/* + * Move Prefix + * + * TODO: The implementation so far could handle predicated merging movprfx. + * The helper functions as written take an extra source register to + * use in the operation, but the result is only written when predication + * succeeds. For unpredicated movprfx, we need to rearrange the helpers + * to allow the final write back to the destination to be unconditional. + * For predicated zering movprfz, we need to rearrange the helpers to + * allow the final write back to zero inactives. + * + * In the meantime, just emit the moves. + */ + +static bool trans_MOVPRFX(DisasContext *s, arg_MOVPRFX *a, uint32_t insn) +{ + return do_mov_z(s, a->rd, a->rn); +} + +static bool trans_MOVPRFX_m(DisasContext *s, arg_rpr_esz *a, uint32_t insn) +{ + if (sve_access_check(s)) { + do_sel_z(s, a->rd, a->rn, a->rd, a->pg, a->esz); + } + return true; +} + +static bool trans_MOVPRFX_z(DisasContext *s, arg_rpr_esz *a, uint32_t insn) +{ + if (sve_access_check(s)) { + do_movz_zpz(s, a->rd, a->rn, a->pg, a->esz); + } + return true; +} diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 94d7b157b4..85f2b39776 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -266,6 +266,10 @@ ORV 00000100 .. 011 000 001 ... ..... ..... @rd_pg_rn EORV 00000100 .. 011 001 001 ... ..... ..... @rd_pg_rn ANDV 00000100 .. 011 010 001 ... ..... ..... @rd_pg_rn +# SVE constructive prefix (predicated) +MOVPRFX_z 00000100 .. 010 000 001 ... ..... ..... @rd_pg_rn +MOVPRFX_m 00000100 .. 010 001 001 ... ..... ..... @rd_pg_rn + # SVE integer add reduction (predicated) # Note that saddv requires size != 3. UADDV 00000100 .. 000 001 001 ... ..... ..... @rd_pg_rn @@ -414,6 +418,9 @@ ADR_p64 00000100 11 1 ..... 1010 .. ..... ..... @rd_rn_msz_rm ### SVE Integer Misc - Unpredicated Group +# SVE constructive prefix (unpredicated) +MOVPRFX 00000100 00 1 00000 101111 rn:5 rd:5 + # SVE floating-point exponential accelerator # Note esz != 0 FEXPA 00000100 .. 1 00000 101110 ..... ..... @rd_rn