From nobody Sat Jun 29 03:23:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552295442879417.0706599658363; Mon, 11 Mar 2019 02:10:42 -0700 (PDT) Received: from localhost ([127.0.0.1]:57847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3GxC-0008Ea-Q1 for importer@patchew.org; Mon, 11 Mar 2019 05:10:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3Gqu-0003Ac-Vx for qemu-devel@nongnu.org; Mon, 11 Mar 2019 05:04:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3Gqt-0005W0-33 for qemu-devel@nongnu.org; Mon, 11 Mar 2019 05:04:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42638) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h3Gqp-0005Ry-FS; Mon, 11 Mar 2019 05:04:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4843B88304; Mon, 11 Mar 2019 09:04:01 +0000 (UTC) Received: from localhost (ovpn-117-96.ams2.redhat.com [10.36.117.96]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DC2019C71; Mon, 11 Mar 2019 09:03:57 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Mon, 11 Mar 2019 10:02:56 +0100 Message-Id: <20190311090322.21603-8-cohuck@redhat.com> In-Reply-To: <20190311090322.21603-1-cohuck@redhat.com> References: <20190311090322.21603-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 11 Mar 2019 09:04:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/33] s390x/tcg: Implement VECTOR GENERATE MASK 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: qemu-s390x@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Add gen_gvec_dupi() for handling duplication of immediates, so it can be reused later. Reviewed-by: Richard Henderson Message-Id: <20190307121539.12842-7-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/insn-data.def | 2 ++ target/s390x/translate_vx.inc.c | 47 +++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index d3f66c858f32..c8cd5dfa249e 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -979,6 +979,8 @@ E(0xe712, VGEG, VRV, V, la2, 0, 0, 0, vge, 0, ES_64, IF_VEC) /* VECTOR GENERATE BYTE MASK */ F(0xe744, VGBM, VRI_a, V, 0, 0, 0, 0, vgbm, 0, IF_VEC) +/* VECTOR GENERATE MASK */ + F(0xe746, VGM, VRI_b, V, 0, 0, 0, 0, vgm, 0, IF_VEC) =20 #ifndef CONFIG_USER_ONLY /* COMPARE AND SWAP AND PURGE */ diff --git a/target/s390x/translate_vx.inc.c b/target/s390x/translate_vx.in= c.c index 395c0ebcc2a8..28edd9b0c4cc 100644 --- a/target/s390x/translate_vx.inc.c +++ b/target/s390x/translate_vx.inc.c @@ -44,6 +44,7 @@ =20 #define NUM_VEC_ELEMENT_BYTES(es) (1 << (es)) #define NUM_VEC_ELEMENTS(es) (16 / NUM_VEC_ELEMENT_BYTES(es)) +#define NUM_VEC_ELEMENT_BITS(es) (NUM_VEC_ELEMENT_BYTES(es) * BITS_PER_BYT= E) =20 #define ES_8 MO_8 #define ES_16 MO_16 @@ -115,6 +116,26 @@ static void write_vec_element_i64(TCGv_i64 src, int re= g, uint8_t enr, #define gen_gvec_dup64i(v1, c) \ tcg_gen_gvec_dup64i(vec_full_reg_offset(v1), 16, 16, c) =20 +static void gen_gvec_dupi(uint8_t es, uint8_t reg, uint64_t c) +{ + switch (es) { + case ES_8: + tcg_gen_gvec_dup8i(vec_full_reg_offset(reg), 16, 16, c); + break; + case ES_16: + tcg_gen_gvec_dup16i(vec_full_reg_offset(reg), 16, 16, c); + break; + case ES_32: + tcg_gen_gvec_dup32i(vec_full_reg_offset(reg), 16, 16, c); + break; + case ES_64: + gen_gvec_dup64i(reg, c); + break; + default: + g_assert_not_reached(); + } +} + static DisasJumpType op_vge(DisasContext *s, DisasOps *o) { const uint8_t es =3D s->insn->data; @@ -172,3 +193,29 @@ static DisasJumpType op_vgbm(DisasContext *s, DisasOps= *o) } return DISAS_NEXT; } + +static DisasJumpType op_vgm(DisasContext *s, DisasOps *o) +{ + const uint8_t es =3D get_field(s->fields, m4); + const uint8_t bits =3D NUM_VEC_ELEMENT_BITS(es); + const uint8_t i2 =3D get_field(s->fields, i2) & (bits - 1); + const uint8_t i3 =3D get_field(s->fields, i3) & (bits - 1); + uint64_t mask =3D 0; + int i; + + if (es > ES_64) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + + /* generate the mask - take care of wrapping */ + for (i =3D i2; ; i =3D (i + 1) % bits) { + mask |=3D 1ull << (bits - i - 1); + if (i =3D=3D i3) { + break; + } + } + + gen_gvec_dupi(es, get_field(s->fields, v1), mask); + return DISAS_NEXT; +} --=20 2.17.2